FanartBaseProvider.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using MediaBrowser.Controller.Configuration;
  2. using MediaBrowser.Controller.Entities;
  3. using System;
  4. using MediaBrowser.Model.Logging;
  5. namespace MediaBrowser.Controller.Providers
  6. {
  7. /// <summary>
  8. /// Class FanartBaseProvider
  9. /// </summary>
  10. public abstract class FanartBaseProvider : BaseMetadataProvider
  11. {
  12. /// <summary>
  13. /// The LOG o_ FILE
  14. /// </summary>
  15. protected const string LOGO_FILE = "logo.png";
  16. /// <summary>
  17. /// The AR t_ FILE
  18. /// </summary>
  19. protected const string ART_FILE = "clearart.png";
  20. /// <summary>
  21. /// The THUM b_ FILE
  22. /// </summary>
  23. protected const string THUMB_FILE = "thumb.jpg";
  24. /// <summary>
  25. /// The DIS c_ FILE
  26. /// </summary>
  27. protected const string DISC_FILE = "disc.png";
  28. /// <summary>
  29. /// The BANNE r_ FILE
  30. /// </summary>
  31. protected const string BANNER_FILE = "banner.png";
  32. /// <summary>
  33. /// The API key
  34. /// </summary>
  35. protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";
  36. protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager)
  37. {
  38. }
  39. /// <summary>
  40. /// Needses the refresh internal.
  41. /// </summary>
  42. /// <param name="item">The item.</param>
  43. /// <param name="providerInfo">The provider info.</param>
  44. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
  45. protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
  46. {
  47. if (item.DontFetchMeta) return false;
  48. return DateTime.UtcNow > (providerInfo.LastRefreshed.AddDays(ConfigurationManager.Configuration.MetadataRefreshDays))
  49. && ShouldFetch(item, providerInfo);
  50. }
  51. /// <summary>
  52. /// Gets a value indicating whether [requires internet].
  53. /// </summary>
  54. /// <value><c>true</c> if [requires internet]; otherwise, <c>false</c>.</value>
  55. public override bool RequiresInternet
  56. {
  57. get
  58. {
  59. return true;
  60. }
  61. }
  62. /// <summary>
  63. /// Gets the priority.
  64. /// </summary>
  65. /// <value>The priority.</value>
  66. public override MetadataProviderPriority Priority
  67. {
  68. get { return MetadataProviderPriority.Third; }
  69. }
  70. /// <summary>
  71. /// Shoulds the fetch.
  72. /// </summary>
  73. /// <param name="item">The item.</param>
  74. /// <param name="providerInfo">The provider info.</param>
  75. /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
  76. protected virtual bool ShouldFetch(BaseItem item, BaseProviderInfo providerInfo)
  77. {
  78. return false;
  79. }
  80. }
  81. }