mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-22 04:23:08 +00:00
[11] fix parental labels (#2300)
This commit is contained in:
parent
ca485c472c
commit
4fe23ef787
10 changed files with 28 additions and 22 deletions
2
.github/workflows/validate-pull.yml
vendored
2
.github/workflows/validate-pull.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.1.0-build10
|
||||
2.1.0-build11
|
||||
|
|
|
@ -124,7 +124,7 @@ templates:
|
|||
image_extra:
|
||||
default: ""
|
||||
conditions:
|
||||
- rating<<rating_num>>_image: [imdb, rt_tomato, metacritic]
|
||||
- rating<<rating_num>>_image: [imdb, rt_popcorn, rt_tomato, metacritic]
|
||||
image_level: Top
|
||||
value: Top
|
||||
- rating<<rating_num>>_image: [rt_popcorn, rt_tomato]
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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")]:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -12,5 +12,5 @@ requests==2.32.3
|
|||
tenacity==9.0.0
|
||||
ruamel.yaml==0.18.6
|
||||
schedule==1.2.2
|
||||
setuptools==75.2.0
|
||||
setuptools==75.3.0
|
||||
tmdbapis==1.2.21
|
Loading…
Reference in a new issue