2013-03-04 06:43:06 +01:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2013-02-21 02:33:05 +01:00
|
|
|
|
using System;
|
2013-03-02 18:59:15 +01:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
2013-02-21 02:33:05 +01:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class FanartBaseProvider
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract class FanartBaseProvider : BaseMetadataProvider
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The LOG o_ FILE
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const string LOGO_FILE = "logo.png";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The AR t_ FILE
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const string ART_FILE = "clearart.png";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The THUM b_ FILE
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const string THUMB_FILE = "thumb.jpg";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The DIS c_ FILE
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const string DISC_FILE = "disc.png";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The BANNE r_ FILE
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const string BANNER_FILE = "banner.png";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The API key
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";
|
|
|
|
|
|
2013-03-04 06:43:06 +01:00
|
|
|
|
protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager)
|
2013-03-02 18:59:15 +01:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-21 02:33:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Needses the refresh internal.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="providerInfo">The provider info.</param>
|
|
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
|
|
|
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
|
|
|
|
{
|
|
|
|
|
if (item.DontFetchMeta) return false;
|
|
|
|
|
|
2013-03-04 06:43:06 +01:00
|
|
|
|
return DateTime.UtcNow > (providerInfo.LastRefreshed.AddDays(ConfigurationManager.Configuration.MetadataRefreshDays))
|
2013-02-21 02:33:05 +01:00
|
|
|
|
&& ShouldFetch(item, providerInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a value indicating whether [requires internet].
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value><c>true</c> if [requires internet]; otherwise, <c>false</c>.</value>
|
|
|
|
|
public override bool RequiresInternet
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the priority.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The priority.</value>
|
|
|
|
|
public override MetadataProviderPriority Priority
|
|
|
|
|
{
|
|
|
|
|
get { return MetadataProviderPriority.Third; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Shoulds the fetch.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="providerInfo">The provider info.</param>
|
|
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
|
|
|
protected virtual bool ShouldFetch(BaseItem item, BaseProviderInfo providerInfo)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|