aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins/TheTvdb/TvdbUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Providers/Plugins/TheTvdb/TvdbUtils.cs')
-rw-r--r--MediaBrowser.Providers/Plugins/TheTvdb/TvdbUtils.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbUtils.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbUtils.cs
new file mode 100644
index 000000000..79d879aa1
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbUtils.cs
@@ -0,0 +1,36 @@
+using System;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Providers.Plugins.TheTvdb
+{
+ public static class TvdbUtils
+ {
+ public const string TvdbApiKey = "OG4V3YJ3FAP7FP2K";
+ public const string TvdbBaseUrl = "https://www.thetvdb.com/";
+ public const 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();
+ }
+ }
+}