using System;
using System.Net.Mime;
using MediaBrowser.Model.Entities;
using MediaBrowser.Providers.Plugins.Tmdb.Models.General;
namespace MediaBrowser.Providers.Plugins.Tmdb
{
///
/// Utilities for the TMDb provider.
///
public static class TmdbUtils
{
///
/// URL of the TMDB instance to use.
///
public const string BaseTmdbUrl = "https://www.themoviedb.org/";
///
/// URL of the TMDB API instance to use.
///
public const string BaseTmdbApiUrl = "https://api.themoviedb.org/";
///
/// Name of the provider.
///
public const string ProviderName = "TheMovieDb";
///
/// API key to use when performing an API call.
///
public const string ApiKey = "4219e299c89411838049ab0dab19ebd5";
///
/// Value of the Accept header for requests to the provider.
///
public static readonly string[] AcceptHeaders = { MediaTypeNames.Application.Json, "image/*" };
///
/// Maps the TMDB provided roles for crew members to Jellyfin roles.
///
/// Crew member to map against the Jellyfin person types.
/// The Jellyfin person type.
public static string MapCrewToPersonType(Crew crew)
{
if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
&& crew.Job.Contains("director", StringComparison.InvariantCultureIgnoreCase))
{
return PersonType.Director;
}
if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
&& crew.Job.Contains("producer", StringComparison.InvariantCultureIgnoreCase))
{
return PersonType.Producer;
}
if (crew.Department.Equals("writing", StringComparison.InvariantCultureIgnoreCase))
{
return PersonType.Writer;
}
return null;
}
}
}