From 8ec8b463942d132a71fd319535c63d7205075e54 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 00:51:43 -0400 Subject: [PATCH 01/12] allow separate configuration of date format --- .../Localization/Core/en-US.json | 7 +-- .../Localization/Core/hu.json | 44 +++++++++---------- .../Networking/NetworkManager.cs | 2 +- .../ServerApplicationPaths.cs | 17 +++++++ .../IServerApplicationPaths.cs | 2 + MediaBrowser.Model/Dlna/StreamBuilder.cs | 9 ---- .../ServerNotifyIcon.cs | 12 ++--- SharedVersion.cs | 2 +- 8 files changed, 50 insertions(+), 45 deletions(-) diff --git a/Emby.Server.Implementations/Localization/Core/en-US.json b/Emby.Server.Implementations/Localization/Core/en-US.json index 51bbf341fe..9c58b45396 100644 --- a/Emby.Server.Implementations/Localization/Core/en-US.json +++ b/Emby.Server.Implementations/Localization/Core/en-US.json @@ -87,10 +87,5 @@ "User": "User", "System": "System", "Application": "Application", - "Plugin": "Plugin", - "LabelExit": "Exit", - "LabelVisitCommunity": "Visit Community", - "LabelBrowseLibrary": "Browse Library", - "LabelConfigureServer": "Configure Emby", - "LabelRestartServer": "Restart Server" + "Plugin": "Plugin" } \ No newline at end of file diff --git a/Emby.Server.Implementations/Localization/Core/hu.json b/Emby.Server.Implementations/Localization/Core/hu.json index 80160966ff..39d0f80613 100644 --- a/Emby.Server.Implementations/Localization/Core/hu.json +++ b/Emby.Server.Implementations/Localization/Core/hu.json @@ -2,31 +2,31 @@ "Latest": "Leg\u00fajabb", "ValueSpecialEpisodeName": "Special - {0}", "Inherit": "Inherit", - "Books": "Books", - "Music": "Music", - "Games": "Games", - "Photos": "Photos", - "MixedContent": "Mixed content", - "MusicVideos": "Music videos", - "HomeVideos": "Home videos", - "Playlists": "Playlists", + "Books": "K\u00f6nyvek", + "Music": "Zene", + "Games": "J\u00e1t\u00e9kok", + "Photos": "F\u00e9nyk\u00e9pek", + "MixedContent": "Vegyes tartalom", + "MusicVideos": "Zenei Vide\u00f3k", + "HomeVideos": "H\u00e1zi vide\u00f3k", + "Playlists": "Lej\u00e1tsz\u00e1si list\u00e1k", "HeaderRecordingGroups": "Recording Groups", "HeaderContinueWatching": "Vet\u00edt\u00e9s(ek) folytat\u00e1sa", - "HeaderFavoriteArtists": "Favorite Artists", - "HeaderFavoriteSongs": "Favorite Songs", - "HeaderAlbumArtists": "Album Artists", - "HeaderFavoriteAlbums": "Favorite Albums", + "HeaderFavoriteArtists": "Kedvenc M\u0171v\u00e9szek", + "HeaderFavoriteSongs": "Kedvenc Dalok", + "HeaderAlbumArtists": "Album El\u0151ad\u00f3k", + "HeaderFavoriteAlbums": "Kedvenc Albumok", "HeaderFavoriteEpisodes": "Kedvenc Epiz\u00f3dok", "HeaderFavoriteShows": "Kedvenc M\u0171sorok", "HeaderNextUp": "K\u00f6vetkezik", - "Favorites": "Favorites", + "Favorites": "Kedvencek", "Collections": "Gy\u0171jtem\u00e9nyek", "Channels": "Csatorn\u00e1k", - "Movies": "Movies", - "Albums": "Albums", - "Artists": "Artists", - "Folders": "Folders", - "Songs": "Songs", + "Movies": "Filmek", + "Albums": "Albumok", + "Artists": "El\u0151ad\u00f3k", + "Folders": "K\u00f6nyvt\u00e1rak", + "Songs": "Dalok", "TvShows": "TV Shows", "Shows": "Shows", "Genres": "M\u0171fajok", @@ -38,15 +38,15 @@ "ScheduledTaskFailedWithName": "{0} failed", "LabelRunningTimeValue": "Running time: {0}", "ScheduledTaskStartedWithName": "{0} started", - "VersionNumber": "Version {0}", + "VersionNumber": "Verzi\u00f3 {0}", "PluginInstalledWithName": "{0} telep\u00edtve", "StartupEmbyServerIsLoading": "Emby Szerver bet\u00f6lt\u0151dik. K\u00e9rj\u00fck, pr\u00f3b\u00e1ld meg \u00fajra k\u00e9s\u0151bb.", - "PluginUpdatedWithName": "{0} was updated", + "PluginUpdatedWithName": "{0} friss\u00edtve", "PluginUninstalledWithName": "{0} elt\u00e1vol\u00edtva", "ItemAddedWithName": "{0} was added to the library", "ItemRemovedWithName": "{0} was removed from the library", - "LabelIpAddressValue": "Ip address: {0}", - "DeviceOnlineWithName": "{0} is connected", + "LabelIpAddressValue": "Ip c\u00edm: {0}", + "DeviceOnlineWithName": "{0} bel\u00e9pett", "UserOnlineFromDevice": "{0} is online from {1}", "ProviderValue": "Provider: {0}", "SubtitlesDownloadedForItem": "Subtitles downloaded for {0}", diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index 72d0154aa5..f8f7da78ae 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.Networking endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) || endpoint.StartsWith("192.168", StringComparison.OrdinalIgnoreCase) || endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase) || - endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || + //endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || IsInPrivateAddressSpaceAndLocalSubnet(endpoint); } diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs index 675b0d78cd..3e3f7e0d77 100644 --- a/Emby.Server.Implementations/ServerApplicationPaths.cs +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -206,6 +206,23 @@ namespace Emby.Server.Implementations } } + public string GetTranscodingTempPath() + { + var path = TranscodingTempPath; + + try + { + Directory.CreateDirectory(path); + return path; + } + catch + { + path = Path.Combine(ProgramDataPath, "transcoding-temp"); + Directory.CreateDirectory(path); + return path; + } + } + /// /// Gets the game genre path. /// diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index c89a60a6f8..4ad1cf49a0 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 diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 20de247a6a..cf4cd99258 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -965,15 +965,6 @@ namespace MediaBrowser.Model.Dlna return new Tuple>(PlayMethod.DirectStream, new List()); } - if (videoStream == null) - { - _logger.Info("Profile: {0}, Cannot direct stream with no known video stream. Path: {1}", - profile.Name ?? "Unknown Profile", - mediaSource.Path ?? "Unknown path"); - - return new Tuple>(null, new List { TranscodeReason.UnknownVideoStreamInfo }); - } - // See if it can be direct played DirectPlayProfile directPlay = null; foreach (DirectPlayProfile i in profile.DirectPlayProfiles) diff --git a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs index cc8656f23d..a8c36e4e85 100644 --- a/MediaBrowser.ServerApplication/ServerNotifyIcon.cs +++ b/MediaBrowser.ServerApplication/ServerNotifyIcon.cs @@ -144,12 +144,12 @@ namespace MediaBrowser.ServerApplication { _uiCulture = _configurationManager.Configuration.UICulture; - cmdExit.Text = _localization.GetLocalizedString("LabelExit"); - cmdCommunity.Text = _localization.GetLocalizedString("LabelVisitCommunity"); - cmdPremiere.Text = _localization.GetLocalizedString("Emby Premiere"); - cmdBrowse.Text = _localization.GetLocalizedString("LabelBrowseLibrary"); - cmdConfigure.Text = _localization.GetLocalizedString("LabelConfigureServer"); - cmdRestart.Text = _localization.GetLocalizedString("LabelRestartServer"); + cmdExit.Text = "Exit"; + cmdCommunity.Text = "Visit Emby Community"; + cmdPremiere.Text = "Emby Premiere"; + cmdBrowse.Text = "Browse Library"; + cmdConfigure.Text = "Configure Emby Server"; + cmdRestart.Text = "Restart Emby Server"; } private string _uiCulture; diff --git a/SharedVersion.cs b/SharedVersion.cs index 1a5c5dde26..3015cea1f2 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.34.2")] +[assembly: AssemblyVersion("3.2.35.1")] From fc9de2589c7cb1e75323db8016fe04f4c8dd0f09 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 00:52:30 -0400 Subject: [PATCH 02/12] reset image dimensions on changes --- MediaBrowser.Controller/Entities/BaseItem.cs | 19 +++++++++++++++++-- .../Manager/ItemImageProvider.cs | 13 ++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 89d48ff90f..5b4cd59001 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 4419b48cbb..1d432463bd 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 From 74136371b5d2f76fd34feadbdfc34d4760cccbda Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 00:53:10 -0400 Subject: [PATCH 03/12] use default transcode temp path when configure one is unreachable --- Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs index 12695cd8e7..8620987355 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs @@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts EnableStreamSharing = true; SharedStreamIds = new List(); UniqueId = Guid.NewGuid().ToString("N"); - TempFilePath = Path.Combine(appPaths.TranscodingTempPath, UniqueId + ".ts"); + TempFilePath = Path.Combine(appPaths.GetTranscodingTempPath(), UniqueId + ".ts"); } public virtual Task Open(CancellationToken openCancellationToken) From 1358ea2ca4b4b87640eb0c08bc3f6f1abba0238a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 00:55:11 -0400 Subject: [PATCH 04/12] update SimpleInjector --- .../Emby.Server.Implementations.csproj | 4 ++-- Emby.Server.Implementations/packages.config | 2 +- MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj | 4 ++-- MediaBrowser.Server.Mono/packages.config | 2 +- .../MediaBrowser.ServerApplication.csproj | 4 ++-- MediaBrowser.ServerApplication/packages.config | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 1ecbabf2f4..8ff1b63c03 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -651,8 +651,8 @@ ..\packages\SharpCompress.0.18.2\lib\net45\SharpCompress.dll - - ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll + + ..\packages\SimpleInjector.4.0.12\lib\net45\SimpleInjector.dll ..\packages\SQLitePCL.pretty.1.1.0\lib\portable-net45+netcore45+wpa81+wp8\SQLitePCL.pretty.dll diff --git a/Emby.Server.Implementations/packages.config b/Emby.Server.Implementations/packages.config index d27722fef8..6e68810d8f 100644 --- a/Emby.Server.Implementations/packages.config +++ b/Emby.Server.Implementations/packages.config @@ -3,7 +3,7 @@ - + \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index 365977530e..dfd0714471 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -58,8 +58,8 @@ ..\packages\SharpCompress.0.18.2\lib\net45\SharpCompress.dll - - ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll + + ..\packages\SimpleInjector.4.0.12\lib\net45\SimpleInjector.dll ..\packages\SkiaSharp.1.58.1\lib\net45\SkiaSharp.dll diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config index dfa3dc75d3..e7aec97b6c 100644 --- a/MediaBrowser.Server.Mono/packages.config +++ b/MediaBrowser.Server.Mono/packages.config @@ -3,7 +3,7 @@ - + diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 9e4f524898..f479db46fb 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -80,8 +80,8 @@ ..\packages\SharpCompress.0.18.2\lib\net45\SharpCompress.dll - - ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll + + ..\packages\SimpleInjector.4.0.12\lib\net45\SimpleInjector.dll ..\packages\SkiaSharp.1.58.1\lib\net45\SkiaSharp.dll diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index c7b98700e8..e40a3ab15c 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -2,7 +2,7 @@ - + From ccda4bd62928466badcd0787eaedc79dc318a80b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 30 Oct 2017 01:26:19 -0400 Subject: [PATCH 05/12] update to skia 1.59.2 --- Emby.Drawing.Skia/Emby.Drawing.Skia.csproj | 4 ++-- Emby.Drawing.Skia/packages.config | 2 +- MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj | 4 ++-- MediaBrowser.Server.Mono/packages.config | 2 +- .../MediaBrowser.ServerApplication.csproj | 8 ++++---- MediaBrowser.ServerApplication/packages.config | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj index f2b32d52cb..6024c3d2c0 100644 --- a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj +++ b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj @@ -63,8 +63,8 @@ - - ..\packages\SkiaSharp.1.58.1\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.dll + + ..\packages\SkiaSharp.1.59.2\lib\portable-net45+win8+wpa81+wp8\SkiaSharp.dll diff --git a/Emby.Drawing.Skia/packages.config b/Emby.Drawing.Skia/packages.config index 2b9b0aee43..1aa3653cd7 100644 --- a/Emby.Drawing.Skia/packages.config +++ b/Emby.Drawing.Skia/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index dfd0714471..a9e5d3ca57 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -61,8 +61,8 @@ ..\packages\SimpleInjector.4.0.12\lib\net45\SimpleInjector.dll - - ..\packages\SkiaSharp.1.58.1\lib\net45\SkiaSharp.dll + + ..\packages\SkiaSharp.1.59.2\lib\net45\SkiaSharp.dll ..\packages\SQLitePCLRaw.core.1.1.8\lib\net45\SQLitePCLRaw.core.dll diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config index e7aec97b6c..4f2324c21b 100644 --- a/MediaBrowser.Server.Mono/packages.config +++ b/MediaBrowser.Server.Mono/packages.config @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index f479db46fb..33f858b004 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -83,8 +83,8 @@ ..\packages\SimpleInjector.4.0.12\lib\net45\SimpleInjector.dll - - ..\packages\SkiaSharp.1.58.1\lib\net45\SkiaSharp.dll + + ..\packages\SkiaSharp.1.59.2\lib\net45\SkiaSharp.dll ..\packages\SQLitePCLRaw.core.1.1.8\lib\net45\SQLitePCLRaw.core.dll @@ -161,11 +161,11 @@ - + x64\libSkiaSharp.dll PreserveNewest - + x86\libSkiaSharp.dll PreserveNewest diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index e40a3ab15c..805c7af62e 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -3,7 +3,7 @@ - + \ No newline at end of file From 5fa007d04eff4a280a3f549de869339cccdb0d52 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:45:10 -0400 Subject: [PATCH 06/12] add error handling to work around skia crashes --- Emby.Drawing.Skia/SkiaEncoder.cs | 64 ++++++++++++++++--- Emby.Drawing.Skia/StripCollageBuilder.cs | 4 +- .../ImageEncoderHelper.cs | 6 +- MediaBrowser.Server.Mono/Program.cs | 2 +- .../ImageEncoderHelper.cs | 6 +- MediaBrowser.ServerApplication/MainStartup.cs | 17 ++++- 6 files changed, 80 insertions(+), 19 deletions(-) diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index 7469d167e1..a89e1f2db8 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -10,22 +10,27 @@ using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; +using MediaBrowser.Controller.Extensions; +using System.Globalization; +using MediaBrowser.Model.Globalization; namespace Emby.Drawing.Skia { public class SkiaEncoder : IImageEncoder { private readonly ILogger _logger; - private readonly IApplicationPaths _appPaths; + private static IApplicationPaths _appPaths; private readonly Func _httpClientFactory; private readonly IFileSystem _fileSystem; + private static ILocalizationManager _localizationManager; - public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, Func httpClientFactory, IFileSystem fileSystem) + public SkiaEncoder(ILogger logger, IApplicationPaths appPaths, Func httpClientFactory, IFileSystem fileSystem, ILocalizationManager localizationManager) { _logger = logger; _appPaths = appPaths; _httpClientFactory = httpClientFactory; _fileSystem = fileSystem; + _localizationManager = localizationManager; LogVersion(); } @@ -190,14 +195,53 @@ namespace Emby.Drawing.Skia } } - private static string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" }; - internal static SKBitmap Decode(string path, bool forceCleanBitmap, out SKCodecOrigin origin) + private static bool HasDiacritics(string text) { + return !String.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal); + } + + private static bool RequiresSpecialCharacterHack(string path) + { + if (_localizationManager.HasUnicodeCategory(path, UnicodeCategory.OtherLetter)) + { + return true; + } + + if (HasDiacritics(path)) + { + return true; + } + + return false; + } + + private static string NormalizePath(string path, IFileSystem fileSystem) + { + if (!RequiresSpecialCharacterHack(path)) + { + return path; + } + + var tempPath = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + Path.GetExtension(path) ?? string.Empty); + + fileSystem.CopyFile(path, tempPath, true); + + return tempPath; + } + + private static string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" }; + internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem fileSystem, out SKCodecOrigin origin) + { + if (!fileSystem.FileExists(path)) + { + throw new FileNotFoundException("File not found", path); + } + var requiresTransparencyHack = TransparentImageTypes.Contains(Path.GetExtension(path) ?? string.Empty); if (requiresTransparencyHack || forceCleanBitmap) { - using (var stream = new SKFileStream(path)) + using (var stream = new SKFileStream(NormalizePath(path, fileSystem))) { using (var codec = SKCodec.Create(stream)) { @@ -227,11 +271,11 @@ namespace Emby.Drawing.Skia } } - var resultBitmap = SKBitmap.Decode(path); + var resultBitmap = SKBitmap.Decode(NormalizePath(path, fileSystem)); if (resultBitmap == null) { - return Decode(path, true, out origin); + return Decode(path, true, fileSystem, out origin); } // If we have to resize these they often end up distorted @@ -239,7 +283,7 @@ namespace Emby.Drawing.Skia { using (resultBitmap) { - return Decode(path, true, out origin); + return Decode(path, true, fileSystem, out origin); } } @@ -251,13 +295,13 @@ namespace Emby.Drawing.Skia { if (cropWhitespace) { - using (var bitmap = Decode(path, forceAnalyzeBitmap, out origin)) + using (var bitmap = Decode(path, forceAnalyzeBitmap, _fileSystem, out origin)) { return CropWhiteSpace(bitmap); } } - return Decode(path, forceAnalyzeBitmap, out origin); + return Decode(path, forceAnalyzeBitmap, _fileSystem, out origin); } private SKBitmap GetBitmap(string path, bool cropWhitespace, bool autoOrient) diff --git a/Emby.Drawing.Skia/StripCollageBuilder.cs b/Emby.Drawing.Skia/StripCollageBuilder.cs index 624245ee79..d562bb4be3 100644 --- a/Emby.Drawing.Skia/StripCollageBuilder.cs +++ b/Emby.Drawing.Skia/StripCollageBuilder.cs @@ -83,7 +83,7 @@ namespace Emby.Drawing.Skia for (int i = 0; i < 4; i++) { SKCodecOrigin origin; - using (var currentBitmap = SkiaEncoder.Decode(paths[imageIndex], false, out origin)) + using (var currentBitmap = SkiaEncoder.Decode(paths[imageIndex], false, _fileSystem, out origin)) { // resize to the same aspect as the original int iWidth = (int)Math.Abs(iHeight * currentBitmap.Width / currentBitmap.Height); @@ -165,7 +165,7 @@ namespace Emby.Drawing.Skia for (var y = 0; y < 2; y++) { SKCodecOrigin origin; - using (var currentBitmap = SkiaEncoder.Decode(paths[imageIndex], false, out origin)) + using (var currentBitmap = SkiaEncoder.Decode(paths[imageIndex], false, _fileSystem, out origin)) { using (var resizedBitmap = new SKBitmap(cellWidth, cellHeight, currentBitmap.ColorType, currentBitmap.AlphaType)) { diff --git a/MediaBrowser.Server.Mono/ImageEncoderHelper.cs b/MediaBrowser.Server.Mono/ImageEncoderHelper.cs index 5112c64eda..4f8451c0d1 100644 --- a/MediaBrowser.Server.Mono/ImageEncoderHelper.cs +++ b/MediaBrowser.Server.Mono/ImageEncoderHelper.cs @@ -9,6 +9,7 @@ using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using Emby.Drawing.Skia; using MediaBrowser.Model.System; +using MediaBrowser.Model.Globalization; namespace MediaBrowser.Server.Startup.Common { @@ -20,13 +21,14 @@ namespace MediaBrowser.Server.Startup.Common StartupOptions startupOptions, Func httpClient, IApplicationPaths appPaths, - IEnvironmentInfo environment) + IEnvironmentInfo environment, + ILocalizationManager localizationManager) { if (!startupOptions.ContainsOption("-enablegdi")) { try { - return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem); + return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem, localizationManager); } catch (Exception ex) { diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 3267a77b95..7a3a968ade 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -127,7 +127,7 @@ namespace MediaBrowser.Server.Mono Task.WaitAll(task); - appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo); + appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo, appHost.LocalizationManager); Console.WriteLine("Running startup tasks"); diff --git a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs index c86e85785b..7c95a25ded 100644 --- a/MediaBrowser.ServerApplication/ImageEncoderHelper.cs +++ b/MediaBrowser.ServerApplication/ImageEncoderHelper.cs @@ -7,6 +7,7 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Drawing; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Globalization; namespace MediaBrowser.Server.Startup.Common { @@ -17,11 +18,12 @@ namespace MediaBrowser.Server.Startup.Common IFileSystem fileSystem, StartupOptions startupOptions, Func httpClient, - IApplicationPaths appPaths) + IApplicationPaths appPaths, + ILocalizationManager localizationManager) { try { - return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem); + return new SkiaEncoder(logManager.GetLogger("Skia"), appPaths, httpClient, fileSystem, localizationManager); } catch { diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 70b03aa44b..91a949921e 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -304,6 +304,19 @@ namespace MediaBrowser.ServerApplication } } + private static string UpdatePackageFileName + { + get + { + if (Environment.Is64BitOperatingSystem) + { + return "embyserver-win-x64-{version}.zip"; + } + + return "embyserver-win-x86-{version}.zip"; + } + } + /// /// Runs the application. /// @@ -324,7 +337,7 @@ namespace MediaBrowser.ServerApplication options, fileSystem, new PowerManagement(), - "emby.windows.zip", + UpdatePackageFileName, environmentInfo, new NullImageEncoder(), new SystemEvents(logManager.GetLogger("SystemEvents")), @@ -355,7 +368,7 @@ namespace MediaBrowser.ServerApplication } // set image encoder here - appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths); + appHost.ImageProcessor.ImageEncoder = ImageEncoderHelper.GetImageEncoder(_logger, logManager, fileSystem, options, () => appHost.HttpClient, appPaths, appHost.LocalizationManager); task = task.ContinueWith(new Action(a => appHost.RunStartupTasks()), TaskContinuationOptions.OnlyOnRanToCompletion | TaskContinuationOptions.AttachedToParent); From 0a0303ca64e346f0e939f1fe275334f752728c15 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:50:16 -0400 Subject: [PATCH 07/12] normalize strm file contents --- .../ServerConfigurationManager.cs | 83 ++++++++++--------- .../Data/SqliteItemRepository.cs | 3 +- .../Library/LibraryManager.cs | 2 +- .../Localization/LocalizationManager.cs | 13 +++ MediaBrowser.Api/ConfigurationService.cs | 2 - MediaBrowser.Api/StartupWizardService.cs | 12 +-- .../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, 72 insertions(+), 71 deletions(-) delete mode 100644 MediaBrowser.Model/Dlna/PlaybackException.cs diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs index 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); - - options.DisabledMetadataSavers = list.ToArray(list.Count); - } - } - - private MetadataOptions GetMetadataOptions(Type type, ServerConfiguration config) - { - var options = config.MetadataOptions - .FirstOrDefault(i => string.Equals(i.ItemType, type.Name, StringComparison.OrdinalIgnoreCase)); - - if (options == null) - { - var list = config.MetadataOptions.ToList(); - - options = new MetadataOptions - { - ItemType = type.Name - }; - - list.Add(options); - - config.MetadataOptions = list.ToArray(list.Count); + config.EnableCaseSensitiveItemIds = true; + changed = true; } - return options; + if (!config.SkipDeserializationForBasicTypes) + { + config.SkipDeserializationForBasicTypes = true; + changed = true; + } + + if (!config.EnableSimpleArtistDetection) + { + config.EnableSimpleArtistDetection = true; + changed = true; + } + + if (!config.EnableNormalizedItemByNameIds) + { + config.EnableNormalizedItemByNameIds = true; + changed = true; + } + + if (!config.DisableLiveTvChannelUserDataName) + { + config.DisableLiveTvChannelUserDataName = true; + changed = true; + } + + if (!config.EnableNewOmdbSupport) + { + config.EnableNewOmdbSupport = true; + changed = true; + } + + if (!config.EnableLocalizedGuids) + { + config.EnableLocalizedGuids = true; + changed = true; + } + + return changed; } } } diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 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.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 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.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 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.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 643ecd9c86..0023c13d78 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 1ccb683204..1b185b073b 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 13c9f8d84b..af57149322 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 f2c3b7cc8a..9b800bbc93 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 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.cs index 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.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 b36a773eb4..dd9b7ff75b 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 bce4219019..e79aec33c1 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) From 47e6530d8419f9f9bc99f502f68a0c93650e6659 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:50:30 -0400 Subject: [PATCH 08/12] fix file extension being displayed --- .../Library/Resolvers/Movies/MovieResolver.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 94cafa3e2d..d69a2b2404 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -160,7 +160,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies ProductionYear = video.Year, Name = parseName ? video.Name : - Path.GetFileName(video.Files[0].Path), + Path.GetFileNameWithoutExtension(video.Files[0].Path), AdditionalParts = video.Files.Skip(1).Select(i => i.Path).ToArray(), LocalAlternateVersions = video.AlternateVersions.Select(i => i.Path).ToArray() }; From aa83d09fd7ead38fcaeb777b4a44782ece54904f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:50:44 -0400 Subject: [PATCH 09/12] improve search by artists --- .../Library/SearchEngine.cs | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs index b1ed034ca2..df21c14091 100644 --- a/Emby.Server.Implementations/Library/SearchEngine.cs +++ b/Emby.Server.Implementations/Library/SearchEngine.cs @@ -99,8 +99,6 @@ namespace Emby.Server.Implementations.Library var terms = GetWords(searchTerm); - var hints = new List>(); - var excludeItemTypes = query.ExcludeItemTypes.ToList(); var includeItemTypes = (query.IncludeItemTypes ?? new string[] { }).ToList(); @@ -161,8 +159,15 @@ namespace Emby.Server.Implementations.Library AddIfMissing(excludeItemTypes, typeof(CollectionFolder).Name); AddIfMissing(excludeItemTypes, typeof(Folder).Name); + var mediaTypes = query.MediaTypes.ToList(); - var mediaItems = _libraryManager.GetItemList(new InternalItemsQuery(user) + if (includeItemTypes.Count > 0) + { + excludeItemTypes.Clear(); + mediaTypes.Clear(); + } + + var searchQuery = new InternalItemsQuery(user) { NameContains = searchTerm, ExcludeItemTypes = excludeItemTypes.ToArray(excludeItemTypes.Count), @@ -178,7 +183,7 @@ namespace Emby.Server.Implementations.Library IsNews = query.IsNews, IsSeries = query.IsSeries, IsSports = query.IsSports, - MediaTypes = query.MediaTypes, + MediaTypes = mediaTypes.ToArray(), DtoOptions = new DtoOptions { @@ -189,17 +194,33 @@ namespace Emby.Server.Implementations.Library ItemFields.ChannelInfo } } - }); + }; - // Add search hints based on item name - hints.AddRange(mediaItems.Select(item => + List mediaItems; + + if (searchQuery.IncludeItemTypes.Length == 1 && string.Equals(searchQuery.IncludeItemTypes[0], "MusicArtist", StringComparison.OrdinalIgnoreCase)) + { + if (searchQuery.ParentId.HasValue) + { + searchQuery.AncestorIds = new string[] { searchQuery.ParentId.Value.ToString("N") }; + } + searchQuery.ParentId = null; + searchQuery.IncludeItemsByName = true; + searchQuery.IncludeItemTypes = new string[] { }; + mediaItems = _libraryManager.GetArtists(searchQuery).Items.Select(i => i.Item1).ToList(); + } + else + { + mediaItems = _libraryManager.GetItemList(searchQuery); + } + + var returnValue = mediaItems.Select(item => { var index = GetIndex(item.Name, searchTerm, terms); return new Tuple(item, index.Item1, index.Item2); - })); - var returnValue = hints.Where(i => i.Item3 >= 0).OrderBy(i => i.Item3).ThenBy(i => i.Item1.SortName).Select(i => new SearchHintInfo + }).OrderBy(i => i.Item3).ThenBy(i => i.Item1.SortName).Select(i => new SearchHintInfo { Item = i.Item1, MatchedTerm = i.Item2 From d765f370b35bdc8c74a6b74a82796efcea97f762 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:56:20 -0400 Subject: [PATCH 10/12] update librarymanager --- .../Configuration/ServerConfigurationManager.cs | 6 ------ Emby.Server.Implementations/Library/LibraryManager.cs | 2 +- MediaBrowser.Model/Configuration/ServerConfiguration.cs | 3 --- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs index 607e896b86..e73a69892c 100644 --- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -237,12 +237,6 @@ namespace Emby.Server.Implementations.Configuration changed = true; } - if (!config.EnableLocalizedGuids) - { - config.EnableLocalizedGuids = true; - changed = true; - } - return changed; } } diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index cac1cb3b4b..bd8a095503 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 (ConfigurationManager.Configuration.EnableLocalizedGuids && key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath)) + if (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/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 9b800bbc93..f2c3b7cc8a 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -189,8 +189,6 @@ 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. /// @@ -202,7 +200,6 @@ namespace MediaBrowser.Model.Configuration PathSubstitutions = new PathSubstitution[] { }; EnableSimpleArtistDetection = true; - EnableLocalizedGuids = true; DisplaySpecialsWithinSeasons = true; EnableExternalContentInSuggestions = true; From 67cf7da8dfec80f8c5e11da324d3cdd7ac030ba0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Nov 2017 15:57:07 -0400 Subject: [PATCH 11/12] 3.2.35.2 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 3015cea1f2..e61a50da28 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.35.1")] +[assembly: AssemblyVersion("3.2.35.2")] From 7174ee66d5acb06c310da56c5d53d0a4f000db90 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 2 Nov 2017 12:00:58 -0400 Subject: [PATCH 12/12] allow separate image extractions for each audio book --- .../Networking/NetworkManager.cs | 2 +- .../MediaInfo/AudioImageProvider.cs | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index f8f7da78ae..72d0154aa5 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.Networking endpoint.StartsWith("127.", StringComparison.OrdinalIgnoreCase) || endpoint.StartsWith("192.168", StringComparison.OrdinalIgnoreCase) || endpoint.StartsWith("169.", StringComparison.OrdinalIgnoreCase) || - //endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || + endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase) || IsInPrivateAddressSpaceAndLocalSubnet(endpoint); } diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index 3499d5d3f8..1a650082c2 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -92,24 +92,34 @@ namespace MediaBrowser.Providers.MediaInfo private string GetAudioImagePath(Audio item) { - var filename = item.Album ?? string.Empty; - filename += string.Join(",", item.Artists); + string filename; - if (!string.IsNullOrWhiteSpace(item.Album)) + if (item.GetType() == typeof(Audio)) { - filename += "_" + item.Album; - } - else if (!string.IsNullOrWhiteSpace(item.Name)) - { - filename += "_" + item.Name; + filename = item.Album ?? string.Empty; + filename += string.Join(",", item.Artists); + + if (!string.IsNullOrWhiteSpace(item.Album)) + { + filename += "_" + item.Album; + } + else if (!string.IsNullOrWhiteSpace(item.Name)) + { + filename += "_" + item.Name; + } + else + { + filename += "_" + item.Id.ToString("N"); + } + + filename = filename.GetMD5() + ".jpg"; } else { - filename += "_" + item.Id.ToString("N"); + // If it's an audio book or audio podcast, allow unique image per item + filename = item.Id.ToString("N") + ".jpg"; } - filename = filename.GetMD5() + ".jpg"; - var prefix = filename.Substring(0, 1); return Path.Combine(AudioImagesPath, prefix, filename);