From d0c9273d679cfec73c10e6f863c5cf9012a3aa2f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 May 2015 16:44:15 -0400 Subject: [PATCH] install service with Emby name --- .../Configuration/ServerConfiguration.cs | 14 ++++++++--- .../Music/FanArtAlbumProvider.cs | 2 +- .../FFMpeg/FFMpegDownloadInfo.cs | 12 +++++----- MediaBrowser.ServerApplication/App.config | 2 +- .../BackgroundService.cs | 24 ++++++++++++++++--- .../BackgroundServiceInstaller.cs | 2 +- MediaBrowser.ServerApplication/MainStartup.cs | 7 +++--- .../Native/Autorun.cs | 19 +++++++++++++-- 8 files changed, 62 insertions(+), 20 deletions(-) diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 2833e71677..a0a7fc90d5 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -277,7 +277,7 @@ namespace MediaBrowser.Model.Configuration { new ImageOption { - Limit = 3, + Limit = 2, MinWidth = 1280, Type = ImageType.Backdrop }, @@ -304,7 +304,7 @@ namespace MediaBrowser.Model.Configuration new ImageOption { - Limit = 1, + Limit = 0, Type = ImageType.Banner }, @@ -374,7 +374,7 @@ namespace MediaBrowser.Model.Configuration { new ImageOption { - Limit = 1, + Limit = 0, MinWidth = 1280, Type = ImageType.Backdrop }, @@ -414,6 +414,14 @@ namespace MediaBrowser.Model.Configuration { Limit = 0, Type = ImageType.Art + }, + + // Don't download this by default + // Generally not used + new ImageOption + { + Limit = 0, + Type = ImageType.Logo } } }, diff --git a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs index 734ee74b6e..0676d93d16 100644 --- a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs @@ -7,6 +7,7 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; +using MediaBrowser.Providers.TV; using System; using System.Collections.Generic; using System.Globalization; @@ -16,7 +17,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; -using MediaBrowser.Providers.TV; namespace MediaBrowser.Providers.Music { diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs index 4d2ed067be..8a7d10bd74 100644 --- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloadInfo.cs @@ -84,13 +84,13 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg return new[] { "http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20150331-git-5cba529-win64-static.7z", - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/windows/ffmpeg-20150331-git-5cba529-win64-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150331-git-5cba529-win64-static.7z" }; case Architecture.X86: return new[] { "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150331-git-5cba529-win32-static.7z", - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/windows/ffmpeg-20150331-git-5cba529-win32-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20150331-git-5cba529-win32-static.7z" }; } break; @@ -102,12 +102,12 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case Architecture.X86_X64: return new[] { - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.5.3.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.5.3.7z" }; case Architecture.X86: return new[] { - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z" }; } break; @@ -119,12 +119,12 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg case Architecture.X86_X64: return new[] { - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/linux/ffmpeg-2.6.1-64bit-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.6.1-64bit-static.7z" }; case Architecture.X86: return new[] { - "https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/linux/ffmpeg-2.6.1-32bit-static.7z" + "https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-2.6.1-32bit-static.7z" }; } break; diff --git a/MediaBrowser.ServerApplication/App.config b/MediaBrowser.ServerApplication/App.config index 94dd9ee733..14ce35a965 100644 --- a/MediaBrowser.ServerApplication/App.config +++ b/MediaBrowser.ServerApplication/App.config @@ -13,7 +13,7 @@ - + diff --git a/MediaBrowser.ServerApplication/BackgroundService.cs b/MediaBrowser.ServerApplication/BackgroundService.cs index 019a11e1c0..da7537cd70 100644 --- a/MediaBrowser.ServerApplication/BackgroundService.cs +++ b/MediaBrowser.ServerApplication/BackgroundService.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Logging; +using System.Linq; using System.ServiceProcess; namespace MediaBrowser.ServerApplication @@ -8,8 +9,25 @@ namespace MediaBrowser.ServerApplication /// public class BackgroundService : ServiceBase { - public static string Name = "MediaBrowser"; - public static string DisplayName = "Media Browser"; + public static string Name = "Emby"; + public static string DisplayName = "Emby Server"; + + public static string GetExistingServiceName() + { + try + { + if (ServiceController.GetServices().Any(s => s.ServiceName == "MediaBrowser")) + { + return "MediaBrowser"; + } + } + catch + { + return "MediaBrowser"; + } + + return Name; + } private readonly ILogger _logger; @@ -24,7 +42,7 @@ namespace MediaBrowser.ServerApplication CanStop = true; - ServiceName = Name; + ServiceName = GetExistingServiceName(); } /// diff --git a/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs b/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs index 15cab6c197..08c8a25b9d 100644 --- a/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs +++ b/MediaBrowser.ServerApplication/BackgroundServiceInstaller.cs @@ -22,7 +22,7 @@ namespace MediaBrowser.ServerApplication DelayedAutoStart = true, - Description = "The windows background service for Media Browser Server.", + Description = "The windows background service for Emby Server.", // Will ensure the network is available ServicesDependedOn = new[] { "LanmanServer", "Tcpip" } diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 6e8774eea1..f918fc37cc 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -370,7 +370,8 @@ namespace MediaBrowser.ServerApplication private static void RunServiceInstallationIfNeeded(string applicationPath) { - var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == BackgroundService.Name); + var serviceName = BackgroundService.GetExistingServiceName(); + var ctl = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == serviceName); if (ctl == null) { @@ -476,7 +477,7 @@ namespace MediaBrowser.ServerApplication // Update is there - execute update try { - var serviceName = _isRunningAsService ? BackgroundService.Name : string.Empty; + var serviceName = _isRunningAsService ? BackgroundService.GetExistingServiceName() : string.Empty; new ApplicationUpdater().UpdateApplication(appPaths, updateArchive, logger, serviceName); // And just let the app exit so it can update @@ -539,7 +540,7 @@ namespace MediaBrowser.ServerApplication private static void ShutdownWindowsService() { _logger.Info("Stopping background service"); - var service = new ServiceController(BackgroundService.Name); + var service = new ServiceController(BackgroundService.GetExistingServiceName()); service.Refresh(); diff --git a/MediaBrowser.ServerApplication/Native/Autorun.cs b/MediaBrowser.ServerApplication/Native/Autorun.cs index 593bb7955c..dd2a775655 100644 --- a/MediaBrowser.ServerApplication/Native/Autorun.cs +++ b/MediaBrowser.ServerApplication/Native/Autorun.cs @@ -18,17 +18,32 @@ namespace MediaBrowser.ServerApplication.Native { var shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Media Browser 3", "Media Browser Server.lnk"); + if (!Directory.Exists(Path.GetDirectoryName(shortcutPath))) + { + shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Emby", "Emby Server.lnk"); + } + var startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); + // Remove lnk from old name + try + { + fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Media Browser Server.lnk")); + } + catch + { + + } + if (autorun) { //Copy our shortut into the startup folder for this user - File.Copy(shortcutPath, Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "MBstartup.lnk"), true); + File.Copy(shortcutPath, Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk"), true); } else { //Remove our shortcut from the startup folder for this user - fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "MBstartup.lnk")); + fileSystem.DeleteFile(Path.Combine(startupPath, Path.GetFileName(shortcutPath) ?? "Emby Server.lnk")); } } }