From 9f4407028bc5e4b42ac417b16a261d3e90b0e7c0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 1 May 2015 14:37:01 -0400 Subject: [PATCH] update photo resolving --- MediaBrowser.Dlna/PlayTo/PlayToController.cs | 5 +++- .../Manager/ItemImageProvider.cs | 14 ++++++++--- .../Photos/PhotoAlbumImageProvider.cs | 25 ++++++++++--------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index 5aa8c1f9ca..cf21211f4d 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -768,8 +768,11 @@ namespace MediaBrowser.Dlna.PlayTo await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl).ConfigureAwait(false); - if (newItem.StreamInfo.IsDirectStream) + if (newItem.StreamInfo.IsDirectStream && newPosition > 0) { + // This is rather arbitrary, but give the player time to start playing + await Task.Delay(2000).ConfigureAwait(false); + await _device.Seek(TimeSpan.FromTicks(newPosition)).ConfigureAwait(false); } } diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index fc47b0259a..c95cf67256 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -38,13 +38,19 @@ namespace MediaBrowser.Providers.Manager { var hasChanges = false; - var images = providers.OfType() - .SelectMany(i => i.GetImages(item, directoryService)) + var localImageProviders = providers.OfType() .ToList(); - if (MergeImages(item, images)) + if (localImageProviders.Count > 0 || !(item is Photo)) { - hasChanges = true; + var images = localImageProviders + .SelectMany(i => i.GetImages(item, directoryService)) + .ToList(); + + if (MergeImages(item, images)) + { + hasChanges = true; + } } return hasChanges; diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index 8c142b646a..b55c76b8f8 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -9,18 +9,19 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Photos { - //public class PhotoAlbumImageProvider : BaseDynamicImageProvider - //{ - // public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) : base(fileSystem, providerManager, applicationPaths, imageProcessor) - // { - // } + public class PhotoAlbumImageProvider : BaseDynamicImageProvider + { + public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) + : base(fileSystem, providerManager, applicationPaths, imageProcessor) + { + } - // protected override Task> GetItemsWithImages(IHasImages item) - // { - // var photoAlbum = (PhotoAlbum)item; - // var items = GetFinalItems(photoAlbum.Children.ToList()); + protected override Task> GetItemsWithImages(IHasImages item) + { + var photoAlbum = (PhotoAlbum)item; + var items = GetFinalItems(photoAlbum.Children.ToList()); - // return Task.FromResult(items); - // } - //} + return Task.FromResult(items); + } + } }