diff options
| author | crobibero <cody@robibe.ro> | 2020-06-13 15:20:13 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-06-13 15:20:13 -0600 |
| commit | bcce8190ffe6cf2b4926c64bca98b8266c0937b0 (patch) | |
| tree | 7008786b1e0631445437f451cc6422b4be9a5f0d /MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs | |
| parent | 88b6c26472ad57822d3ab79a043db259ffcbb0e3 (diff) | |
| parent | 0011e8df47380936742302ef40639a4626a780ed (diff) | |
Merge remote-tracking branch 'upstream/api-migration' into api-channel
Diffstat (limited to 'MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs')
| -rw-r--r-- | MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs new file mode 100644 index 000000000..2f1e8b791 --- /dev/null +++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs @@ -0,0 +1,64 @@ +using System; +using MediaBrowser.Model.Entities; +using MediaBrowser.Providers.Plugins.Tmdb.Models.General; + +namespace MediaBrowser.Providers.Plugins.Tmdb +{ + /// <summary> + /// Utilities for the TMDb provider. + /// </summary> + public static class TmdbUtils + { + /// <summary> + /// URL of the TMDB instance to use. + /// </summary> + public const string BaseTmdbUrl = "https://www.themoviedb.org/"; + + /// <summary> + /// URL of the TMDB API instance to use. + /// </summary> + public const string BaseTmdbApiUrl = "https://api.themoviedb.org/"; + + /// <summary> + /// Name of the provider. + /// </summary> + public const string ProviderName = "TheMovieDb"; + + /// <summary> + /// API key to use when performing an API call. + /// </summary> + public const string ApiKey = "4219e299c89411838049ab0dab19ebd5"; + + /// <summary> + /// Value of the Accept header for requests to the provider. + /// </summary> + public const string AcceptHeader = "application/json,image/*"; + + /// <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) + { + 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; + } + } +} |
