From 7e5036a5875cb7f03ad728f970d66471ca30236b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Oct 2017 02:22:43 -0400 Subject: update image aspect ratio detection --- Emby.Drawing/ImageProcessor.cs | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'Emby.Drawing/ImageProcessor.cs') diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 831454972..6bdb06c83 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -442,19 +442,39 @@ namespace Emby.Drawing return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower()); } - public ImageSize GetImageSize(ItemImageInfo info, bool allowSlowMethods) + public ImageSize GetImageSize(BaseItem item, ItemImageInfo info) { - return GetImageSize(info.Path, allowSlowMethods); + return GetImageSize(item, info, false, true); } - public ImageSize GetImageSize(ItemImageInfo info) + public ImageSize GetImageSize(BaseItem item, ItemImageInfo info, bool allowSlowMethods, bool updateItem) { - return GetImageSize(info.Path, false); - } + var width = info.Width; + var height = info.Height; - public ImageSize GetImageSize(string path) - { - return GetImageSize(path, false); + if (height > 0 && width > 0) + { + return new ImageSize + { + Width = width, + Height = height + }; + } + + var path = item.Path; + _logger.Info("Getting image size for item {0} {1}", item.GetType().Name, path); + + var size = GetImageSize(path, allowSlowMethods); + + info.Height = Convert.ToInt32(size.Height); + info.Width = Convert.ToInt32(size.Width); + + if (updateItem) + { + _libraryManager().UpdateImages(item); + } + + return size; } /// -- cgit v1.2.3 From ac09136a3d73d97956efa9253951d66fdffc7504 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Oct 2017 17:38:03 -0400 Subject: restore GetImageSize method --- Emby.Drawing/ImageProcessor.cs | 5 +++++ Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs | 6 ++++++ MediaBrowser.Controller/Drawing/IImageProcessor.cs | 2 ++ MediaBrowser.Controller/Entities/Audio/Audio.cs | 6 ++++++ MediaBrowser.Controller/Entities/BaseItem.cs | 2 +- MediaBrowser.Controller/Entities/Game.cs | 6 ++++++ MediaBrowser.Controller/Entities/Movies/BoxSet.cs | 6 ++++++ MediaBrowser.Controller/Entities/TV/Episode.cs | 6 ++++++ MediaBrowser.Controller/Entities/TV/Season.cs | 6 ++++++ MediaBrowser.Controller/Entities/TV/Series.cs | 6 ++++++ MediaBrowser.Controller/Entities/Video.cs | 6 ++++++ MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs | 2 +- 12 files changed, 57 insertions(+), 2 deletions(-) (limited to 'Emby.Drawing/ImageProcessor.cs') diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 6bdb06c83..1c60abfb5 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -477,6 +477,11 @@ namespace Emby.Drawing return size; } + public ImageSize GetImageSize(string path) + { + return GetImageSize(path, true); + } + /// /// Gets the size of the image. /// diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 136d0cc7f..b3c7ecc9f 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -650,6 +650,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings bool enableRetry, ListingsProviderInfo providerInfo) { + // Schedules direct requires that the client support compression and will return a 400 response without it + options.EnableHttpCompression = true; + try { return await _httpClient.Post(options).ConfigureAwait(false); @@ -678,6 +681,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings bool enableRetry, ListingsProviderInfo providerInfo) { + // Schedules direct requires that the client support compression and will return a 400 response without it + options.EnableHttpCompression = true; + try { return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false); diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs index 40ab71be8..0bc92ac7e 100644 --- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs +++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs @@ -26,6 +26,8 @@ namespace MediaBrowser.Controller.Drawing /// The image enhancers. IImageEnhancer[] ImageEnhancers { get; } + ImageSize GetImageSize(string path); + /// /// Gets the size of the image. /// diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 02a9f15a9..16fd75d2e 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -60,6 +60,12 @@ namespace MediaBrowser.Controller.Entities.Audio } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return false; } + } + [IgnoreDataMember] public override bool SupportsAddingToPlaylist { diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 6898c0178..89d48ff90 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1164,7 +1164,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public virtual bool SupportsPeople { - get { return true; } + get { return false; } } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index fd45f7c82..bead0ef95 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -34,6 +34,12 @@ namespace MediaBrowser.Controller.Entities get { return true; } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return false; } + } + /// /// Gets or sets the remote trailers. /// diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index 0067515d8..268860ff0 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -45,6 +45,12 @@ namespace MediaBrowser.Controller.Entities.Movies } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return true; } + } + public Guid[] LocalTrailerIds { get; set; } public Guid[] RemoteTrailerIds { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index c30e0ef8e..3f52dfc93 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -78,6 +78,12 @@ namespace MediaBrowser.Controller.Entities.TV get { return true; } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return true; } + } + [IgnoreDataMember] public int? AiredSeasonNumber { diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index bf6dc5678..00bb75fa7 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -40,6 +40,12 @@ namespace MediaBrowser.Controller.Entities.TV } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return true; } + } + [IgnoreDataMember] public override bool SupportsInheritedParentImages { diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 5931c32e1..1d09783d1 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -64,6 +64,12 @@ namespace MediaBrowser.Controller.Entities.TV } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return true; } + } + public Guid[] LocalTrailerIds { get; set; } public Guid[] RemoteTrailerIds { get; set; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 265e35341..52f1dd051 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -44,6 +44,12 @@ namespace MediaBrowser.Controller.Entities } } + [IgnoreDataMember] + public override bool SupportsPeople + { + get { return true; } + } + [IgnoreDataMember] public override bool SupportsInheritedParentImages { diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs index aa6e5ad31..cb0075b33 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs @@ -123,7 +123,7 @@ namespace MediaBrowser.Providers.MediaInfo audio.Name = data.Name; } - if (!audio.LockedFields.Contains(MetadataFields.Cast)) + if (audio.SupportsPeople && !audio.LockedFields.Contains(MetadataFields.Cast)) { var people = new List(); -- cgit v1.2.3 From a59ff2760575abe20dd1ae3a35f83e0439e3f497 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 22 Oct 2017 20:43:52 -0400 Subject: fix image analysis --- Emby.Drawing/ImageProcessor.cs | 2 +- Emby.Server.Implementations/Dto/DtoService.cs | 4 ++-- .../Library/Resolvers/PhotoAlbumResolver.cs | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'Emby.Drawing/ImageProcessor.cs') diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 1c60abfb5..e28d22cf7 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -461,7 +461,7 @@ namespace Emby.Drawing }; } - var path = item.Path; + var path = info.Path; _logger.Info("Getting image size for item {0} {1}", item.GetType().Name, path); var size = GetImageSize(path, allowSlowMethods); diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index a0176e406..0a316fcf1 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -1655,9 +1655,9 @@ namespace Emby.Server.Implementations.Dto return null; } } - catch + catch (Exception ex) { - //_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path); + //_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, imageInfo.Path); return null; } } diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs index a9cfea34d..311abf14e 100644 --- a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs @@ -30,8 +30,11 @@ namespace Emby.Server.Implementations.Library.Resolvers // Must be an image file within a photo collection if (args.IsDirectory) { - if (string.Equals(args.GetCollectionType(), CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) || - string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase)) + // Must be an image file within a photo collection + var collectionType = args.GetCollectionType(); + + if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) || + (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos)) { if (HasPhotos(args)) { -- cgit v1.2.3