aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-09-09 20:24:45 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-09-09 20:24:45 -0400
commitc6bd66a9f938b0c4227010f04b8f8b1df32feb58 (patch)
treeb21202ab8c7c5e33964a12c00d48851a42079f36
parent4ceb9eb6c5ac2d98a5499a96cdb56af88b0e6bb6 (diff)
3.2.30.12
-rw-r--r--MediaBrowser.Providers/People/MovieDbPersonProvider.cs31
-rw-r--r--MediaBrowser.Server.Mono/Program.cs23
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs104
-rw-r--r--SharedVersion.cs2
4 files changed, 29 insertions, 131 deletions
diff --git a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs
index d8c9ce801..9aeaa8d1f 100644
--- a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs
+++ b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs
@@ -36,10 +36,6 @@ namespace MediaBrowser.Providers.People
private readonly IHttpClient _httpClient;
private readonly ILogger _logger;
- private int _requestCount;
- private readonly object _requestCountLock = new object();
- private DateTime _lastRequestCountReset;
-
public MovieDbPersonProvider(IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)
{
_fileSystem = fileSystem;
@@ -89,26 +85,8 @@ namespace MediaBrowser.Providers.People
if (searchInfo.IsAutomated)
{
- lock (_requestCountLock)
- {
- if ((DateTime.UtcNow - _lastRequestCountReset).TotalHours >= 1)
- {
- _requestCount = 0;
- _lastRequestCountReset = DateTime.UtcNow;
- }
-
- var requestCount = _requestCount;
-
- if (requestCount >= 40)
- {
- //_logger.Debug("Throttling Tmdb people");
-
- // This needs to be throttled
- return new List<RemoteSearchResult>();
- }
-
- _requestCount = requestCount + 1;
- }
+ // Don't hammer moviedb searching by name
+ return new List<RemoteSearchResult>();
}
var url = string.Format(@"https://api.themoviedb.org/3/search/person?api_key={1}&query={0}", WebUtility.UrlEncode(searchInfo.Name), MovieDbProvider.ApiKey);
@@ -179,7 +157,10 @@ namespace MediaBrowser.Providers.People
var item = new Person();
result.HasMetadata = true;
- item.Name = info.name;
+ // Take name from incoming info, don't rename the person
+ // TODO: This should go in PersonMetadataService, not each person provider
+ item.Name = id.Name;
+
item.HomePageUrl = info.homepage;
if (!string.IsNullOrWhiteSpace(info.place_of_birth))
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index c53a80ae6..04298e325 100644
--- a/MediaBrowser.Server.Mono/Program.cs
+++ b/MediaBrowser.Server.Mono/Program.cs
@@ -41,7 +41,6 @@ namespace MediaBrowser.Server.Mono
public static void Main(string[] args)
{
var applicationPath = Assembly.GetEntryAssembly().Location;
- var appFolderPath = Path.GetDirectoryName(applicationPath);
SetSqliteProvider();
@@ -66,18 +65,13 @@ namespace MediaBrowser.Server.Mono
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- try
- {
- RunApplication(appPaths, logManager, options);
- }
- finally
- {
- _logger.Info("Disposing app host");
+ RunApplication(appPaths, logManager, options);
- if (_restartOnShutdown)
- {
- StartNewInstance(options);
- }
+ _logger.Info("Disposing app host");
+
+ if (_restartOnShutdown)
+ {
+ StartNewInstance(options);
}
}
}
@@ -121,8 +115,6 @@ namespace MediaBrowser.Server.Mono
new SystemEvents(logManager.GetLogger("SystemEvents")),
new NetworkManager(logManager.GetLogger("NetworkManager"))))
{
- appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo);
-
if (options.ContainsOption("-v"))
{
Console.WriteLine(appHost.ApplicationVersion.ToString());
@@ -134,6 +126,9 @@ namespace MediaBrowser.Server.Mono
var initProgress = new Progress<double>();
var task = appHost.Init(initProgress);
+
+ appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo);
+
Task.WaitAll(task);
Console.WriteLine("Running startup tasks");
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 3fe9c5aa7..27eb3e0e1 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -39,7 +39,6 @@ namespace MediaBrowser.ServerApplication
private static ILogger _logger;
public static bool IsRunningAsService = false;
- private static bool _canRestartService = false;
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
@@ -58,11 +57,6 @@ namespace MediaBrowser.ServerApplication
var options = new StartupOptions(Environment.GetCommandLineArgs());
IsRunningAsService = options.ContainsOption("-service");
- if (IsRunningAsService)
- {
- //_canRestartService = CanRestartWindowsService();
- }
-
var currentProcess = Process.GetCurrentProcess();
ApplicationPath = currentProcess.MainModule.FileName;
@@ -86,22 +80,6 @@ namespace MediaBrowser.ServerApplication
ApplicationHost.LogEnvironmentInfo(logger, appPaths, true);
- // Install directly
- if (options.ContainsOption("-installservice"))
- {
- logger.Info("Performing service installation");
- InstallService(ApplicationPath, logger);
- return;
- }
-
- // Restart with admin rights, then install
- if (options.ContainsOption("-installserviceasadmin"))
- {
- logger.Info("Performing service installation");
- RunServiceInstallation(ApplicationPath);
- return;
- }
-
// Uninstall directly
if (options.ContainsOption("-uninstallservice"))
{
@@ -120,8 +98,6 @@ namespace MediaBrowser.ServerApplication
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- RunServiceInstallationIfNeeded(ApplicationPath);
-
if (IsAlreadyRunning(ApplicationPath, currentProcess))
{
logger.Info("Shutting down because another instance of Emby Server is already running.");
@@ -156,6 +132,14 @@ namespace MediaBrowser.ServerApplication
return new Tuple<string, string>(processModulePath, Environment.CommandLine);
}
+ private static bool IsServiceInstalled()
+ {
+ var serviceName = BackgroundService.GetExistingServiceName();
+ var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == serviceName);
+
+ return ctl != null;
+ }
+
/// <summary>
/// Determines whether [is already running] [the specified current process].
/// </summary>
@@ -261,7 +245,7 @@ namespace MediaBrowser.ServerApplication
var resourcesPath = Path.GetDirectoryName(applicationPath);
- if (runAsService)
+ if (runAsService && IsServiceInstalled())
{
var systemPath = Path.GetDirectoryName(applicationPath);
@@ -283,7 +267,7 @@ namespace MediaBrowser.ServerApplication
{
if (IsRunningAsService)
{
- return _canRestartService;
+ return false;
}
else
{
@@ -306,7 +290,7 @@ namespace MediaBrowser.ServerApplication
if (IsRunningAsService)
{
- return _canRestartService;
+ return false;
}
else
{
@@ -370,7 +354,7 @@ namespace MediaBrowser.ServerApplication
task = task.ContinueWith(new Action<Task>(a => appHost.RunStartupTasks()), TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent);
- if (runService)
+ if (runService && IsServiceInstalled())
{
StartService(logManager);
}
@@ -447,38 +431,10 @@ namespace MediaBrowser.ServerApplication
{
var service = new BackgroundService(logManager.GetLogger("Service"));
- service.Disposed += service_Disposed;
-
ServiceBase.Run(service);
}
/// <summary>
- /// Handles the Disposed event of the service control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- static void service_Disposed(object sender, EventArgs e)
- {
- }
-
- /// <summary>
- /// Installs the service.
- /// </summary>
- private static void InstallService(string applicationPath, ILogger logger)
- {
- try
- {
- ManagedInstallerClass.InstallHelper(new[] { applicationPath });
-
- logger.Info("Service installation succeeded");
- }
- catch (Exception ex)
- {
- logger.ErrorException("Uninstall failed", ex);
- }
- }
-
- /// <summary>
/// Uninstalls the service.
/// </summary>
private static void UninstallService(string applicationPath, ILogger logger)
@@ -495,40 +451,6 @@ namespace MediaBrowser.ServerApplication
}
}
- private static void RunServiceInstallationIfNeeded(string applicationPath)
- {
- var serviceName = BackgroundService.GetExistingServiceName();
- var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == serviceName);
-
- if (ctl == null)
- {
- RunServiceInstallation(applicationPath);
- }
- }
-
- /// <summary>
- /// Runs the service installation.
- /// </summary>
- private static void RunServiceInstallation(string applicationPath)
- {
- var startInfo = new ProcessStartInfo
- {
- FileName = applicationPath,
-
- Arguments = "-installservice",
-
- CreateNoWindow = true,
- WindowStyle = ProcessWindowStyle.Hidden,
- Verb = "runas",
- ErrorDialog = false
- };
-
- using (var process = Process.Start(startInfo))
- {
- process.WaitForExit();
- }
- }
-
/// <summary>
/// Runs the service uninstallation.
/// </summary>
@@ -616,7 +538,7 @@ namespace MediaBrowser.ServerApplication
public static void Shutdown()
{
- if (IsRunningAsService)
+ if (IsRunningAsService && IsServiceInstalled())
{
ShutdownWindowsService();
}
diff --git a/SharedVersion.cs b/SharedVersion.cs
index 2de4c7944..6d2d4b25c 100644
--- a/SharedVersion.cs
+++ b/SharedVersion.cs
@@ -1,3 +1,3 @@
using System.Reflection;
-[assembly: AssemblyVersion("3.2.30.11")]
+[assembly: AssemblyVersion("3.2.30.12")]