using System.Threading; using MediaBrowser.Controller.Configuration; using System.Collections.Generic; using MediaBrowser.Controller.Entities; using System; using MediaBrowser.Model.Logging; namespace MediaBrowser.Controller.Providers { class FanArtProviderException : ApplicationException { public FanArtProviderException(string msg) : base(msg) { } } /// /// Class FanartBaseProvider /// public abstract class FanartBaseProvider : BaseMetadataProvider { protected static readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(5,5); /// /// The LOG o_ FILE /// protected const string LOGO_FILE = "logo.png"; /// /// The AR t_ FILE /// protected const string ART_FILE = "clearart.png"; /// /// The THUM b_ FILE /// protected const string THUMB_FILE = "thumb.jpg"; /// /// The DIS c_ FILE /// protected const string DISC_FILE = "disc.png"; /// /// The BANNE r_ FILE /// protected const string BANNER_FILE = "banner.png"; /// /// The Backdrop /// protected const string BACKDROP_FILE = "backdrop.jpg"; /// /// The Primary image /// protected const string PRIMARY_FILE = "folder.jpg"; /// /// The API key /// protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4"; protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } /// /// Needses the refresh internal. /// /// The item. /// The provider info. /// true if XXXX, false otherwise protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) { if (item.DontFetchMeta) return false; return DateTime.UtcNow > (providerInfo.LastRefreshed.AddDays(ConfigurationManager.Configuration.MetadataRefreshDays)) && ShouldFetch(item, providerInfo); } /// /// Gets a value indicating whether [requires internet]. /// /// true if [requires internet]; otherwise, false. public override bool RequiresInternet { get { return true; } } /// /// Gets the priority. /// /// The priority. public override MetadataProviderPriority Priority { get { return MetadataProviderPriority.Third; } } /// /// Shoulds the fetch. /// /// The item. /// The provider info. /// true if XXXX, false otherwise protected virtual bool ShouldFetch(BaseItem item, BaseProviderInfo providerInfo) { return false; } #region Result Objects protected class FanArtImageInfo { public string id { get; set; } public string url { get; set; } public string likes { get; set; } } protected class FanArtMusicInfo { public string mbid_id { get; set; } public List musiclogo { get; set; } public List artistbackground { get; set; } public List artistthumb { get; set; } public List hdmusiclogo { get; set; } public List musicbanner { get; set; } } protected class FanArtMusicResult { public FanArtMusicInfo result { get; set; } } #endregion } }