using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Controller.Providers { /// /// Marker interface /// public interface IMetadataProvider { /// /// Gets the name. /// /// The name. string Name { get; } } public interface IMetadataProvider : IMetadataProvider where TItemType : IHasMetadata { } public interface ILocalMetadataProvider : IMetadataProvider { /// /// Determines whether [has local metadata] [the specified item]. /// /// The item. /// true if [has local metadata] [the specified item]; otherwise, false. bool HasLocalMetadata(IHasMetadata item); } public interface IRemoteMetadataProvider : IMetadataProvider { } public interface IRemoteMetadataProvider : IMetadataProvider, IRemoteMetadataProvider where TItemType : IHasMetadata { Task> GetMetadata(ItemId id, CancellationToken cancellationToken); } public interface ILocalMetadataProvider : IMetadataProvider, ILocalMetadataProvider where TItemType : IHasMetadata { Task> GetMetadata(string path, CancellationToken cancellationToken); } public interface IHasChangeMonitor { /// /// Determines whether the specified date has changed. /// /// The item. /// The date. /// true if the specified date has changed; otherwise, false. bool HasChanged(IHasMetadata item, DateTime date); } public enum MetadataProviderType { Embedded = 0, Local = 1, Remote = 2 } public class MetadataResult where T : IHasMetadata { public bool HasMetadata { get; set; } public T Item { get; set; } } public class ItemId : IHasProviderIds { public string Name { get; set; } public string MetadataLanguage { get; set; } public string MetadataCountryCode { get; set; } public Dictionary ProviderIds { get; set; } public ItemId() { ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); } } }