2020-06-19 11:24:13 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-02-13 03:21:56 -07:00
|
|
|
using System;
|
|
|
|
using MediaBrowser.Model.Entities;
|
2020-03-09 07:53:07 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Providers.Plugins.TheTvdb
|
2019-02-13 03:21:56 -07:00
|
|
|
{
|
|
|
|
public static class TvdbUtils
|
|
|
|
{
|
2019-02-20 11:52:50 -07:00
|
|
|
public const string TvdbApiKey = "OG4V3YJ3FAP7FP2K";
|
|
|
|
public const string TvdbBaseUrl = "https://www.thetvdb.com/";
|
2020-07-15 07:45:14 -07:00
|
|
|
public const string TvdbImageBaseUrl = "https://www.thetvdb.com";
|
|
|
|
public const string BannerUrl = TvdbImageBaseUrl + "/banners/";
|
2019-02-13 03:21:56 -07:00
|
|
|
|
|
|
|
public static ImageType GetImageTypeFromKeyType(string keyType)
|
|
|
|
{
|
|
|
|
switch (keyType.ToLowerInvariant())
|
|
|
|
{
|
|
|
|
case "poster":
|
|
|
|
case "season": return ImageType.Primary;
|
|
|
|
case "series":
|
|
|
|
case "seasonwide": return ImageType.Banner;
|
|
|
|
case "fanart": return ImageType.Backdrop;
|
|
|
|
default: throw new ArgumentException($"Invalid or unknown keytype: {keyType}", nameof(keyType));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string NormalizeLanguage(string language)
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(language))
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// pt-br is just pt to tvdb
|
|
|
|
return language.Split('-')[0].ToLowerInvariant();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|