MovieExternalIds.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. using MediaBrowser.Controller.Channels;
  2. using MediaBrowser.Controller.Entities;
  3. using MediaBrowser.Controller.Entities.Movies;
  4. using MediaBrowser.Controller.Entities.TV;
  5. using MediaBrowser.Controller.LiveTv;
  6. using MediaBrowser.Controller.Providers;
  7. using MediaBrowser.Model.Channels;
  8. using MediaBrowser.Model.Entities;
  9. namespace MediaBrowser.Providers.Movies
  10. {
  11. public class MovieDbMovieExternalId : IExternalId
  12. {
  13. public string Name
  14. {
  15. get { return "TheMovieDb"; }
  16. }
  17. public string Key
  18. {
  19. get { return MetadataProviders.Tmdb.ToString(); }
  20. }
  21. public string UrlFormatString
  22. {
  23. get { return "http://www.themoviedb.org/movie/{0}"; }
  24. }
  25. public bool Supports(IHasProviderIds item)
  26. {
  27. var channelItem = item as ChannelVideoItem;
  28. if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
  29. {
  30. return true;
  31. }
  32. // Supports images for tv movies
  33. var tvProgram = item as LiveTvProgram;
  34. if (tvProgram != null && tvProgram.IsMovie)
  35. {
  36. return true;
  37. }
  38. return item is Movie || item is MusicVideo;
  39. }
  40. }
  41. public class MovieDbSeriesExternalId : IExternalId
  42. {
  43. public string Name
  44. {
  45. get { return "TheMovieDb"; }
  46. }
  47. public string Key
  48. {
  49. get { return MetadataProviders.Tmdb.ToString(); }
  50. }
  51. public string UrlFormatString
  52. {
  53. get { return "http://www.themoviedb.org/tv/{0}"; }
  54. }
  55. public bool Supports(IHasProviderIds item)
  56. {
  57. return item is Series;
  58. }
  59. }
  60. public class MovieDbMovieCollectionExternalId : IExternalId
  61. {
  62. public string Name
  63. {
  64. get { return "TheMovieDb Collection"; }
  65. }
  66. public string Key
  67. {
  68. get { return MetadataProviders.TmdbCollection.ToString(); }
  69. }
  70. public string UrlFormatString
  71. {
  72. get { return "http://www.themoviedb.org/collection/{0}"; }
  73. }
  74. public bool Supports(IHasProviderIds item)
  75. {
  76. return item is Movie || item is MusicVideo;
  77. }
  78. }
  79. public class MovieDbPersonExternalId : IExternalId
  80. {
  81. public string Name
  82. {
  83. get { return "TheMovieDb"; }
  84. }
  85. public string Key
  86. {
  87. get { return MetadataProviders.Tmdb.ToString(); }
  88. }
  89. public string UrlFormatString
  90. {
  91. get { return "http://www.themoviedb.org/person/{0}"; }
  92. }
  93. public bool Supports(IHasProviderIds item)
  94. {
  95. return item is Person;
  96. }
  97. }
  98. public class MovieDbCollectionExternalId : IExternalId
  99. {
  100. public string Name
  101. {
  102. get { return "TheMovieDb"; }
  103. }
  104. public string Key
  105. {
  106. get { return MetadataProviders.Tmdb.ToString(); }
  107. }
  108. public string UrlFormatString
  109. {
  110. get { return "http://www.themoviedb.org/collection/{0}"; }
  111. }
  112. public bool Supports(IHasProviderIds item)
  113. {
  114. return item is BoxSet;
  115. }
  116. }
  117. public class ImdbExternalId : IExternalId
  118. {
  119. public string Name
  120. {
  121. get { return "IMDb"; }
  122. }
  123. public string Key
  124. {
  125. get { return MetadataProviders.Imdb.ToString(); }
  126. }
  127. public string UrlFormatString
  128. {
  129. get { return "http://www.imdb.com/title/{0}"; }
  130. }
  131. public bool Supports(IHasProviderIds item)
  132. {
  133. var channelItem = item as ChannelVideoItem;
  134. if (channelItem != null && channelItem.ContentType == ChannelMediaContentType.MovieExtra && channelItem.ExtraType == ExtraType.Trailer)
  135. {
  136. return true;
  137. }
  138. return item is Movie || item is MusicVideo || item is Series || item is Episode;
  139. }
  140. }
  141. public class ImdbPersonExternalId : IExternalId
  142. {
  143. public string Name
  144. {
  145. get { return "IMDb"; }
  146. }
  147. public string Key
  148. {
  149. get { return MetadataProviders.Imdb.ToString(); }
  150. }
  151. public string UrlFormatString
  152. {
  153. get { return "http://www.imdb.com/name/{0}"; }
  154. }
  155. public bool Supports(IHasProviderIds item)
  156. {
  157. return item is Person;
  158. }
  159. }
  160. }