| | 1 | | #pragma warning disable CS1591 |
| | 2 | |
|
| | 3 | | using System.Collections.Generic; |
| | 4 | | using Jellyfin.Data.Enums; |
| | 5 | | using Jellyfin.Database.Implementations.Enums; |
| | 6 | | using MediaBrowser.Common.Configuration; |
| | 7 | | using MediaBrowser.Controller.Drawing; |
| | 8 | | using MediaBrowser.Controller.Dto; |
| | 9 | | using MediaBrowser.Controller.Entities; |
| | 10 | | using MediaBrowser.Controller.Entities.Audio; |
| | 11 | | using MediaBrowser.Controller.Library; |
| | 12 | | using MediaBrowser.Controller.Providers; |
| | 13 | | using MediaBrowser.Model.Entities; |
| | 14 | | using MediaBrowser.Model.IO; |
| | 15 | |
|
| | 16 | | namespace Emby.Server.Implementations.Images |
| | 17 | | { |
| | 18 | | public abstract class BaseFolderImageProvider<T> : BaseDynamicImageProvider<T> |
| | 19 | | where T : Folder, new() |
| | 20 | | { |
| | 21 | | private readonly ILibraryManager _libraryManager; |
| | 22 | |
|
| | 23 | | protected BaseFolderImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths ap |
| 63 | 24 | | : base(fileSystem, providerManager, applicationPaths, imageProcessor) |
| | 25 | | { |
| 63 | 26 | | _libraryManager = libraryManager; |
| 63 | 27 | | } |
| | 28 | |
|
| | 29 | | protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item) |
| | 30 | | { |
| 37 | 31 | | return _libraryManager.GetItemList(new InternalItemsQuery |
| 37 | 32 | | { |
| 37 | 33 | | Parent = item, |
| 37 | 34 | | Recursive = true, |
| 37 | 35 | | DtoOptions = new DtoOptions(true), |
| 37 | 36 | | ImageTypes = [ImageType.Primary], |
| 37 | 37 | | OrderBy = |
| 37 | 38 | | [ |
| 37 | 39 | | (ItemSortBy.IsFolder, SortOrder.Ascending), |
| 37 | 40 | | (ItemSortBy.SortName, SortOrder.Ascending) |
| 37 | 41 | | ], |
| 37 | 42 | | Limit = 1 |
| 37 | 43 | | }); |
| | 44 | | } |
| | 45 | |
|
| | 46 | | protected override string CreateImage(BaseItem item, IReadOnlyCollection<BaseItem> itemsWithImages, string outpu |
| | 47 | | { |
| 36 | 48 | | return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary); |
| | 49 | | } |
| | 50 | |
|
| | 51 | | protected override bool Supports(BaseItem item) |
| | 52 | | { |
| 0 | 53 | | return item is T; |
| | 54 | | } |
| | 55 | |
|
| | 56 | | protected override bool HasChangedByDate(BaseItem item, ItemImageInfo image) |
| | 57 | | { |
| 0 | 58 | | if (item is MusicAlbum) |
| | 59 | | { |
| 0 | 60 | | return false; |
| | 61 | | } |
| | 62 | |
|
| 0 | 63 | | return base.HasChangedByDate(item, image); |
| | 64 | | } |
| | 65 | | } |
| | 66 | | } |