From 3b3343fe07d4903a2a129b5a6ae8fa81e1b1443e Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 24 Mar 2022 15:28:23 -0400 Subject: [PATCH] [29] fix tmdb region error --- VERSION | 2 +- modules/builder.py | 2 +- modules/config.py | 3 ++- modules/tmdb.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 370a58cc..b35ce036 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.2-develop28 +1.16.2-develop29 diff --git a/modules/builder.py b/modules/builder.py index e6f3c2e6..cdc990da 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -788,7 +788,7 @@ class CollectionBuilder: else: logger.error(f"{self.Type} Error: Theme Path Does Not Exist: {os.path.abspath(method_data)}") elif method_name == "tmdb_region": - self.tmdb_region = util.parse(self.Type, method_name, str(method_data).upper(), options=self.config.TMDb.iso_3166_1) + self.tmdb_region = util.parse(self.Type, method_name, method_data, options=self.config.TMDb.iso_3166_1) elif method_name == "collection_mode": self.details[method_name] = util.check_collection_mode(method_data) elif method_name == "minimum_items": diff --git a/modules/config.py b/modules/config.py index e9d252df..9b05d7c8 100644 --- a/modules/config.py +++ b/modules/config.py @@ -381,7 +381,8 @@ class ConfigFile: "language": check_for_attribute(self.data, "language", parent="tmdb", default="en"), "expiration": check_for_attribute(self.data, "cache_expiration", parent="tmdb", var_type="int", default=60) }) - self.TMDb.region = check_for_attribute(self.data, "region", parent="tmdb", test_list=self.TMDb.iso_3166_1, default_is_none=True) + region = check_for_attribute(self.data, "region", parent="tmdb", test_list=self.TMDb.iso_3166_1, default_is_none=True) + self.TMDb.region = str(region).upper() if region else region logger.info(f"TMDb Connection {'Failed' if self.TMDb is None else 'Successful'}") else: raise Failed("Config Error: tmdb attribute not found") diff --git a/modules/tmdb.py b/modules/tmdb.py index 956949ec..d943a165 100644 --- a/modules/tmdb.py +++ b/modules/tmdb.py @@ -158,7 +158,7 @@ class TMDb: self.TMDb = TMDbAPIs(self.apikey, language=self.language, session=self.config.session) except TMDbException as e: raise Failed(f"TMDb Error: {e}") - self.iso_3166_1 = [i.upper() for i in self.TMDb._iso_3166_1] + self.iso_3166_1 = {iso: i.name for iso, i in self.TMDb._iso_3166_1.items()} def convert_from(self, tmdb_id, convert_to, is_movie): item = self.get_movie(tmdb_id) if is_movie else self.get_show(tmdb_id)