ItemLookupInfo.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. using System.Linq;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using MediaBrowser.Model.Channels;
  5. using MediaBrowser.Model.Entities;
  6. using System;
  7. using System.Collections.Generic;
  8. namespace MediaBrowser.Controller.Providers
  9. {
  10. public class ItemLookupInfo : IHasProviderIds
  11. {
  12. /// <summary>
  13. /// Gets or sets the name.
  14. /// </summary>
  15. /// <value>The name.</value>
  16. public string Name { get; set; }
  17. /// <summary>
  18. /// Gets or sets the metadata language.
  19. /// </summary>
  20. /// <value>The metadata language.</value>
  21. public string MetadataLanguage { get; set; }
  22. /// <summary>
  23. /// Gets or sets the metadata country code.
  24. /// </summary>
  25. /// <value>The metadata country code.</value>
  26. public string MetadataCountryCode { get; set; }
  27. /// <summary>
  28. /// Gets or sets the provider ids.
  29. /// </summary>
  30. /// <value>The provider ids.</value>
  31. public Dictionary<string, string> ProviderIds { get; set; }
  32. /// <summary>
  33. /// Gets or sets the year.
  34. /// </summary>
  35. /// <value>The year.</value>
  36. public int? Year { get; set; }
  37. public int? IndexNumber { get; set; }
  38. public int? ParentIndexNumber { get; set; }
  39. public ItemLookupInfo()
  40. {
  41. ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  42. }
  43. }
  44. public interface IHasLookupInfo<out TLookupInfoType>
  45. where TLookupInfoType : ItemLookupInfo, new()
  46. {
  47. TLookupInfoType GetLookupInfo();
  48. }
  49. public class ArtistInfo : ItemLookupInfo
  50. {
  51. public List<SongInfo> SongInfos { get; set; }
  52. public ArtistInfo()
  53. {
  54. SongInfos = new List<SongInfo>();
  55. }
  56. }
  57. public class AlbumInfo : ItemLookupInfo
  58. {
  59. /// <summary>
  60. /// Gets or sets the album artist.
  61. /// </summary>
  62. /// <value>The album artist.</value>
  63. public List<string> AlbumArtists { get; set; }
  64. /// <summary>
  65. /// Gets or sets the artist provider ids.
  66. /// </summary>
  67. /// <value>The artist provider ids.</value>
  68. public Dictionary<string, string> ArtistProviderIds { get; set; }
  69. public List<SongInfo> SongInfos { get; set; }
  70. public AlbumInfo()
  71. {
  72. ArtistProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  73. SongInfos = new List<SongInfo>();
  74. AlbumArtists = new List<string>();
  75. }
  76. }
  77. public class GameInfo : ItemLookupInfo
  78. {
  79. /// <summary>
  80. /// Gets or sets the game system.
  81. /// </summary>
  82. /// <value>The game system.</value>
  83. public string GameSystem { get; set; }
  84. }
  85. public class GameSystemInfo : ItemLookupInfo
  86. {
  87. /// <summary>
  88. /// Gets or sets the path.
  89. /// </summary>
  90. /// <value>The path.</value>
  91. public string Path { get; set; }
  92. }
  93. public class EpisodeInfo : ItemLookupInfo, IHasIdentities<EpisodeIdentity>
  94. {
  95. private List<EpisodeIdentity> _identities = new List<EpisodeIdentity>();
  96. public Dictionary<string, string> SeriesProviderIds { get; set; }
  97. public int? IndexNumberEnd { get; set; }
  98. public int? AnimeSeriesIndex { get; set; }
  99. public EpisodeInfo()
  100. {
  101. SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  102. }
  103. public IEnumerable<EpisodeIdentity> Identities
  104. {
  105. get { return _identities; }
  106. }
  107. public async Task FindIdentities(IProviderManager providerManager, CancellationToken cancellationToken)
  108. {
  109. var identifier = new ItemIdentifier<EpisodeInfo, EpisodeIdentity>();
  110. _identities = (await identifier.FindIdentities(this, providerManager, cancellationToken)).ToList();
  111. }
  112. }
  113. public class EpisodeIdentity : IItemIdentity
  114. {
  115. public string Type { get; set; }
  116. public string SeriesId { get; set; }
  117. public int? SeasonIndex { get; set; }
  118. public int IndexNumber { get; set; }
  119. public int? IndexNumberEnd { get; set; }
  120. }
  121. public class SongInfo : ItemLookupInfo
  122. {
  123. public List<string> AlbumArtists { get; set; }
  124. public string Album { get; set; }
  125. public List<string> Artists { get; set; }
  126. public SongInfo()
  127. {
  128. Artists = new List<string>();
  129. AlbumArtists = new List<string>();
  130. }
  131. }
  132. public class SeriesInfo : ItemLookupInfo, IHasIdentities<SeriesIdentity>
  133. {
  134. private List<SeriesIdentity> _identities = new List<SeriesIdentity>();
  135. public int? AnimeSeriesIndex { get; set; }
  136. public IEnumerable<SeriesIdentity> Identities
  137. {
  138. get { return _identities; }
  139. }
  140. public async Task FindIdentities(IProviderManager providerManager, CancellationToken cancellationToken)
  141. {
  142. var identifier = new ItemIdentifier<SeriesInfo, SeriesIdentity>();
  143. _identities = (await identifier.FindIdentities(this, providerManager, cancellationToken)).ToList();
  144. }
  145. }
  146. public class SeriesIdentity : IItemIdentity
  147. {
  148. public string Type { get; set; }
  149. public string Id { get; set; }
  150. }
  151. public class PersonLookupInfo : ItemLookupInfo
  152. {
  153. }
  154. public class MovieInfo : ItemLookupInfo
  155. {
  156. }
  157. public class BoxSetInfo : ItemLookupInfo
  158. {
  159. }
  160. public class MusicVideoInfo : ItemLookupInfo
  161. {
  162. }
  163. public class TrailerInfo : ItemLookupInfo
  164. {
  165. public bool IsLocalTrailer { get; set; }
  166. }
  167. public class BookInfo : ItemLookupInfo
  168. {
  169. public string SeriesName { get; set; }
  170. }
  171. public class SeasonInfo : ItemLookupInfo, IHasIdentities<SeasonIdentity>
  172. {
  173. private List<SeasonIdentity> _identities = new List<SeasonIdentity>();
  174. public Dictionary<string, string> SeriesProviderIds { get; set; }
  175. public int? AnimeSeriesIndex { get; set; }
  176. public SeasonInfo()
  177. {
  178. SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  179. }
  180. public IEnumerable<SeasonIdentity> Identities
  181. {
  182. get { return _identities; }
  183. }
  184. public async Task FindIdentities(IProviderManager providerManager, CancellationToken cancellationToken)
  185. {
  186. var identifier = new ItemIdentifier<SeasonInfo, SeasonIdentity>();
  187. _identities = (await identifier.FindIdentities(this, providerManager, cancellationToken)).ToList();
  188. }
  189. }
  190. public class SeasonIdentity : IItemIdentity
  191. {
  192. public string Type { get; set; }
  193. public string SeriesId { get; set; }
  194. public int SeasonIndex { get; set; }
  195. }
  196. public class ChannelItemLookupInfo : ItemLookupInfo
  197. {
  198. public ChannelMediaContentType ContentType { get; set; }
  199. public ExtraType ExtraType { get; set; }
  200. }
  201. }