ItemLookupInfo.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 string AlbumArtist { 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. }
  74. }
  75. public class GameInfo : ItemLookupInfo
  76. {
  77. /// <summary>
  78. /// Gets or sets the game system.
  79. /// </summary>
  80. /// <value>The game system.</value>
  81. public string GameSystem { get; set; }
  82. }
  83. public class GameSystemInfo : ItemLookupInfo
  84. {
  85. /// <summary>
  86. /// Gets or sets the path.
  87. /// </summary>
  88. /// <value>The path.</value>
  89. public string Path { get; set; }
  90. }
  91. public class EpisodeInfo : ItemLookupInfo, IHasIdentities<EpisodeIdentity>
  92. {
  93. private List<EpisodeIdentity> _identities = new List<EpisodeIdentity>();
  94. public Dictionary<string, string> SeriesProviderIds { get; set; }
  95. public int? IndexNumberEnd { get; set; }
  96. public int? AnimeSeriesIndex { get; set; }
  97. public EpisodeInfo()
  98. {
  99. SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  100. }
  101. public IEnumerable<EpisodeIdentity> Identities
  102. {
  103. get { return _identities; }
  104. }
  105. public async Task FindIdentities(IProviderManager providerManager, CancellationToken cancellationToken)
  106. {
  107. var identifier = new ItemIdentifier<EpisodeInfo, EpisodeIdentity>();
  108. _identities = (await identifier.FindIdentities(this, providerManager, cancellationToken)).ToList();
  109. }
  110. }
  111. public class EpisodeIdentity : IItemIdentity
  112. {
  113. public string Type { get; set; }
  114. public string SeriesId { get; set; }
  115. public int? SeasonIndex { get; set; }
  116. public int IndexNumber { get; set; }
  117. public int? IndexNumberEnd { get; set; }
  118. }
  119. public class SongInfo : ItemLookupInfo
  120. {
  121. public string AlbumArtist { get; set; }
  122. public string Album { get; set; }
  123. public List<string> Artists { get; set; }
  124. }
  125. public class SeriesInfo : ItemLookupInfo, IHasIdentities<SeriesIdentity>
  126. {
  127. private List<SeriesIdentity> _identities = new List<SeriesIdentity>();
  128. public int? AnimeSeriesIndex { get; set; }
  129. public IEnumerable<SeriesIdentity> Identities
  130. {
  131. get { return _identities; }
  132. }
  133. public async Task FindIdentities(IProviderManager providerManager, CancellationToken cancellationToken)
  134. {
  135. var identifier = new ItemIdentifier<SeriesInfo, SeriesIdentity>();
  136. _identities = (await identifier.FindIdentities(this, providerManager, cancellationToken)).ToList();
  137. }
  138. }
  139. public class SeriesIdentity : IItemIdentity
  140. {
  141. public string Type { get; set; }
  142. public string Id { get; set; }
  143. }
  144. public class PersonLookupInfo : ItemLookupInfo
  145. {
  146. }
  147. public class MovieInfo : ItemLookupInfo
  148. {
  149. }
  150. public class BoxSetInfo : ItemLookupInfo
  151. {
  152. }
  153. public class MusicVideoInfo : ItemLookupInfo
  154. {
  155. }
  156. public class TrailerInfo : ItemLookupInfo
  157. {
  158. public bool IsLocalTrailer { get; set; }
  159. }
  160. public class BookInfo : ItemLookupInfo
  161. {
  162. public string SeriesName { get; set; }
  163. }
  164. public class SeasonInfo : ItemLookupInfo, IHasIdentities<SeasonIdentity>
  165. {
  166. private List<SeasonIdentity> _identities = new List<SeasonIdentity>();
  167. public Dictionary<string, string> SeriesProviderIds { get; set; }
  168. public int? AnimeSeriesIndex { get; set; }
  169. public SeasonInfo()
  170. {
  171. SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
  172. }
  173. public IEnumerable<SeasonIdentity> Identities
  174. {
  175. get { return _identities; }
  176. }
  177. public async Task FindIdentities(IProviderManager providerManager, CancellationToken cancellationToken)
  178. {
  179. var identifier = new ItemIdentifier<SeasonInfo, SeasonIdentity>();
  180. _identities = (await identifier.FindIdentities(this, providerManager, cancellationToken)).ToList();
  181. }
  182. }
  183. public class SeasonIdentity : IItemIdentity
  184. {
  185. public string Type { get; set; }
  186. public string SeriesId { get; set; }
  187. public int SeasonIndex { get; set; }
  188. }
  189. }