From be36f1ef4cd133b727f2d455537f23d8a096a7ad Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 28 Feb 2014 23:12:39 -0500 Subject: [PATCH] Added ServerName --- .../Configuration/ServerConfiguration.cs | 2 + MediaBrowser.Model/System/SystemInfo.cs | 6 +++ .../ApplicationHost.cs | 39 ++++++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 1b4a6813e..fc232edb3 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -209,6 +209,8 @@ namespace MediaBrowser.Model.Configuration public bool EnableRealtimeMonitor { get; set; } public PathSubstitution[] PathSubstitutions { get; set; } + public string ServerName { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 24707b29b..ec31c5529 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -146,6 +146,12 @@ namespace MediaBrowser.Model.System /// true if [supports automatic run at startup]; otherwise, false. public bool SupportsAutoRunAtStartup { get; set; } + /// + /// Gets or sets the name of the server. + /// + /// The name of the server. + public string ServerName { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 73f99cda1..1907344a1 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -336,6 +336,42 @@ namespace MediaBrowser.ServerApplication { // Not there, no big deal } + + try + { + Directory.Delete(Path.Combine(ApplicationPaths.DataPath, "fanart-movies"), true); + } + catch (IOException) + { + // Not there, no big deal + } + + try + { + Directory.Delete(Path.Combine(ApplicationPaths.DataPath, "fanart-music"), true); + } + catch (IOException) + { + // Not there, no big deal + } + + try + { + Directory.Delete(Path.Combine(ApplicationPaths.DataPath, "fanart-tv"), true); + } + catch (IOException) + { + // Not there, no big deal + } + + try + { + Directory.Delete(Path.Combine(ApplicationPaths.DataPath, "tmdb-people"), true); + } + catch (IOException) + { + // Not there, no big deal + } }); } @@ -812,7 +848,8 @@ namespace MediaBrowser.ServerApplication HasUpdateAvailable = _hasUpdateAvailable, SupportsAutoRunAtStartup = SupportsAutoRunAtStartup, TranscodingTempPath = ApplicationPaths.TranscodingTempPath, - IsRunningAsService = IsRunningAsService + IsRunningAsService = IsRunningAsService, + ServerName = string.IsNullOrWhiteSpace(ServerConfigurationManager.Configuration.ServerName) ? Environment.MachineName : ServerConfigurationManager.Configuration.ServerName }; }