|
|
|
@ -12,6 +12,8 @@ using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using CommonIO;
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Model.Querying;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Server.Implementations.Playlists
|
|
|
|
|
{
|
|
|
|
@ -65,4 +67,36 @@ namespace MediaBrowser.Server.Implementations.Playlists
|
|
|
|
|
return Task.FromResult(GetFinalItems(items));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MusicGenreImageProvider : BaseDynamicImageProvider<MusicGenre>
|
|
|
|
|
{
|
|
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
|
|
|
|
|
|
public MusicGenreImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
|
|
|
|
|
{
|
|
|
|
|
_libraryManager = libraryManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Task<List<BaseItem>> GetItemsWithImages(IHasImages item)
|
|
|
|
|
{
|
|
|
|
|
var items = _libraryManager.GetItemList(new InternalItemsQuery
|
|
|
|
|
{
|
|
|
|
|
Genres = new[] { item.Name },
|
|
|
|
|
IncludeItemTypes = new[] { typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Audio).Name },
|
|
|
|
|
SortBy = new[] { ItemSortBy.Random },
|
|
|
|
|
Limit = 4,
|
|
|
|
|
Recursive = true,
|
|
|
|
|
ImageTypes = new[] { ImageType.Primary }
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
return Task.FromResult(GetFinalItems(items));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//protected override Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
|
|
|
|
//{
|
|
|
|
|
// return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|