瀏覽代碼

normalize strm file contents

Luke Pulverenti 7 年之前
父節點
當前提交
0a0303ca64

+ 35 - 32
Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs

@@ -195,52 +195,55 @@ namespace Emby.Server.Implementations.Configuration
             }
             }
         }
         }
 
 
-        public void DisableMetadataService(string service)
+        public bool SetOptimalValues()
         {
         {
-            DisableMetadataService(typeof(Movie), Configuration, service);
-            DisableMetadataService(typeof(Episode), Configuration, service);
-            DisableMetadataService(typeof(Series), Configuration, service);
-            DisableMetadataService(typeof(Season), Configuration, service);
-            DisableMetadataService(typeof(MusicArtist), Configuration, service);
-            DisableMetadataService(typeof(MusicAlbum), Configuration, service);
-            DisableMetadataService(typeof(MusicVideo), Configuration, service);
-            DisableMetadataService(typeof(Video), Configuration, service);
-        }
+            var config = Configuration;
 
 
-        private void DisableMetadataService(Type type, ServerConfiguration config, string service)
-        {
-            var options = GetMetadataOptions(type, config);
+            var changed = false;
 
 
-            if (!options.DisabledMetadataSavers.Contains(service, StringComparer.OrdinalIgnoreCase))
+            if (!config.EnableCaseSensitiveItemIds)
             {
             {
-                var list = options.DisabledMetadataSavers.ToList();
-
-                list.Add(service);
+                config.EnableCaseSensitiveItemIds = true;
+                changed = true;
+            }
 
 
-                options.DisabledMetadataSavers = list.ToArray(list.Count);
+            if (!config.SkipDeserializationForBasicTypes)
+            {
+                config.SkipDeserializationForBasicTypes = true;
+                changed = true;
             }
             }
-        }
 
 
-        private MetadataOptions GetMetadataOptions(Type type, ServerConfiguration config)
-        {
-            var options = config.MetadataOptions
-                .FirstOrDefault(i => string.Equals(i.ItemType, type.Name, StringComparison.OrdinalIgnoreCase));
+            if (!config.EnableSimpleArtistDetection)
+            {
+                config.EnableSimpleArtistDetection = true;
+                changed = true;
+            }
 
 
-            if (options == null)
+            if (!config.EnableNormalizedItemByNameIds)
             {
             {
-                var list = config.MetadataOptions.ToList();
+                config.EnableNormalizedItemByNameIds = true;
+                changed = true;
+            }
 
 
-                options = new MetadataOptions
-                {
-                    ItemType = type.Name
-                };
+            if (!config.DisableLiveTvChannelUserDataName)
+            {
+                config.DisableLiveTvChannelUserDataName = true;
+                changed = true;
+            }
 
 
-                list.Add(options);
+            if (!config.EnableNewOmdbSupport)
+            {
+                config.EnableNewOmdbSupport = true;
+                changed = true;
+            }
 
 
-                config.MetadataOptions = list.ToArray(list.Count);
+            if (!config.EnableLocalizedGuids)
+            {
+                config.EnableLocalizedGuids = true;
+                changed = true;
             }
             }
 
 
-            return options;
+            return changed;
         }
         }
     }
     }
 }
 }

+ 2 - 1
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -5298,7 +5298,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
                 OfficialRatings = query.OfficialRatings,
                 OfficialRatings = query.OfficialRatings,
                 GenreIds = query.GenreIds,
                 GenreIds = query.GenreIds,
                 Genres = query.Genres,
                 Genres = query.Genres,
-                Years = query.Years
+                Years = query.Years,
+                NameContains = query.NameContains
             };
             };
 
 
             var outerWhereClauses = GetWhereClauses(outerQuery, null);
             var outerWhereClauses = GetWhereClauses(outerQuery, null);

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

@@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Library
                 throw new ArgumentNullException("type");
                 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
                 // Try to normalize paths located underneath program-data in an attempt to make them more portable
                 key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)
                 key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)

+ 13 - 0
Emby.Server.Implementations/Localization/LocalizationManager.cs

@@ -308,6 +308,19 @@ namespace Emby.Server.Implementations.Localization
             return value == null ? (int?)null : value.Value;
             return value == null ? (int?)null : value.Value;
         }
         }
 
 
+        public bool HasUnicodeCategory(string value, UnicodeCategory category)
+        {
+            foreach (var chr in value)
+            {
+                if (char.GetUnicodeCategory(chr) == category)
+                {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
         public string GetLocalizedString(string phrase)
         public string GetLocalizedString(string phrase)
         {
         {
             return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture);
             return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture);

+ 0 - 2
MediaBrowser.Api/ConfigurationService.cs

@@ -134,8 +134,6 @@ namespace MediaBrowser.Api
 
 
         public void Post(AutoSetMetadataOptions request)
         public void Post(AutoSetMetadataOptions request)
         {
         {
-            _configurationManager.DisableMetadataService("Emby Xml");
-            _configurationManager.SaveConfiguration();
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 1 - 11
MediaBrowser.Api/StartupWizardService.cs

@@ -63,7 +63,7 @@ namespace MediaBrowser.Api
         public void Post(ReportStartupWizardComplete request)
         public void Post(ReportStartupWizardComplete request)
         {
         {
             _config.Configuration.IsStartupWizardCompleted = true;
             _config.Configuration.IsStartupWizardCompleted = true;
-            SetWizardFinishValues(_config.Configuration);
+            _config.SetOptimalValues();
             _config.SaveConfiguration();
             _config.SaveConfiguration();
         }
         }
 
 
@@ -87,16 +87,6 @@ namespace MediaBrowser.Api
             return result;
             return result;
         }
         }
 
 
-        private void SetWizardFinishValues(ServerConfiguration config)
-        {
-            config.EnableCaseSensitiveItemIds = true;
-            config.SkipDeserializationForBasicTypes = true;
-            config.EnableSimpleArtistDetection = true;
-            config.EnableNormalizedItemByNameIds = true;
-            config.DisableLiveTvChannelUserDataName = true;
-            config.EnableNewOmdbSupport = true;
-        }
-
         public void Post(UpdateStartupConfiguration request)
         public void Post(UpdateStartupConfiguration request)
         {
         {
             _config.Configuration.UICulture = request.UICulture;
             _config.Configuration.UICulture = request.UICulture;

+ 1 - 5
MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs

@@ -20,10 +20,6 @@ namespace MediaBrowser.Controller.Configuration
         /// <value>The configuration.</value>
         /// <value>The configuration.</value>
         ServerConfiguration Configuration { get; }
         ServerConfiguration Configuration { get; }
 
 
-        /// <summary>
-        /// Sets the preferred metadata service.
-        /// </summary>
-        /// <param name="service">The service.</param>
-        void DisableMetadataService(string service);
+        bool SetOptimalValues();
     }
     }
 }
 }

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

@@ -189,6 +189,8 @@ namespace MediaBrowser.Model.Configuration
         public PathSubstitution[] PathSubstitutions { get; set; }
         public PathSubstitution[] PathSubstitutions { get; set; }
         public bool EnableSimpleArtistDetection { get; set; }
         public bool EnableSimpleArtistDetection { get; set; }
 
 
+        public bool EnableLocalizedGuids { get; set; }
+
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// </summary>
         /// </summary>
@@ -200,6 +202,7 @@ namespace MediaBrowser.Model.Configuration
             PathSubstitutions = new PathSubstitution[] { };
             PathSubstitutions = new PathSubstitution[] { };
             EnableSimpleArtistDetection = true;
             EnableSimpleArtistDetection = true;
 
 
+            EnableLocalizedGuids = true;
             DisplaySpecialsWithinSeasons = true;
             DisplaySpecialsWithinSeasons = true;
             EnableExternalContentInSuggestions = true;
             EnableExternalContentInSuggestions = true;
 
 

+ 0 - 9
MediaBrowser.Model/Dlna/PlaybackException.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Dlna
-{
-    public class PlaybackException : Exception
-    {
-        public PlaybackErrorCode ErrorCode { get; set;}
-    }
-}

+ 3 - 0
MediaBrowser.Model/Globalization/ILocalizationManager.cs

@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
+using System.Globalization;
 
 
 namespace MediaBrowser.Model.Globalization
 namespace MediaBrowser.Model.Globalization
 {
 {
@@ -54,5 +55,7 @@ namespace MediaBrowser.Model.Globalization
         string RemoveDiacritics(string text);
         string RemoveDiacritics(string text);
 
 
         string NormalizeFormKD(string text);
         string NormalizeFormKD(string text);
+
+        bool HasUnicodeCategory(string value, UnicodeCategory category);
     }
     }
 }
 }

+ 0 - 1
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -98,7 +98,6 @@
     <Compile Include="Dlna\ResponseProfile.cs" />
     <Compile Include="Dlna\ResponseProfile.cs" />
     <Compile Include="Dlna\StreamInfoSorter.cs" />
     <Compile Include="Dlna\StreamInfoSorter.cs" />
     <Compile Include="Dlna\PlaybackErrorCode.cs" />
     <Compile Include="Dlna\PlaybackErrorCode.cs" />
-    <Compile Include="Dlna\PlaybackException.cs" />
     <Compile Include="Dlna\ResolutionConfiguration.cs" />
     <Compile Include="Dlna\ResolutionConfiguration.cs" />
     <Compile Include="Dlna\ResolutionNormalizer.cs" />
     <Compile Include="Dlna\ResolutionNormalizer.cs" />
     <Compile Include="Dlna\ResolutionOptions.cs" />
     <Compile Include="Dlna\ResolutionOptions.cs" />

+ 5 - 1
MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs

@@ -163,7 +163,11 @@ namespace MediaBrowser.Providers.MediaInfo
 
 
         private void FetchShortcutInfo(Video video)
         private void FetchShortcutInfo(Video video)
         {
         {
-			video.ShortcutPath = _fileSystem.ReadAllText(video.Path);
+			video.ShortcutPath = _fileSystem.ReadAllText(video.Path)
+                .Replace("\t", string.Empty)
+                .Replace("\r", string.Empty)
+                .Replace("\n", string.Empty)
+                .Trim();
         }
         }
 
 
         public Task<ItemUpdateType> FetchAudioInfo<T>(T item, CancellationToken cancellationToken)
         public Task<ItemUpdateType> FetchAudioInfo<T>(T item, CancellationToken cancellationToken)