jellyfin/MediaBrowser.Providers/TV/TheTVDB/TvdbUtils.cs
2019-02-15 19:33:10 +01:00

37 lines
1.2 KiB
C#

using System;
using System.ComponentModel;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Providers.TV.TheTVDB
{
public static class TvdbUtils
{
public static readonly string TvdbApiKey = "OG4V3YJ3FAP7FP2K";
public static readonly string TvdbBaseUrl = "https://www.thetvdb.com/";
public static readonly string BannerUrl = TvdbBaseUrl + "banners/";
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();
}
}
}