using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Providers
{
///
/// Provides images for all types by looking for standard images - folder, backdrop, logo, etc.
///
[Export(typeof(BaseMetadataProvider))]
public class ImageFromMediaLocationProvider : BaseMetadataProvider
{
public override bool Supports(BaseEntity item)
{
return true;
}
public override MetadataProviderPriority Priority
{
get { return MetadataProviderPriority.First; }
}
public override Task FetchAsync(BaseEntity item, ItemResolveEventArgs args)
{
if (args.IsDirectory)
{
var baseItem = item as BaseItem;
if (baseItem != null)
{
return Task.Run(() => { PopulateBaseItemImages(baseItem, args); });
}
else
{
return Task.Run(() => { PopulateImages(item, args); });
}
}
return Task.FromResult