FanartBaseProvider.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using MediaBrowser.Controller.Configuration;
  2. using MediaBrowser.Model.Logging;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading;
  6. namespace MediaBrowser.Controller.Providers
  7. {
  8. class FanArtProviderException : ApplicationException
  9. {
  10. public FanArtProviderException(string msg)
  11. : base(msg)
  12. {
  13. }
  14. }
  15. /// <summary>
  16. /// Class FanartBaseProvider
  17. /// </summary>
  18. public abstract class FanartBaseProvider : BaseMetadataProvider
  19. {
  20. protected static readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(5,5);
  21. /// <summary>
  22. /// The LOG o_ FILE
  23. /// </summary>
  24. protected const string LOGO_FILE = "logo.png";
  25. /// <summary>
  26. /// The AR t_ FILE
  27. /// </summary>
  28. protected const string ART_FILE = "clearart.png";
  29. /// <summary>
  30. /// The THUM b_ FILE
  31. /// </summary>
  32. protected const string THUMB_FILE = "thumb.jpg";
  33. /// <summary>
  34. /// The DIS c_ FILE
  35. /// </summary>
  36. protected const string DISC_FILE = "disc.png";
  37. /// <summary>
  38. /// The BANNE r_ FILE
  39. /// </summary>
  40. protected const string BANNER_FILE = "banner.png";
  41. /// <summary>
  42. /// The Backdrop
  43. /// </summary>
  44. protected const string BACKDROP_FILE = "backdrop.jpg";
  45. /// <summary>
  46. /// The Primary image
  47. /// </summary>
  48. protected const string PRIMARY_FILE = "folder.jpg";
  49. /// <summary>
  50. /// The API key
  51. /// </summary>
  52. protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";
  53. protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager)
  54. {
  55. }
  56. /// <summary>
  57. /// Gets a value indicating whether [requires internet].
  58. /// </summary>
  59. /// <value><c>true</c> if [requires internet]; otherwise, <c>false</c>.</value>
  60. public override bool RequiresInternet
  61. {
  62. get { return true; }
  63. }
  64. /// <summary>
  65. /// Gets the priority.
  66. /// </summary>
  67. /// <value>The priority.</value>
  68. public override MetadataProviderPriority Priority
  69. {
  70. get { return MetadataProviderPriority.Third; }
  71. }
  72. #region Result Objects
  73. protected class FanArtImageInfo
  74. {
  75. public string id { get; set; }
  76. public string url { get; set; }
  77. public string likes { get; set; }
  78. }
  79. protected class FanArtMusicInfo
  80. {
  81. public string mbid_id { get; set; }
  82. public List<FanArtImageInfo> musiclogo { get; set; }
  83. public List<FanArtImageInfo> artistbackground { get; set; }
  84. public List<FanArtImageInfo> artistthumb { get; set; }
  85. public List<FanArtImageInfo> hdmusiclogo { get; set; }
  86. public List<FanArtImageInfo> musicbanner { get; set; }
  87. }
  88. protected class FanArtMusicResult
  89. {
  90. public FanArtMusicInfo result { get; set; }
  91. }
  92. #endregion
  93. }
  94. }