From 8ec8b463942d132a71fd319535c63d7205075e54 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 00:51:43 -0400 Subject: allow separate configuration of date format --- MediaBrowser.Controller/IServerApplicationPaths.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index c89a60a6f..4ad1cf49a 100644 --- a/MediaBrowser.Controller/IServerApplicationPaths.cs +++ b/MediaBrowser.Controller/IServerApplicationPaths.cs @@ -108,5 +108,7 @@ namespace MediaBrowser.Controller string InternalMetadataPath { get; } string ArtistsPath { get; } + + string GetTranscodingTempPath(); } } \ No newline at end of file -- cgit v1.2.3 From fc9de2589c7cb1e75323db8016fe04f4c8dd0f09 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 00:52:30 -0400 Subject: reset image dimensions on changes --- MediaBrowser.Controller/Entities/BaseItem.cs | 19 +++++++++++++++++-- MediaBrowser.Providers/Manager/ItemImageProvider.cs | 13 ++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 89d48ff90..5b4cd5900 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1987,6 +1987,10 @@ namespace MediaBrowser.Controller.Entities image.Path = file.FullName; image.DateModified = imageInfo.DateModified; + + // reset these values + image.Width = 0; + image.Height = 0; } } @@ -2137,6 +2141,7 @@ namespace MediaBrowser.Controller.Entities var newImageList = new List(); var imageAdded = false; + var imageUpdated = false; foreach (var newImage in images) { @@ -2157,7 +2162,17 @@ namespace MediaBrowser.Controller.Entities { if (existing.IsLocalFile) { - existing.DateModified = FileSystem.GetLastWriteTimeUtc(newImage); + var newDateModified = FileSystem.GetLastWriteTimeUtc(newImage); + + // If date changed then we need to reset saved image dimensions + if (existing.DateModified != newDateModified && (existing.Width > 0 || existing.Height > 0)) + { + existing.Width = 0; + existing.Height = 0; + imageUpdated = true; + } + + existing.DateModified = newDateModified; } } } @@ -2190,7 +2205,7 @@ namespace MediaBrowser.Controller.Entities ImageInfos = newList; } - return newImageList.Count > 0; + return imageUpdated || newImageList.Count > 0; } private ItemImageInfo GetImageInfo(FileSystemMetadata file, ImageType type) diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index 4419b48cb..1d432463b 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -412,7 +412,18 @@ namespace MediaBrowser.Providers.Manager } else { - currentImage.DateModified = _fileSystem.GetLastWriteTimeUtc(image.FileInfo); + + var newDateModified = _fileSystem.GetLastWriteTimeUtc(image.FileInfo); + + // If date changed then we need to reset saved image dimensions + if (currentImage.DateModified != newDateModified && (currentImage.Width > 0 || currentImage.Height > 0)) + { + currentImage.Width = 0; + currentImage.Height = 0; + changed = true; + } + + currentImage.DateModified = newDateModified; } } else -- cgit v1.2.3 From 0a0303ca64e346f0e939f1fe275334f752728c15 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:50:16 -0400 Subject: normalize strm file contents --- .../Configuration/ServerConfigurationManager.cs | 67 +++++++++++----------- .../Data/SqliteItemRepository.cs | 3 +- .../Library/LibraryManager.cs | 2 +- .../Localization/LocalizationManager.cs | 13 +++++ MediaBrowser.Api/ConfigurationService.cs | 2 - MediaBrowser.Api/StartupWizardService.cs | 12 +--- .../Configuration/IServerConfigurationManager.cs | 6 +- .../Configuration/ServerConfiguration.cs | 3 + MediaBrowser.Model/Dlna/PlaybackException.cs | 9 --- .../Globalization/ILocalizationManager.cs | 3 + MediaBrowser.Model/MediaBrowser.Model.csproj | 1 - .../MediaInfo/FFProbeProvider.cs | 6 +- 12 files changed, 64 insertions(+), 63 deletions(-) delete mode 100644 MediaBrowser.Model/Dlna/PlaybackException.cs (limited to 'MediaBrowser.Controller') diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs index 4d9bf0624..607e896b8 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.cs index 01416a307..eb0f5150f 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.Type OfficialRatings = 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.cs index bd8a09550..cac1cb3b4 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -506,7 +506,7 @@ namespace Emby.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) diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 650f388a1..2eb4743cd 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -308,6 +308,19 @@ namespace Emby.Server.Implementations.Localization 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) { return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture); diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.cs index 643ecd9c8..0023c13d7 100644 --- a/MediaBrowser.Api/ConfigurationService.cs +++ b/MediaBrowser.Api/ConfigurationService.cs @@ -134,8 +134,6 @@ namespace MediaBrowser.Api public void Post(AutoSetMetadataOptions request) { - _configurationManager.DisableMetadataService("Emby Xml"); - _configurationManager.SaveConfiguration(); } /// diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 1ccb68320..1b185b073 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -63,7 +63,7 @@ namespace MediaBrowser.Api public void Post(ReportStartupWizardComplete request) { _config.Configuration.IsStartupWizardCompleted = true; - SetWizardFinishValues(_config.Configuration); + _config.SetOptimalValues(); _config.SaveConfiguration(); } @@ -87,16 +87,6 @@ namespace MediaBrowser.Api 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) { _config.Configuration.UICulture = request.UICulture; diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs index 13c9f8d84..af5714932 100644 --- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -20,10 +20,6 @@ namespace MediaBrowser.Controller.Configuration /// The configuration. ServerConfiguration Configuration { get; } - /// - /// Sets the preferred metadata service. - /// - /// The service. - void DisableMetadataService(string service); + bool SetOptimalValues(); } } diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index f2c3b7cc8..9b800bbc9 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -189,6 +189,8 @@ namespace MediaBrowser.Model.Configuration public PathSubstitution[] PathSubstitutions { get; set; } public bool EnableSimpleArtistDetection { get; set; } + public bool EnableLocalizedGuids { get; set; } + /// /// Initializes a new instance of the class. /// @@ -200,6 +202,7 @@ namespace MediaBrowser.Model.Configuration PathSubstitutions = new PathSubstitution[] { }; EnableSimpleArtistDetection = true; + EnableLocalizedGuids = true; DisplaySpecialsWithinSeasons = true; EnableExternalContentInSuggestions = true; diff --git a/MediaBrowser.Model/Dlna/PlaybackException.cs b/MediaBrowser.Model/Dlna/PlaybackException.cs deleted file mode 100644 index 761fa1c90..000000000 --- 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.cs index 2356a2fa1..61f0ebfd3 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.Globalization string 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.csproj index b36a773eb..dd9b7ff75 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -98,7 +98,6 @@ - diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index bce421901..e79aec33c 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -163,7 +163,11 @@ namespace MediaBrowser.Providers.MediaInfo 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 FetchAudioInfo(T item, CancellationToken cancellationToken) -- cgit v1.2.3