From 576768de594a56512693715d5748973984fe5f97 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 25 Nov 2014 23:12:29 -0500 Subject: [PATCH] update translations --- MediaBrowser.Api/Images/ImageService.cs | 8 ++- MediaBrowser.Api/Playback/MediaInfoService.cs | 10 +++- .../BaseProgressiveStreamingService.cs | 1 - .../BaseApplicationPaths.cs | 53 +------------------ .../HttpClientManager/HttpClientManager.cs | 1 - ...MediaBrowser.Common.Implementations.csproj | 2 - .../MediaBrowser.Common.csproj | 1 - .../MediaBrowser.Controller.csproj | 1 + .../Net/IServerManager.cs | 5 +- MediaBrowser.Model/ApiClient/IApiClient.cs | 3 +- .../Notifications/WebSocketNotifier.cs | 2 +- .../EntryPoints/ServerEventNotifier.cs | 4 +- .../Library/LibraryManager.cs | 19 ++----- .../Localization/JavaScript/it.json | 22 ++++---- .../Localization/JavaScript/nb.json | 2 +- .../Localization/JavaScript/nl.json | 2 +- .../Localization/JavaScript/sv.json | 2 +- .../Localization/JavaScript/zh_CN.json | 2 +- .../Localization/Server/server.json | 2 +- .../ServerApplicationPaths.cs | 19 ------- .../Native/BaseMonoApp.cs | 6 +-- MediaBrowser.Server.Mono/Program.cs | 2 +- .../ApplicationPathHelper.cs | 45 ++++++++++++++++ .../MediaBrowser.Server.Startup.Common.csproj | 2 + MediaBrowser.ServerApplication/MainStartup.cs | 3 +- SharedVersion.cs | 4 +- 26 files changed, 103 insertions(+), 120 deletions(-) rename {MediaBrowser.Common => MediaBrowser.Controller}/Net/IServerManager.cs (96%) create mode 100644 MediaBrowser.Server.Startup.Common/ApplicationPathHelper.cs diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 561ce4a5c..9d7362f63 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -652,7 +652,13 @@ namespace MediaBrowser.Api.Images { if ((Request.AcceptTypes ?? new string[] { }).Contains("image/webp", StringComparer.OrdinalIgnoreCase)) { - return new[] { ImageOutputFormat.Webp, ImageOutputFormat.Jpg, ImageOutputFormat.Png }; + var userAgent = Request.UserAgent ?? string.Empty; + + // Not displaying properly on iOS + if (userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) == -1) + { + return new[] { ImageOutputFormat.Webp, ImageOutputFormat.Jpg, ImageOutputFormat.Png }; + } } return new[] { ImageOutputFormat.Jpg, ImageOutputFormat.Png }; diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs index b9973df40..77178c8cc 100644 --- a/MediaBrowser.Api/Playback/MediaInfoService.cs +++ b/MediaBrowser.Api/Playback/MediaInfoService.cs @@ -52,7 +52,15 @@ namespace MediaBrowser.Api.Playback else { var hasMediaSources = (IHasMediaSources)item; - mediaSources = hasMediaSources.GetMediaSources(true, user); + + if (user == null) + { + mediaSources = hasMediaSources.GetMediaSources(true); + } + else + { + mediaSources = hasMediaSources.GetMediaSources(true, user); + } } return ToOptimizedResult(new LiveMediaInfoResult diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 746426c8e..6bec387d4 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -421,7 +421,6 @@ namespace MediaBrowser.Api.Playback.Progressive if (!File.Exists(outputPath)) { job = await StartFfMpeg(state, outputPath, cancellationTokenSource).ConfigureAwait(false); - job.ActiveRequestCount++; } else { diff --git a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs index 668b1395d..2940f921c 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationPaths.cs @@ -1,6 +1,4 @@ using MediaBrowser.Common.Configuration; -using System; -using System.Configuration; using System.IO; namespace MediaBrowser.Common.Implementations @@ -11,20 +9,6 @@ namespace MediaBrowser.Common.Implementations /// public abstract class BaseApplicationPaths : IApplicationPaths { - /// - /// The _use debug path - /// - private readonly bool _useDebugPath; - - /// - /// Initializes a new instance of the class. - /// - protected BaseApplicationPaths(bool useDebugPath, string applicationPath) - { - _useDebugPath = useDebugPath; - ApplicationPath = applicationPath; - } - /// /// Initializes a new instance of the class. /// @@ -39,17 +23,14 @@ namespace MediaBrowser.Common.Implementations /// /// The _program data path /// - private string _programDataPath; + private readonly string _programDataPath; /// /// Gets the path to the program data folder /// /// The program data path. public string ProgramDataPath { - get - { - return _programDataPath ?? (_programDataPath = GetProgramDataPath()); - } + get { return _programDataPath; } } /// @@ -202,35 +183,5 @@ namespace MediaBrowser.Common.Implementations return Path.Combine(CachePath, "temp"); } } - - /// - /// Gets the path to the application's ProgramDataFolder - /// - /// System.String. - private string GetProgramDataPath() - { - var programDataPath = _useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; - - programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); - - // If it's a relative path, e.g. "..\" - if (!Path.IsPathRooted(programDataPath)) - { - var path = Path.GetDirectoryName(ApplicationPath); - - if (string.IsNullOrEmpty(path)) - { - throw new ApplicationException("Unable to determine running assembly location"); - } - - programDataPath = Path.Combine(path, programDataPath); - - programDataPath = Path.GetFullPath(programDataPath); - } - - Directory.CreateDirectory(programDataPath); - - return programDataPath; - } } } diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 43db03b42..900009a23 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -13,7 +13,6 @@ using System.IO; using System.Linq; using System.Net; using System.Net.Cache; -using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index 3e486d82a..58ffb93bc 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -61,11 +61,9 @@ ..\packages\SimpleInjector.2.6.1\lib\net45\SimpleInjector.Diagnostics.dll - - ..\packages\sharpcompress.0.10.2\lib\net40\SharpCompress.dll diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index d62b554fe..02a5037c8 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -70,7 +70,6 @@ - diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 420da131e..1c8a588f6 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -220,6 +220,7 @@ + diff --git a/MediaBrowser.Common/Net/IServerManager.cs b/MediaBrowser.Controller/Net/IServerManager.cs similarity index 96% rename from MediaBrowser.Common/Net/IServerManager.cs rename to MediaBrowser.Controller/Net/IServerManager.cs index 84e578579..dff086347 100644 --- a/MediaBrowser.Common/Net/IServerManager.cs +++ b/MediaBrowser.Controller/Net/IServerManager.cs @@ -1,9 +1,10 @@ -using System; +using MediaBrowser.Common.Net; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -namespace MediaBrowser.Common.Net +namespace MediaBrowser.Controller.Net { /// /// Interface IServerManager diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 731143f89..15ec130cf 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -228,8 +228,9 @@ namespace MediaBrowser.Model.ApiClient /// Gets the live media information. /// /// The item identifier. + /// The user identifier. /// Task<LiveMediaInfoResult>. - Task GetLiveMediaInfo(string itemId); + Task GetLiveMediaInfo(string itemId, string userId); /// /// Gets the users async. diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/WebSocketNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/WebSocketNotifier.cs index 5f1db03c6..916b4a622 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/WebSocketNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/WebSocketNotifier.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Net; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Notifications; using MediaBrowser.Controller.Plugins; using System.Linq; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs index 1b29971da..1eb4a6655 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Common.Plugins; +using MediaBrowser.Common.Plugins; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.Updates; using MediaBrowser.Controller; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Events; diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 14b22a24c..db14dc83f 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -623,29 +623,20 @@ namespace MediaBrowser.Server.Implementations.Library public List ResolvePaths(IEnumerable files, IDirectoryService directoryService, Folder parent, string collectionType = null) where T : BaseItem { - var list = new List(); - - Parallel.ForEach(files, f => + return files.Select(f => { try { - var item = ResolvePath(f, directoryService, parent, collectionType) as T; - - if (item != null) - { - lock (list) - { - list.Add(item); - } - } + return ResolvePath(f, directoryService, parent, collectionType) as T; } catch (Exception ex) { _logger.ErrorException("Error resolving path {0}", ex, f.FullName); + return null; } - }); - return list; + }).Where(i => i != null) + .ToList(); } /// diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/it.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/it.json index 6f7da0711..7aec1b96a 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/it.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/it.json @@ -285,7 +285,7 @@ "LabelPremiereProgram": "PREMIERE", "LabelHDProgram": "HD", "HeaderChangeFolderType": "Cambia il tipo di cartella", - "HeaderChangeFolderTypeHelp": "Per cambiare il tipo di cartella, rimuovere e ricostruire la collezione con il nuovo tipo.", + "HeaderChangeFolderTypeHelp": "To change the type, please remove and rebuild the folder with the new type.", "HeaderAlert": "Avviso", "MessagePleaseRestart": "Si prega di riavviare per completare l'aggiornamento.", "ButtonRestart": "Riavvia", @@ -617,14 +617,14 @@ "DefaultErrorMessage": "Si \u00e8 verificato un errore durante l'elaborazione della richiesta. Si prega di riprovare pi\u00f9 tardi.", "ButtonAccept": "Accetta", "ButtonReject": "Rifiuta", - "HeaderForgotPassword": "Forgot Password", - "MessageContactAdminToResetPassword": "Please contact your system administrator to reset your password.", - "MessageForgotPasswordInNetworkRequired": "Please try again within your home network to initiate the password reset process.", - "MessageForgotPasswordFileCreated": "The following file has been created on your server and contains instructions on how to proceed:", - "MessageForgotPasswordFileExpiration": "The reset pin will expire at {0}.", - "MessageInvalidForgotPasswordPin": "An invalid or expired pin was entered. Please try again.", - "MessagePasswordResetForUsers": "Passwords have been reset for the following users:", - "HeaderInviteGuest": "Invite Guest", - "ButtonLinkMyMediaBrowserAccount": "Link my account now", - "MessageConnectAccountRequiredToInviteGuest": "In order to invite guests you need to first link your Media Browser account to this server." + "HeaderForgotPassword": "Password dimenticata", + "MessageContactAdminToResetPassword": "Si prega di contattare l'amministratore di sistema per reimpostare la password.", + "MessageForgotPasswordInNetworkRequired": "Riprova all'interno della rete domestica per avviare il processo di reimpostazione della password.", + "MessageForgotPasswordFileCreated": "Il seguente file \u00e8 stato creato sul server e contiene le istruzioni su come procedere:", + "MessageForgotPasswordFileExpiration": "Il pin scadr\u00e0 {0}.", + "MessageInvalidForgotPasswordPin": "Un pin Invalido o scaduto \u00e8 stato inserito. Riprova.", + "MessagePasswordResetForUsers": "Le password sono state rimesse per i seguenti utenti:", + "HeaderInviteGuest": "Invita Ospite", + "ButtonLinkMyMediaBrowserAccount": "Collega il mio account", + "MessageConnectAccountRequiredToInviteGuest": "Per invitare gli ospiti \u00e8 necessario collegare prima il tuo account browser media a questo server." } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/nb.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/nb.json index fdcb55737..137e8bf53 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/nb.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/nb.json @@ -285,7 +285,7 @@ "LabelPremiereProgram": "PREMIERE", "LabelHDProgram": "HD", "HeaderChangeFolderType": "Endre Mappe Type", - "HeaderChangeFolderTypeHelp": "For \u00e5 endre mappe type, vennligst fjern og bygg samlingen med en ny type.", + "HeaderChangeFolderTypeHelp": "To change the type, please remove and rebuild the folder with the new type.", "HeaderAlert": "Varsling", "MessagePleaseRestart": "Vennligst utf\u00f8r en omstart for \u00e5 fullf\u00f8re oppdatering.", "ButtonRestart": "Restart", diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/nl.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/nl.json index 7ec8c1e4b..ce737386b 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/nl.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/nl.json @@ -285,7 +285,7 @@ "LabelPremiereProgram": "PREMIERE", "LabelHDProgram": "HD", "HeaderChangeFolderType": "Verander Maptype", - "HeaderChangeFolderTypeHelp": "Als u het type map wilt wijzigen, verwijder het dan en maak dan een nieuwe collectie met het nieuwe type.", + "HeaderChangeFolderTypeHelp": "Als u het type map wilt wijzigen, verwijder het dan en maak dan een nieuwe map met het nieuwe type.", "HeaderAlert": "Waarschuwing", "MessagePleaseRestart": "Herstart om update te voltooien.", "ButtonRestart": "Herstart", diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/sv.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/sv.json index 723dc20f0..20e3d258b 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/sv.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/sv.json @@ -285,7 +285,7 @@ "LabelPremiereProgram": "PREMI\u00c4R", "LabelHDProgram": "HD", "HeaderChangeFolderType": "\u00c4ndra mapptyp", - "HeaderChangeFolderTypeHelp": "F\u00f6r att \u00e4ndra mapptyp, ta bort den existerande och skapa en ny av den \u00f6nskade typen.", + "HeaderChangeFolderTypeHelp": "To change the type, please remove and rebuild the folder with the new type.", "HeaderAlert": "Varning", "MessagePleaseRestart": "V\u00e4nligen starta om f\u00f6r att slutf\u00f6ra uppdateringarna.", "ButtonRestart": "Starta om", diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/zh_CN.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/zh_CN.json index 672dedf08..a49828038 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/zh_CN.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/zh_CN.json @@ -285,7 +285,7 @@ "LabelPremiereProgram": "\u9996\u6620\u5f0f", "LabelHDProgram": "HD\u9ad8\u6e05", "HeaderChangeFolderType": "\u53d8\u66f4\u6587\u4ef6\u5939\u7c7b\u578b", - "HeaderChangeFolderTypeHelp": "\u5982\u8981\u53d8\u66f4\u6587\u4ef6\u5939\u7c7b\u578b\uff0c\u8bf7\u79fb\u9664\u5408\u96c6\u5e76\u7528\u65b0\u7c7b\u578b\u91cd\u5efa\u3002", + "HeaderChangeFolderTypeHelp": "To change the type, please remove and rebuild the folder with the new type.", "HeaderAlert": "\u8b66\u62a5", "MessagePleaseRestart": "\u8bf7\u91cd\u542f\u670d\u52a1\u5668\u4ee5\u5b8c\u6210\u66f4\u65b0\u3002", "ButtonRestart": "\u91cd\u542f", diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 45dab6a57..5995141e6 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1232,7 +1232,7 @@ "HeaderCameraUploadHelp": "Automatically upload photos and videos taken from your mobile devices into Media Browser.", "MessageNoDevicesSupportCameraUpload": "You currently don't have any devices that support camera upload.", "LabelCameraUploadPath": "Camera upload path:", - "LabelCameraUploadPathHelp": "Select a custom upload path, if desired. If unspecified a default folder will be used.", + "LabelCameraUploadPathHelp": "Select a custom upload path, if desired. If unspecified a default folder will be used. If using a custom path it will also need to be added in the library setup area.", "LabelCreateCameraUploadSubfolder": "Create a subfolder for each device", "LabelCreateCameraUploadSubfolderHelp": "Specific folders can be assigned to a device by clicking on it from the Devices page.", "LabelCustomDeviceDisplayName": "Display name:", diff --git a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs index b775580d9..68956be18 100644 --- a/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs +++ b/MediaBrowser.Server.Implementations/ServerApplicationPaths.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Implementations; using MediaBrowser.Controller; -using System; using System.IO; namespace MediaBrowser.Server.Implementations @@ -10,24 +9,6 @@ namespace MediaBrowser.Server.Implementations /// public class ServerApplicationPaths : BaseApplicationPaths, IServerApplicationPaths { -#if (DEBUG) - /// - /// Initializes a new instance of the class. - /// - public ServerApplicationPaths(string applicationPath) - : base(true, applicationPath) - { - } -#else -/// -/// Initializes a new instance of the class. -/// - public ServerApplicationPaths(string applicationPath) - : base(false, applicationPath) - { - } -#endif - /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs index ce81326fb..39d2d52d7 100644 --- a/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs +++ b/MediaBrowser.Server.Mono/Native/BaseMonoApp.cs @@ -165,12 +165,12 @@ namespace MediaBrowser.Server.Mono.Native return info; } - private NativeApp.Uname _unixName; - private NativeApp.Uname GetUnixName() + private Uname _unixName; + private Uname GetUnixName() { if (_unixName == null) { - var uname = new NativeApp.Uname(); + var uname = new Uname(); Utsname utsname; var callResult = Syscall.uname(out utsname); if (callResult == 0) diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 2fb983850..0df213d90 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -58,7 +58,7 @@ namespace MediaBrowser.Server.Mono { if (string.IsNullOrEmpty(programDataPath)) { - return new ServerApplicationPaths(applicationPath); + return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), applicationPath); } return new ServerApplicationPaths(programDataPath, applicationPath); diff --git a/MediaBrowser.Server.Startup.Common/ApplicationPathHelper.cs b/MediaBrowser.Server.Startup.Common/ApplicationPathHelper.cs new file mode 100644 index 000000000..285806791 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/ApplicationPathHelper.cs @@ -0,0 +1,45 @@ +using System; +using System.Configuration; +using System.IO; + +namespace MediaBrowser.Server.Startup.Common +{ + public static class ApplicationPathHelper + { + /// + /// Gets the path to the application's ProgramDataFolder + /// + /// System.String. + public static string GetProgramDataPath(string applicationPath) + { + var useDebugPath = false; + +#if DEBUG + useDebugPath = true; +#endif + + var programDataPath = useDebugPath ? ConfigurationManager.AppSettings["DebugProgramDataPath"] : ConfigurationManager.AppSettings["ReleaseProgramDataPath"]; + + programDataPath = programDataPath.Replace("%ApplicationData%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); + + // If it's a relative path, e.g. "..\" + if (!Path.IsPathRooted(programDataPath)) + { + var path = Path.GetDirectoryName(applicationPath); + + if (string.IsNullOrEmpty(path)) + { + throw new ApplicationException("Unable to determine running assembly location"); + } + + programDataPath = Path.Combine(path, programDataPath); + + programDataPath = Path.GetFullPath(programDataPath); + } + + Directory.CreateDirectory(programDataPath); + + return programDataPath; + } + } +} diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 46a771027..db525e8e4 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -41,6 +41,7 @@ ..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll + @@ -53,6 +54,7 @@ Properties\SharedVersion.cs + diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index e1c481d22..36430e642 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -148,6 +148,7 @@ namespace MediaBrowser.ServerApplication /// /// Creates the application paths. /// + /// The application path. /// if set to true [run as service]. /// ServerApplicationPaths. private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, bool runAsService) @@ -161,7 +162,7 @@ namespace MediaBrowser.ServerApplication return new ServerApplicationPaths(programDataPath, applicationPath); } - return new ServerApplicationPaths(applicationPath); + return new ServerApplicationPaths(ApplicationPathHelper.GetProgramDataPath(applicationPath), applicationPath); } /// diff --git a/SharedVersion.cs b/SharedVersion.cs index 62c5fa853..650c928ed 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -3,6 +3,6 @@ #if (DEBUG) [assembly: AssemblyVersion("3.0.*")] #else -//[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5441.2")] +[assembly: AssemblyVersion("3.0.*")] +//[assembly: AssemblyVersion("3.0.5441.2")] #endif