diff --git a/.github/workflows/validate-pull.yml b/.github/workflows/validate-pull.yml index 63962ab1..ddfb55a9 100644 --- a/.github/workflows/validate-pull.yml +++ b/.github/workflows/validate-pull.yml @@ -56,7 +56,7 @@ jobs: done - name: Run Spellcheck - uses: rojopolis/spellcheck-github-actions@0.43.1 + uses: rojopolis/spellcheck-github-actions@0.44.0 docker-build-pull: runs-on: ubuntu-latest diff --git a/CHANGELOG b/CHANGELOG index be3ab109..36116fa9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,7 @@ # Requirements Update (requirements will need to be reinstalled) Update pillow requirement to 11.0.0 Update psutil requirement to 6.1.0 -Update setuptools requirement to 75.2.0 +Update setuptools requirement to 75.3.0 # New Features Added the `character` search option to the `imdb_search` builder @@ -9,6 +9,7 @@ Added the `character` search option to the `imdb_search` builder # Defaults Fixed incorrect content rating mappings in various Default files Fixes an issue where Prime Video overlays/collections would not be built when the `watch_region` is set to AU +fixes an issue where Rotten Tomatoes Verified Hot wasn't working # Bug Fixes Fixed the `cast` search option for the `imdb_search` builder @@ -17,3 +18,5 @@ Fixes `letterboxd_list` rating filter to use a 1-10 rating vs 1-100 to reflect h Fixes #2274 Enhance handling of smart collections in deletion Fixed the `ids_to_anidb` lookup for anime movies and shows Fixes an issue where episode overlays sometimes wouldn't be added +Fixes an issue with IMDb Parental Labels not working +Fixes an issue where OMDb returned `N/A` as the content rating \ No newline at end of file diff --git a/VERSION b/VERSION index 70448757..76d9f1d8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0-build10 +2.1.0-build11 diff --git a/defaults/overlays/ratings.yml b/defaults/overlays/ratings.yml index b9dccd2f..fd33ed14 100644 --- a/defaults/overlays/ratings.yml +++ b/defaults/overlays/ratings.yml @@ -124,7 +124,7 @@ templates: image_extra: default: "" conditions: - - rating<>_image: [imdb, rt_tomato, metacritic] + - rating<>_image: [imdb, rt_popcorn, rt_tomato, metacritic] image_level: Top value: Top - rating<>_image: [rt_popcorn, rt_tomato] diff --git a/modules/cache.py b/modules/cache.py index cbee7fc6..a0f58d1a 100644 --- a/modules/cache.py +++ b/modules/cache.py @@ -1035,11 +1035,11 @@ class Cache: cursor.execute("SELECT * FROM imdb_parental WHERE imdb_id = ?", (imdb_id,)) row = cursor.fetchone() if row: - imdb_dict["nudity"] = row["nudity"] if row["nudity"] else "None" - imdb_dict["violence"] = row["violence"] if row["violence"] else "None" - imdb_dict["profanity"] = row["profanity"] if row["profanity"] else "None" - imdb_dict["alcohol"] = row["alcohol"] if row["alcohol"] else "None" - imdb_dict["frightening"] = row["frightening"] if row["frightening"] else "None" + imdb_dict["Nudity"] = row["nudity"] if row["nudity"] else "None" + imdb_dict["Violence"] = row["violence"] if row["violence"] else "None" + imdb_dict["Profanity"] = row["profanity"] if row["profanity"] else "None" + imdb_dict["Alcohol"] = row["alcohol"] if row["alcohol"] else "None" + imdb_dict["Frightening"] = row["frightening"] if row["frightening"] else "None" datetime_object = datetime.strptime(row["expiration_date"], "%Y-%m-%d") time_between_insertion = datetime.now() - datetime_object expired = time_between_insertion.days > expiration @@ -1053,8 +1053,8 @@ class Cache: cursor.execute("INSERT OR IGNORE INTO imdb_parental(imdb_id) VALUES(?)", (imdb_id,)) update_sql = "UPDATE imdb_parental SET nudity = ?, violence = ?, profanity = ?, alcohol = ?, " \ "frightening = ?, expiration_date = ? WHERE imdb_id = ?" - cursor.execute(update_sql, (parental["nudity"], parental["violence"], parental["profanity"], parental["alcohol"], - parental["frightening"], expiration_date.strftime("%Y-%m-%d"), imdb_id)) + cursor.execute(update_sql, (parental["Nudity"], parental["Violence"], parental["Profanity"], parental["Alcohol"], + parental["Frightening"], expiration_date.strftime("%Y-%m-%d"), imdb_id)) def query_ergast(self, year, expiration): ergast_list = [] diff --git a/modules/imdb.py b/modules/imdb.py index dae82bd6..9dcc7a3b 100644 --- a/modules/imdb.py +++ b/modules/imdb.py @@ -523,13 +523,14 @@ class IMDb: parental_dict, expired = self.cache.query_imdb_parental(imdb_id, self.cache.expiration) if parental_dict and expired is False: return parental_dict - response = self._request(f"{base_url}/title/{imdb_id}/parentalguide") - for ptype in util.parental_types: - results = response.xpath(f"//section[@id='advisory-{ptype}']//span[contains(@class,'ipl-status-pill')]/text()") - if results: - parental_dict[ptype] = results[0].strip() - else: - raise Failed(f"IMDb Error: No Item Found for IMDb ID: {imdb_id}") + for e in self._request(f"{base_url}/title/{imdb_id}/parentalguide", xpath="//li[contains(@class, 'ipc-metadata-list-item--link')]"): + parental_dict[util.parental_types[e.xpath("a/text()")[0][:-1]]] = e.xpath("div/div/div/text()")[0] + if parental_dict: + for _, v in util.parental_types.items(): + if v not in parental_dict: + parental_dict[v] = None + else: + raise Failed(f"IMDb Error: No Parental Guide Found for IMDb ID: {imdb_id}") if self.cache and not ignore_cache: self.cache.update_imdb_parental(expired, imdb_id, parental_dict, self.cache.expiration) return parental_dict diff --git a/modules/omdb.py b/modules/omdb.py index 816cb98f..db8f93dd 100644 --- a/modules/omdb.py +++ b/modules/omdb.py @@ -23,6 +23,8 @@ class OMDbObj: return float(value) elif is_date: return datetime.strptime(value, "%d %b %Y") + elif value == "N/A": + return None else: return value except (ValueError, TypeError, KeyError): diff --git a/modules/operations.py b/modules/operations.py index 1a681cfc..b88fc150 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -163,7 +163,7 @@ class Operations: parental_labels = [] else: parental_guide = self.config.IMDb.parental_guide(imdb_id) - parental_labels = [f"{k.capitalize()}:{v}" for k, v in parental_guide.items() if v not in util.parental_levels[self.library.mass_imdb_parental_labels]] + parental_labels = [f"{k}:{v}" for k, v in parental_guide.items() if v and v not in util.parental_levels[self.library.mass_imdb_parental_labels]] add_labels = [la for la in parental_labels if la not in current_labels] remove_labels = [la for la in current_labels if la in util.parental_labels and la not in parental_labels] for label_list, edit_type in [(add_labels, "add"), (remove_labels, "remove")]: diff --git a/modules/util.py b/modules/util.py index 74f85df9..51f43ad3 100644 --- a/modules/util.py +++ b/modules/util.py @@ -111,10 +111,10 @@ collection_mode_options = { "show_items": "showItems", "showitems": "showItems" } image_content_types = ["image/png", "image/jpeg", "image/webp"] -parental_types = ["nudity", "violence", "profanity", "alcohol", "frightening"] +parental_types = {"Sex & Nudity": "Nudity", "Violence & Gore": "Violence", "Profanity": "Profanity", "Alcohol, Drugs & Smoking": "Alcohol", "Frightening & Intense Scenes": "Frightening"} parental_values = ["None", "Mild", "Moderate", "Severe"] parental_levels = {"none": [], "mild": ["None"], "moderate": ["None", "Mild"], "severe": ["None", "Mild", "Moderate"]} -parental_labels = [f"{t.capitalize()}:{v}" for t in parental_types for v in parental_values] +parental_labels = [f"{t}:{v}" for t in parental_types.values() for v in parental_values] previous_time = None start_time = None diff --git a/requirements.txt b/requirements.txt index 5b82cb7c..e16d6a36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,5 @@ requests==2.32.3 tenacity==9.0.0 ruamel.yaml==0.18.6 schedule==1.2.2 -setuptools==75.2.0 -tmdbapis==1.2.21 -pywin32==308; sys_platform == 'win32' +setuptools==75.3.0 +tmdbapis==1.2.21 \ No newline at end of file