TmdbUtils.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using MediaBrowser.Model.Entities;
  3. using MediaBrowser.Providers.Plugins.Tmdb.Models.General;
  4. namespace MediaBrowser.Providers.Plugins.Tmdb
  5. {
  6. /// <summary>
  7. /// Utilities for the TMDb provider.
  8. /// </summary>
  9. public static class TmdbUtils
  10. {
  11. /// <summary>
  12. /// URL of the TMDB instance to use.
  13. /// </summary>
  14. public const string BaseTmdbUrl = "https://www.themoviedb.org/";
  15. /// <summary>
  16. /// URL of the TMDB API instance to use.
  17. /// </summary>
  18. public const string BaseTmdbApiUrl = "https://api.themoviedb.org/";
  19. /// <summary>
  20. /// Name of the provider.
  21. /// </summary>
  22. public const string ProviderName = "TheMovieDb";
  23. /// <summary>
  24. /// API key to use when performing an API call.
  25. /// </summary>
  26. public const string ApiKey = "4219e299c89411838049ab0dab19ebd5";
  27. /// <summary>
  28. /// Value of the Accept header for requests to the provider.
  29. /// </summary>
  30. public const string AcceptHeader = "application/json,image/*";
  31. /// <summary>
  32. /// Maps the TMDB provided roles for crew members to Jellyfin roles.
  33. /// </summary>
  34. /// <param name="crew">Crew member to map against the Jellyfin person types.</param>
  35. /// <returns>The Jellyfin person type.</returns>
  36. public static string MapCrewToPersonType(Crew crew)
  37. {
  38. if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
  39. && crew.Job.Contains("director", StringComparison.InvariantCultureIgnoreCase))
  40. {
  41. return PersonType.Director;
  42. }
  43. if (crew.Department.Equals("production", StringComparison.InvariantCultureIgnoreCase)
  44. && crew.Job.Contains("producer", StringComparison.InvariantCultureIgnoreCase))
  45. {
  46. return PersonType.Producer;
  47. }
  48. if (crew.Department.Equals("writing", StringComparison.InvariantCultureIgnoreCase))
  49. {
  50. return PersonType.Writer;
  51. }
  52. return null;
  53. }
  54. }
  55. }