mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-22 20:43:07 +00:00
[111] update mass_imdb_parental_labels
This commit is contained in:
parent
41dc1ae651
commit
4b154645a7
7 changed files with 43 additions and 22 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.18.3-develop110
|
||||
1.18.3-develop111
|
||||
|
|
|
@ -266,16 +266,18 @@ Updates every item's background to the chosen sites background. Will fallback to
|
|||
|
||||
## Mass IMDb Parental Labels
|
||||
|
||||
Updates every item's labels in the library to match the IMDb Parental Guide
|
||||
Updates every item's labels in the library to match the IMDb Parental Guide.
|
||||
|
||||
**Attribute:** `mass_imdb_parental_labels`
|
||||
|
||||
**Values:**
|
||||
|
||||
| Value | Description |
|
||||
|:---------------|:--------------------------------------------------------------------------------------------------------------------|
|
||||
| `with_none` | Apply all Parental Labels regardless of value |
|
||||
| `without_none` | Only apply Parental Labels if the value is not none (i.e. do not apply "Sex & Nudity" label if the value is "None") |
|
||||
|:-----------|:----------------------------------------------------------------------------------|
|
||||
| `none` | Apply all Parental Labels with a value of `None`, `Mild`, `Moderate`, or `Severe` |
|
||||
| `mild` | Apply all Parental Labels with a value of `Mild`, `Moderate`, or `Severe` |
|
||||
| `moderate` | Apply all Parental Labels with a value of `Moderate` or `Severe` |
|
||||
| `severe` | Apply all Parental Labels with a value of `Severe` |
|
||||
|
||||
## Mass Collection Mode
|
||||
|
||||
|
|
|
@ -33,7 +33,12 @@ from retrying import retry
|
|||
logger = util.logger
|
||||
|
||||
sync_modes = {"append": "Only Add Items to the Collection or Playlist", "sync": "Add & Remove Items from the Collection or Playlist"}
|
||||
imdb_label_options = {"with_none": "Add IMDb Parental Labels including None", "without_none": "Add IMDb Parental Labels including None"}
|
||||
imdb_label_options = {
|
||||
"none": "Add IMDb Parental Labels for None, Mild, Moderate, or Severe",
|
||||
"mild": "Add IMDb Parental Labels for Mild, Moderate, or Severe",
|
||||
"moderate": "Add IMDb Parental Labels for Moderate or Severe",
|
||||
"severe": "Add IMDb Parental Labels for Severe"
|
||||
}
|
||||
mass_genre_options = {
|
||||
"lock": "Unlock Genre", "unlock": "Unlock Genre", "remove": "Remove and Lock Genre", "reset": "Remove and Unlock Genre",
|
||||
"tmdb": "Use TMDb Genres", "imdb": "Use IMDb Genres", "omdb": "Use IMDb Genres through OMDb", "tvdb": "Use TVDb Genres",
|
||||
|
@ -99,7 +104,8 @@ library_operations = {
|
|||
"mass_critic_rating_update": mass_rating_options, "mass_episode_critic_rating_update": mass_episode_rating_options,
|
||||
"mass_user_rating_update": mass_rating_options, "mass_episode_user_rating_update": mass_episode_rating_options,
|
||||
"mass_original_title_update": mass_original_title_options, "mass_originally_available_update": mass_available_options,
|
||||
"mass_imdb_parental_labels": imdb_label_options, "mass_poster_update": mass_image_options, "mass_background_update": mass_image_options,
|
||||
"mass_imdb_parental_labels": imdb_label_options, "mass_episode_imdb_parental_labels": imdb_label_options,
|
||||
"mass_poster_update": mass_image_options, "mass_background_update": mass_image_options,
|
||||
"mass_collection_mode": "mass_collection_mode", "metadata_backup": "metadata_backup", "delete_collections": "delete_collections",
|
||||
"genre_mapper": "mapper", "content_rating_mapper": "mapper",
|
||||
}
|
||||
|
@ -212,6 +218,11 @@ class ConfigFile:
|
|||
self.data["libraries"][library]["operations"]["radarr_add_all_existing"] = self.data["libraries"][library]["operations"].pop("radarr_add_all")
|
||||
if "sonarr_add_all" in self.data["libraries"][library]["operations"]:
|
||||
self.data["libraries"][library]["operations"]["sonarr_add_all_existing"] = self.data["libraries"][library]["operations"].pop("sonarr_add_all")
|
||||
if "mass_imdb_parental_labels" in self.data["libraries"][library]["operations"] and self.data["libraries"][library]["operations"]["mass_imdb_parental_labels"]:
|
||||
if self.data["libraries"][library]["operations"]["mass_imdb_parental_labels"] == "with_none":
|
||||
self.data["libraries"][library]["operations"]["mass_imdb_parental_labels"] = "none"
|
||||
elif self.data["libraries"][library]["operations"]["mass_imdb_parental_labels"] == "without_none":
|
||||
self.data["libraries"][library]["operations"]["mass_imdb_parental_labels"] = "mild"
|
||||
if "webhooks" in self.data["libraries"][library] and self.data["libraries"][library]["webhooks"] and "collection_changes" not in self.data["libraries"][library]["webhooks"]:
|
||||
changes = []
|
||||
def hooks(attr):
|
||||
|
|
|
@ -88,6 +88,7 @@ class Library(ABC):
|
|||
self.mass_original_title_update = params["mass_original_title_update"]
|
||||
self.mass_originally_available_update = params["mass_originally_available_update"]
|
||||
self.mass_imdb_parental_labels = params["mass_imdb_parental_labels"]
|
||||
self.mass_episode_imdb_parental_labels = params["mass_episode_imdb_parental_labels"]
|
||||
self.mass_poster_update = params["mass_poster_update"]
|
||||
self.mass_background_update = params["mass_background_update"]
|
||||
self.radarr_add_all_existing = params["radarr_add_all_existing"]
|
||||
|
@ -115,12 +116,13 @@ class Library(ABC):
|
|||
or self.mass_audience_rating_update or self.mass_critic_rating_update or self.mass_user_rating_update \
|
||||
or self.mass_episode_audience_rating_update or self.mass_episode_critic_rating_update or self.mass_episode_user_rating_update \
|
||||
or self.mass_content_rating_update or self.mass_originally_available_update or self.mass_original_title_update\
|
||||
or self.mass_imdb_parental_labels or self.genre_mapper or self.content_rating_mapper or self.mass_studio_update\
|
||||
or self.mass_imdb_parental_labels or self.mass_episode_imdb_parental_labels or self.genre_mapper or self.content_rating_mapper or self.mass_studio_update\
|
||||
or self.radarr_add_all_existing or self.sonarr_add_all_existing or self.mass_poster_update or self.mass_background_update else False
|
||||
self.library_operation = True if self.items_library_operation or self.delete_collections or self.mass_collection_mode \
|
||||
or self.radarr_remove_by_tag or self.sonarr_remove_by_tag or self.show_unmanaged or self.show_unconfigured \
|
||||
or self.metadata_backup or self.update_blank_track_titles else False
|
||||
self.meta_operations = [i for i in [getattr(self, o) for o in operations.meta_operations] if i]
|
||||
self.label_operations = True if self.library.assets_for_all or self.library.mass_imdb_parental_labels or self.mass_episode_imdb_parental_labels else False
|
||||
|
||||
if self.asset_directory:
|
||||
logger.info("")
|
||||
|
|
|
@ -38,6 +38,7 @@ class Operations:
|
|||
logger.debug(f"Mass Original Title Update: {self.library.mass_original_title_update}")
|
||||
logger.debug(f"Mass Originally Available Update: {self.library.mass_originally_available_update}")
|
||||
logger.debug(f"Mass IMDb Parental Labels: {self.library.mass_imdb_parental_labels}")
|
||||
logger.debug(f"Mass Episode IMDb Parental Labels: {self.library.mass_episode_imdb_parental_labels}")
|
||||
logger.debug(f"Mass Poster Update: {self.library.mass_poster_update}")
|
||||
logger.debug(f"Mass Background Update: {self.library.mass_background_update}")
|
||||
logger.debug(f"Mass Collection Mode Update: {self.library.mass_collection_mode}")
|
||||
|
@ -95,7 +96,7 @@ class Operations:
|
|||
continue
|
||||
logger.info("")
|
||||
logger.info(f"Processing: {i}/{len(items)} {item.title}")
|
||||
current_labels = [la.tag for la in self.library.item_labels(item)] if self.library.assets_for_all or self.library.mass_imdb_parental_labels else []
|
||||
current_labels = [la.tag for la in self.library.item_labels(item)] if self.library.label_operations else []
|
||||
|
||||
if self.library.assets_for_all and self.library.asset_directory:
|
||||
self.library.find_and_upload_assets(item, current_labels)
|
||||
|
@ -116,7 +117,7 @@ class Operations:
|
|||
if self.library.mass_imdb_parental_labels:
|
||||
try:
|
||||
parental_guide = self.config.IMDb.parental_guide(imdb_id)
|
||||
parental_labels = [f"{k.capitalize()}:{v}" for k, v in parental_guide.items() if self.library.mass_imdb_parental_labels == "with_none" or v != "None"]
|
||||
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]]
|
||||
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]
|
||||
if add_labels or remove_labels:
|
||||
|
@ -555,7 +556,10 @@ class Operations:
|
|||
if self.library.mass_background_update:
|
||||
self.library.background_update(episode, episode_background, title=episode.title if episode else None)
|
||||
|
||||
episode_ops = [self.library.mass_episode_audience_rating_update, self.library.mass_episode_critic_rating_update, self.library.mass_episode_user_rating_update]
|
||||
episode_ops = [
|
||||
self.library.mass_episode_audience_rating_update, self.library.mass_episode_critic_rating_update,
|
||||
self.library.mass_episode_user_rating_update, self.library.mass_episode_imdb_parental_labels
|
||||
]
|
||||
|
||||
if any([x is not None for x in episode_ops]):
|
||||
|
||||
|
@ -564,6 +568,7 @@ class Operations:
|
|||
|
||||
for ep in item.episodes():
|
||||
#ep.batchEdits()
|
||||
ep = self.library.reload(ep)
|
||||
batch_display = ""
|
||||
item_title = self.library.get_item_sort_title(ep, atr="title")
|
||||
logger.info("")
|
||||
|
|
|
@ -296,7 +296,7 @@ class Overlays:
|
|||
try:
|
||||
overlay_image, addon_box = current_overlay.get_backdrop((canvas_width, canvas_height), box=image_box, text=get_text(current_overlay))
|
||||
except Failed as e:
|
||||
logger.warning(e)
|
||||
logger.warning(f" {e}")
|
||||
continue
|
||||
new_poster.paste(overlay_image, (0, 0), overlay_image)
|
||||
else:
|
||||
|
@ -331,7 +331,7 @@ class Overlays:
|
|||
try:
|
||||
overlay_image, addon_box = current_overlay.get_backdrop((canvas_width, canvas_height), box=image_box, text=get_text(current_overlay), new_cords=cord)
|
||||
except Failed as e:
|
||||
logger.warning(e)
|
||||
logger.warning(f" {e}")
|
||||
continue
|
||||
new_poster.paste(overlay_image, (0, 0), overlay_image)
|
||||
if current_overlay.image:
|
||||
|
|
|
@ -99,6 +99,7 @@ collection_mode_options = {
|
|||
}
|
||||
parental_types = ["nudity", "violence", "profanity", "alcohol", "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]
|
||||
previous_time = None
|
||||
start_time = None
|
||||
|
|
Loading…
Reference in a new issue