2019-08-18 04:20:52 -07:00
|
|
|
using System;
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
using MediaBrowser.Providers.Tmdb.Models.General;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Providers.Tmdb
|
|
|
|
{
|
2020-05-12 06:05:58 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Utilities for the TMDb provider
|
|
|
|
/// </summary>
|
2019-08-18 04:20:52 -07:00
|
|
|
public static class TmdbUtils
|
|
|
|
{
|
2020-05-12 06:05:58 -07:00
|
|
|
/// <summary>
|
|
|
|
/// URL of the TMDB instance to use.
|
|
|
|
/// </summary>
|
2019-08-18 04:34:44 -07:00
|
|
|
public const string BaseTmdbUrl = "https://www.themoviedb.org/";
|
2020-05-12 06:05:58 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// URL of the TMDB API instance to use.
|
|
|
|
/// </summary>
|
2019-08-18 04:34:44 -07:00
|
|
|
public const string BaseTmdbApiUrl = "https://api.themoviedb.org/";
|
2020-05-12 06:05:58 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Name of the provider.
|
|
|
|
/// </summary>
|
2019-08-18 04:20:52 -07:00
|
|
|
public const string ProviderName = "TheMovieDb";
|
2020-05-12 06:05:58 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// API key to use when performing an API call.
|
|
|
|
/// </summary>
|
2019-08-18 04:20:52 -07:00
|
|
|
public const string ApiKey = "4219e299c89411838049ab0dab19ebd5";
|
2020-05-12 06:05:58 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Value of the Accept header for requests to the provider.
|
|
|
|
/// </summary>
|
2019-08-18 04:20:52 -07:00
|
|
|
public const string AcceptHeader = "application/json,image/*";
|
|
|
|
|
2020-05-12 06:05:58 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Maps the TMDB provided roles for crew members to Jellyfin roles.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="crew">Crew member to map against the Jellyfin person types.</param>
|
|
|
|
/// <returns>The Jellyfin person type.</returns>
|
2019-08-18 04:20:52 -07:00
|
|
|
public static string MapCrewToPersonType(Crew crew)
|
|
|
|
{
|
2020-05-10 06:16:19 -07:00
|
|
|
if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
|
2020-05-12 06:05:58 -07:00
|
|
|
&& crew.Job.Contains("director", StringComparison.InvariantCultureIgnoreCase))
|
2020-05-10 06:16:19 -07:00
|
|
|
{
|
|
|
|
return PersonType.Director;
|
|
|
|
}
|
|
|
|
|
2019-08-18 05:44:13 -07:00
|
|
|
if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
|
2020-05-12 06:05:58 -07:00
|
|
|
&& crew.Job.Contains("producer", StringComparison.InvariantCultureIgnoreCase))
|
2019-08-18 04:20:52 -07:00
|
|
|
{
|
|
|
|
return PersonType.Producer;
|
|
|
|
}
|
|
|
|
|
2019-08-18 05:44:13 -07:00
|
|
|
if (crew.Department.Equals("writing", StringComparison.InvariantCultureIgnoreCase))
|
2019-08-18 04:20:52 -07:00
|
|
|
{
|
|
|
|
return PersonType.Writer;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|