Browse Source

Merge pull request #1766 from MediaBrowser/dev

Dev
Luke 9 năm trước cách đây
mục cha
commit
a9a52eb0fb

+ 1 - 0
MediaBrowser.Api/StartupWizardService.cs

@@ -109,6 +109,7 @@ namespace MediaBrowser.Api
 
         private void SetWizardFinishValues(ServerConfiguration config)
         {
+            config.EnableLocalizedGuids = true;
             config.EnableCustomPathSubFolders = true;
             config.EnableStandaloneMusicKeys = true;
             config.EnableCaseSensitiveItemIds = true;

+ 2 - 0
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -199,6 +199,7 @@ namespace MediaBrowser.Model.Configuration
 
         public bool EnableAnonymousUsageReporting { get; set; }
         public bool EnableStandaloneMusicKeys { get; set; }
+        public bool EnableLocalizedGuids { get; set; }
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
@@ -208,6 +209,7 @@ namespace MediaBrowser.Model.Configuration
             Migrations = new string[] { };
 
             EnableCustomPathSubFolders = true;
+            EnableLocalizedGuids = true;
 
             ImageSavingConvention = ImageSavingConvention.Compatible;
             PublicPort = 8096;

+ 1 - 1
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -502,7 +502,7 @@ namespace MediaBrowser.Server.Implementations.Library
                 throw new ArgumentNullException("type");
             }
 
-            if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
+            if (ConfigurationManager.Configuration.EnableLocalizedGuids && key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
             {
                 // Try to normalize paths located underneath program-data in an attempt to make them more portable
                 key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)

+ 11 - 2
MediaBrowser.ServerApplication/Native/SqliteExtensions.cs

@@ -54,9 +54,18 @@ namespace MediaBrowser.ServerApplication.Native
             _logger = logger;
         }
 
-        public Task<IDbConnection> Connect(string dbPath)
+        public async Task<IDbConnection> Connect(string dbPath)
         {
-            return SqliteExtensions.ConnectToDb(dbPath, _logger);
+            try
+            {
+                return await SqliteExtensions.ConnectToDb(dbPath, _logger).ConfigureAwait(false);
+            }
+            catch (Exception ex)
+            {
+                _logger.ErrorException("Error opening database {0}", ex, dbPath);
+
+                throw;
+            }
         }
     }
 }