jellyfin/MediaBrowser.Providers/Movies/MovieExternalIds.cs

188 lines
4.4 KiB
C#
Raw Normal View History

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