diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index 26e5869cea..786858e099 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.LiveTv /// /// Description of the recording. /// - public string Description { get; set; } + public string Overview { get; set; } /// /// The start date of the recording, in UTC. diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index e8085fc92f..b9a7e369a2 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -39,7 +39,7 @@ namespace MediaBrowser.Model.LiveTv /// /// Description of the recording. /// - public string Description { get; set; } + public string Overview { get; set; } /// /// The start date of the recording, in UTC. diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs b/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs index f9cf90787d..3d53d2b86f 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageHeader.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.IO; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; @@ -69,6 +68,8 @@ namespace MediaBrowser.Server.Implementations.Drawing { fs.CopyTo(memoryStream); + memoryStream.Position = 0; + // Co it the old fashioned way using (var b = Image.FromStream(memoryStream, true, false)) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 185a016637..b2796bc684 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -506,7 +506,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var dto = new TimerInfoDto { ChannelName = info.ChannelName, - Description = info.Description, + Overview = info.Overview, EndDate = info.EndDate, Name = info.Name, StartDate = info.StartDate, diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 41a70790a6..031fc6e922 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -338,6 +338,7 @@ swagger-ui\swagger-ui.min.js PreserveNewest + diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 3733d55aff..6bf78c4e14 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -36,7 +36,9 @@ namespace MediaBrowser.ServerApplication var startFlag = Environment.GetCommandLineArgs().ElementAtOrDefault(1); _isRunningAsService = string.Equals(startFlag, "-service", StringComparison.OrdinalIgnoreCase); - var appPaths = CreateApplicationPaths(_isRunningAsService); + var applicationPath = Process.GetCurrentProcess().MainModule.FileName; + + var appPaths = CreateApplicationPaths(applicationPath, _isRunningAsService); var logManager = new NlogManager(appPaths.LogDirectoryPath, "server"); logManager.ReloadLogger(LogSeverity.Debug); @@ -49,7 +51,7 @@ namespace MediaBrowser.ServerApplication if (string.Equals(startFlag, "-installservice", StringComparison.OrdinalIgnoreCase)) { logger.Info("Performing service installation"); - InstallService(logger); + InstallService(applicationPath, logger); return; } @@ -57,7 +59,7 @@ namespace MediaBrowser.ServerApplication if (string.Equals(startFlag, "-installserviceasadmin", StringComparison.OrdinalIgnoreCase)) { logger.Info("Performing service installation"); - RunServiceInstallation(); + RunServiceInstallation(applicationPath); return; } @@ -65,7 +67,7 @@ namespace MediaBrowser.ServerApplication if (string.Equals(startFlag, "-uninstallservice", StringComparison.OrdinalIgnoreCase)) { logger.Info("Performing service uninstallation"); - UninstallService(logger); + UninstallService(applicationPath, logger); return; } @@ -73,17 +75,17 @@ namespace MediaBrowser.ServerApplication if (string.Equals(startFlag, "-uninstallserviceasadmin", StringComparison.OrdinalIgnoreCase)) { logger.Info("Performing service uninstallation"); - RunServiceUninstallation(); + RunServiceUninstallation(applicationPath); return; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - RunServiceInstallationIfNeeded(); + RunServiceInstallationIfNeeded(applicationPath); var currentProcess = Process.GetCurrentProcess(); - if (IsAlreadyRunning(currentProcess)) + if (IsAlreadyRunning(applicationPath, currentProcess)) { logger.Info("Shutting down because another instance of Media Browser Server is already running."); return; @@ -110,21 +112,19 @@ namespace MediaBrowser.ServerApplication /// /// The current process. /// true if [is already running] [the specified current process]; otherwise, false. - private static bool IsAlreadyRunning(Process currentProcess) + private static bool IsAlreadyRunning(string applicationPath, Process currentProcess) { - var runningPath = currentProcess.MainModule.FileName; - var duplicate = Process.GetProcesses().FirstOrDefault(i => + { + try + { + return string.Equals(applicationPath, i.MainModule.FileName) && currentProcess.Id != i.Id; + } + catch (Exception) { - try - { - return string.Equals(runningPath, i.MainModule.FileName) && currentProcess.Id != i.Id; - } - catch (Exception) - { - return false; - } - }); + return false; + } + }); if (duplicate != null) { @@ -145,19 +145,17 @@ namespace MediaBrowser.ServerApplication /// /// if set to true [run as service]. /// ServerApplicationPaths. - private static ServerApplicationPaths CreateApplicationPaths(bool runAsService) + private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, bool runAsService) { if (runAsService) { - var systemPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); + var systemPath = Path.GetDirectoryName(applicationPath); var programDataPath = Path.GetDirectoryName(systemPath); - return new ServerApplicationPaths(programDataPath); + return new ServerApplicationPaths(programDataPath, applicationPath); } - var applicationPath = Process.GetCurrentProcess().MainModule.FileName; - return new ServerApplicationPaths(applicationPath); } @@ -199,8 +197,7 @@ namespace MediaBrowser.ServerApplication logger.Info("Operating system: {0}", Environment.OSVersion.ToString()); logger.Info("Program data path: {0}", appPaths.ProgramDataPath); - var runningPath = Process.GetCurrentProcess().MainModule.FileName; - logger.Info("Executable: {0}", runningPath); + logger.Info("Application Path: {0}", appPaths.ApplicationPath); } /// @@ -279,13 +276,11 @@ namespace MediaBrowser.ServerApplication /// /// Installs the service. /// - private static void InstallService(ILogger logger) + private static void InstallService(string applicationPath, ILogger logger) { - var runningPath = Process.GetCurrentProcess().MainModule.FileName; - try { - ManagedInstallerClass.InstallHelper(new[] { runningPath }); + ManagedInstallerClass.InstallHelper(new[] { applicationPath }); logger.Info("Service installation succeeded"); } @@ -298,13 +293,11 @@ namespace MediaBrowser.ServerApplication /// /// Uninstalls the service. /// - private static void UninstallService(ILogger logger) + private static void UninstallService(string applicationPath, ILogger logger) { - var runningPath = Process.GetCurrentProcess().MainModule.FileName; - try { - ManagedInstallerClass.InstallHelper(new[] { "/u", runningPath }); + ManagedInstallerClass.InstallHelper(new[] { "/u", applicationPath }); logger.Info("Service uninstallation succeeded"); } @@ -314,26 +307,24 @@ namespace MediaBrowser.ServerApplication } } - private static void RunServiceInstallationIfNeeded() + private static void RunServiceInstallationIfNeeded(string applicationPath) { var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == BackgroundService.Name); if (ctl == null) { - RunServiceInstallation(); + RunServiceInstallation(applicationPath); } } /// /// Runs the service installation. /// - private static void RunServiceInstallation() + private static void RunServiceInstallation(string applicationPath) { - var runningPath = Process.GetCurrentProcess().MainModule.FileName; - var startInfo = new ProcessStartInfo { - FileName = runningPath, + FileName = applicationPath, Arguments = "-installservice", @@ -352,13 +343,11 @@ namespace MediaBrowser.ServerApplication /// /// Runs the service uninstallation. /// - private static void RunServiceUninstallation() + private static void RunServiceUninstallation(string applicationPath) { - var runningPath = Process.GetCurrentProcess().MainModule.FileName; - var startInfo = new ProcessStartInfo { - FileName = runningPath, + FileName = applicationPath, Arguments = "-uninstallservice",