ItemLookupInfo.cs 6.8 KB

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