FanartBaseProvider.cs 2.7 KB

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