The Free Software Media System - Server Backend & API
normalize strm file contents
Luke Pulverenti0a0303ca64e3
diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.csindex 4d9bf0624d..607e896b86 100644--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs+++ b/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;}}}diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 01416a3079..eb0f5150f9 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -5298,7 +5298,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.TypeOfficialRatings = query.OfficialRatings,GenreIds = query.GenreIds,Genres = query.Genres,- Years = query.Years+ Years = query.Years,+ NameContains = query.NameContains};var outerWhereClauses = GetWhereClauses(outerQuery, null);diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex bd8a095503..cac1cb3b4b 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Librarythrow 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 portablekey = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.csindex 650f388a1b..2eb4743cd0 100644--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs@@ -308,6 +308,19 @@ namespace Emby.Server.Implementations.Localizationreturn 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){return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture);diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.csindex 643ecd9c86..0023c13d78 100644--- a/MediaBrowser.Api/ConfigurationService.cs+++ b/MediaBrowser.Api/ConfigurationService.cs@@ -134,8 +134,6 @@ namespace MediaBrowser.Apipublic void Post(AutoSetMetadataOptions request){- _configurationManager.DisableMetadataService("Emby Xml");- _configurationManager.SaveConfiguration();}/// <summary>diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.csindex 1ccb683204..1b185b073b 100644--- a/MediaBrowser.Api/StartupWizardService.cs+++ b/MediaBrowser.Api/StartupWizardService.cs@@ -63,7 +63,7 @@ namespace MediaBrowser.Apipublic void Post(ReportStartupWizardComplete request){_config.Configuration.IsStartupWizardCompleted = true;- SetWizardFinishValues(_config.Configuration);+ _config.SetOptimalValues();_config.SaveConfiguration();}@@ -87,16 +87,6 @@ namespace MediaBrowser.Apireturn 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){_config.Configuration.UICulture = request.UICulture;diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.csindex 13c9f8d84b..af57149322 100644--- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs+++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs@@ -20,10 +20,6 @@ namespace MediaBrowser.Controller.Configuration/// <value>The configuration.</value>ServerConfiguration Configuration { get; }- /// <summary>- /// Sets the preferred metadata service.- /// </summary>- /// <param name="service">The service.</param>- void DisableMetadataService(string service);+ bool SetOptimalValues();}}diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex f2c3b7cc8a..9b800bbc93 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -189,6 +189,8 @@ namespace MediaBrowser.Model.Configurationpublic PathSubstitution[] PathSubstitutions { get; set; }public bool EnableSimpleArtistDetection { get; set; }+ public bool EnableLocalizedGuids { get; set; }+/// <summary>/// Initializes a new instance of the <see cref="ServerConfiguration" /> class./// </summary>@@ -200,6 +202,7 @@ namespace MediaBrowser.Model.ConfigurationPathSubstitutions = new PathSubstitution[] { };EnableSimpleArtistDetection = true;+ EnableLocalizedGuids = true;DisplaySpecialsWithinSeasons = true;EnableExternalContentInSuggestions = true;diff --git a/MediaBrowser.Model/Dlna/PlaybackException.cs b/MediaBrowser.Model/Dlna/PlaybackException.csdeleted file mode 100644index 761fa1c904..0000000000--- a/MediaBrowser.Model/Dlna/PlaybackException.cs+++ /dev/null@@ -1,9 +0,0 @@-using System;--namespace MediaBrowser.Model.Dlna-{- public class PlaybackException : Exception- {- public PlaybackErrorCode ErrorCode { get; set;}- }-}diff --git a/MediaBrowser.Model/Globalization/ILocalizationManager.cs b/MediaBrowser.Model/Globalization/ILocalizationManager.csindex 2356a2fa19..61f0ebfd31 100644--- a/MediaBrowser.Model/Globalization/ILocalizationManager.cs+++ b/MediaBrowser.Model/Globalization/ILocalizationManager.cs@@ -1,5 +1,6 @@using System.Collections.Generic;using MediaBrowser.Model.Entities;+using System.Globalization;namespace MediaBrowser.Model.Globalization{@@ -54,5 +55,7 @@ namespace MediaBrowser.Model.Globalizationstring RemoveDiacritics(string text);string NormalizeFormKD(string text);++ bool HasUnicodeCategory(string value, UnicodeCategory category);}}diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csprojindex b36a773eb4..dd9b7ff75b 100644--- a/MediaBrowser.Model/MediaBrowser.Model.csproj+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj@@ -98,7 +98,6 @@<Compile Include="Dlna\ResponseProfile.cs" /><Compile Include="Dlna\StreamInfoSorter.cs" /><Compile Include="Dlna\PlaybackErrorCode.cs" />- <Compile Include="Dlna\PlaybackException.cs" /><Compile Include="Dlna\ResolutionConfiguration.cs" /><Compile Include="Dlna\ResolutionNormalizer.cs" /><Compile Include="Dlna\ResolutionOptions.cs" />diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.csindex bce4219019..e79aec33c1 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs@@ -163,7 +163,11 @@ namespace MediaBrowser.Providers.MediaInfoprivate 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)