jellyfin-server/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs

65 lines
2.1 KiB
C#
Raw Normal View History

using System;
using MediaBrowser.Model.Entities;
2020-05-31 06:23:09 +00:00
using MediaBrowser.Providers.Plugins.Tmdb.Models.General;
2020-05-31 06:23:09 +00:00
namespace MediaBrowser.Providers.Plugins.Tmdb
{
2020-05-12 13:05:58 +00:00
/// <summary>
2020-05-31 06:28:01 +00:00
/// Utilities for the TMDb provider.
2020-05-12 13:05:58 +00:00
/// </summary>
public static class TmdbUtils
{
2020-05-12 13:05:58 +00:00
/// <summary>
/// URL of the TMDB instance to use.
/// </summary>
2019-08-18 11:34:44 +00:00
public const string BaseTmdbUrl = "https://www.themoviedb.org/";
2020-05-12 13:05:58 +00:00
/// <summary>
/// URL of the TMDB API instance to use.
/// </summary>
2019-08-18 11:34:44 +00:00
public const string BaseTmdbApiUrl = "https://api.themoviedb.org/";
2020-05-12 13:05:58 +00:00
/// <summary>
/// Name of the provider.
/// </summary>
public const string ProviderName = "TheMovieDb";
2020-05-12 13:05:58 +00:00
/// <summary>
/// API key to use when performing an API call.
/// </summary>
public const string ApiKey = "4219e299c89411838049ab0dab19ebd5";
2020-05-12 13:05:58 +00:00
/// <summary>
/// Value of the Accept header for requests to the provider.
/// </summary>
public const string AcceptHeader = "application/json,image/*";
2020-05-12 13:05:58 +00: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>
public static string MapCrewToPersonType(Crew crew)
{
2020-05-10 13:16:19 +00:00
if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
2020-05-12 13:05:58 +00:00
&& crew.Job.Contains("director", StringComparison.InvariantCultureIgnoreCase))
2020-05-10 13:16:19 +00:00
{
return PersonType.Director;
}
2019-08-18 12:44:13 +00:00
if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
2020-05-12 13:05:58 +00:00
&& crew.Job.Contains("producer", StringComparison.InvariantCultureIgnoreCase))
{
return PersonType.Producer;
}
2019-08-18 12:44:13 +00:00
if (crew.Department.Equals("writing", StringComparison.InvariantCultureIgnoreCase))
{
return PersonType.Writer;
}
return null;
}
}
}