jellyfin/MediaBrowser.Providers/Movies/MovieExternalIds.cs

125 lines
3.5 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Entities;
2014-02-21 18:48:15 +00:00
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
2015-07-12 19:33:00 +00:00
using MediaBrowser.Controller.LiveTv;
2014-02-21 18:48:15 +00:00
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Providers.Movies
{
public class MovieDbMovieExternalId : IExternalId
{
2018-09-12 17:26:21 +00:00
public const string BaseMovieDbUrl = "https://www.themoviedb.org/";
public string Name => "TheMovieDb";
2014-02-21 18:48:15 +00:00
public string Key => MetadataProviders.Tmdb.ToString();
2014-02-21 18:48:15 +00:00
public string UrlFormatString => BaseMovieDbUrl + "movie/{0}";
2014-02-21 18:48:15 +00:00
public bool Supports(IHasProviderIds item)
{
2015-07-12 19:33:00 +00:00
// Supports images for tv movies
var tvProgram = item as LiveTvProgram;
if (tvProgram != null && tvProgram.IsMovie)
{
return true;
}
2016-03-19 15:38:05 +00:00
return item is Movie || item is MusicVideo || item is Trailer;
2014-02-21 18:48:15 +00:00
}
}
public class MovieDbSeriesExternalId : IExternalId
{
public string Name => "TheMovieDb";
2014-02-21 18:48:15 +00:00
public string Key => MetadataProviders.Tmdb.ToString();
2014-02-21 18:48:15 +00:00
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "tv/{0}";
2014-02-21 18:48:15 +00:00
public bool Supports(IHasProviderIds item)
{
return item is Series;
}
}
2014-02-21 21:44:10 +00:00
public class MovieDbMovieCollectionExternalId : IExternalId
{
public string Name => "TheMovieDb Collection";
2014-02-21 21:44:10 +00:00
public string Key => MetadataProviders.TmdbCollection.ToString();
2014-02-21 21:44:10 +00:00
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}";
2014-02-21 21:44:10 +00:00
public bool Supports(IHasProviderIds item)
{
2016-03-19 15:38:05 +00:00
return item is Movie || item is MusicVideo || item is Trailer;
2014-02-21 21:44:10 +00:00
}
}
2014-02-21 18:48:15 +00:00
public class MovieDbPersonExternalId : IExternalId
{
public string Name => "TheMovieDb";
2014-02-21 18:48:15 +00:00
public string Key => MetadataProviders.Tmdb.ToString();
2014-02-21 18:48:15 +00:00
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "person/{0}";
2014-02-21 18:48:15 +00:00
public bool Supports(IHasProviderIds item)
{
return item is Person;
}
}
public class MovieDbCollectionExternalId : IExternalId
{
public string Name => "TheMovieDb";
2014-02-21 18:48:15 +00:00
public string Key => MetadataProviders.Tmdb.ToString();
2014-02-21 18:48:15 +00:00
public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}";
2014-02-21 18:48:15 +00:00
public bool Supports(IHasProviderIds item)
{
return item is BoxSet;
}
}
public class ImdbExternalId : IExternalId
{
public string Name => "IMDb";
2014-02-21 18:48:15 +00:00
public string Key => MetadataProviders.Imdb.ToString();
2014-02-21 18:48:15 +00:00
public string UrlFormatString => "https://www.imdb.com/title/{0}";
2014-02-21 18:48:15 +00:00
public bool Supports(IHasProviderIds item)
{
2016-06-01 15:21:22 +00:00
// Supports images for tv movies
var tvProgram = item as LiveTvProgram;
if (tvProgram != null && tvProgram.IsMovie)
{
return true;
}
2016-03-19 15:38:05 +00:00
return item is Movie || item is MusicVideo || item is Series || item is Episode || item is Trailer;
2014-02-21 18:48:15 +00:00
}
}
public class ImdbPersonExternalId : IExternalId
{
public string Name => "IMDb";
2014-02-21 18:48:15 +00:00
public string Key => MetadataProviders.Imdb.ToString();
2014-02-21 18:48:15 +00:00
public string UrlFormatString => "https://www.imdb.com/name/{0}";
2014-02-21 18:48:15 +00:00
public bool Supports(IHasProviderIds item)
{
return item is Person;
}
}
}