mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2025-02-16 13:58:25 +00:00
[42] add reset_overlays option
This commit is contained in:
parent
11415b98cd
commit
9111f77c7f
7 changed files with 52 additions and 10 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.17.1-develop41
|
||||
1.17.1-develop42
|
||||
|
|
|
@ -154,7 +154,7 @@ libraries:
|
|||
|
||||
#### Remove Overlays
|
||||
|
||||
You can remove overlays from a library by adding `remove_overlays: true` to `overlay_path`.
|
||||
You can remove overlays from a library by adding `remove_overlays: true` to `overlay_path`. This will remove all overlays when run and not generate new ones.
|
||||
|
||||
```yaml
|
||||
libraries:
|
||||
|
@ -166,7 +166,33 @@ libraries:
|
|||
- file: config/Overlays.yml
|
||||
```
|
||||
|
||||
* This will remove all overlays when run and not generate new ones.
|
||||
#### Reapply Overlays
|
||||
|
||||
You can reapply overlays from a library by adding `reapply_overlays: true` to `overlay_path`. This will reapply overlays to every item in your library.
|
||||
|
||||
```yaml
|
||||
libraries:
|
||||
TV Shows:
|
||||
metadata_path:
|
||||
- file: config/TV Shows.yml
|
||||
overlay_path:
|
||||
- reapply_overlays: true
|
||||
- file: config/Overlays.yml
|
||||
```
|
||||
|
||||
#### Reset Overlays
|
||||
|
||||
You can reset overlays from a library by adding `reset_overlays` to `overlay_path` and setting it to either `tmdb` or `plex` depending on where you want to source the images from. This will use the reset image when overlaying items in your library.
|
||||
|
||||
```yaml
|
||||
libraries:
|
||||
TV Shows:
|
||||
metadata_path:
|
||||
- file: config/TV Shows.yml
|
||||
overlay_path:
|
||||
- reset_overlays: plex
|
||||
- file: config/Overlays.yml
|
||||
```
|
||||
|
||||
### Report Path
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ ignored_details = [
|
|||
"smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "test", "suppress_overlays",
|
||||
"delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "collection_level", "overlay",
|
||||
"validate_builders", "libraries", "sync_to_users", "collection_name", "playlist_name", "name", "blank_collection",
|
||||
"allowed_library_types", "delete_playlist"
|
||||
"allowed_library_types", "delete_playlist", "ignore_blank_results"
|
||||
]
|
||||
details = [
|
||||
"ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "collection_filtering", "collection_mode", "limit", "url_theme",
|
||||
|
@ -157,8 +157,7 @@ custom_sort_builders = [
|
|||
episode_parts_only = ["plex_pilots"]
|
||||
overlay_only = ["overlay", "suppress_overlays"]
|
||||
overlay_attributes = [
|
||||
"filters", "limit", "show_missing", "save_report", "missing_only_released", "minimum_items", "cache_builders",
|
||||
"tmdb_region", "default_percent", "ignore_blank_results"
|
||||
"filters", "limit", "show_missing", "save_report", "missing_only_released", "minimum_items", "cache_builders", "tmdb_region", "default_percent"
|
||||
] + all_builders + overlay_only
|
||||
parts_collection_valid = [
|
||||
"filters", "plex_all", "plex_search", "trakt_list", "trakt_list_details", "collection_filtering", "collection_mode", "label", "visible_library", "limit",
|
||||
|
|
|
@ -55,6 +55,7 @@ mass_rating_options = {
|
|||
"anidb_rating": "Use AniDB Rating",
|
||||
"anidb_average": "Use AniDB Average"
|
||||
}
|
||||
reset_overlay_options = {"tmdb": "Reset to TMDb poster", "plex": "Reset to Plex Poster"}
|
||||
|
||||
class ConfigFile:
|
||||
def __init__(self, default_dir, attrs):
|
||||
|
@ -783,6 +784,7 @@ class ConfigFile:
|
|||
params["overlay_path"] = []
|
||||
params["remove_overlays"] = False
|
||||
params["reapply_overlays"] = False
|
||||
params["reset_overlays"] = None
|
||||
if lib and "overlay_path" in lib:
|
||||
try:
|
||||
if not lib["overlay_path"]:
|
||||
|
@ -799,6 +801,15 @@ class ConfigFile:
|
|||
if ("reapply_overlays" in file and file["reapply_overlays"] is True) \
|
||||
or ("reapply_overlay" in file and file["reapply_overlay"] is True):
|
||||
params["reapply_overlays"] = True
|
||||
if "reset_overlays" in file or "reset_overlay" in file:
|
||||
attr = f"reset_overlay{'s' if 'reset_overlays' in file else ''}"
|
||||
if file[attr] and file[attr] in reset_overlay_options:
|
||||
params["reset_overlays"] = file[attr]
|
||||
else:
|
||||
final_text = f"Config Error: reset_overlays attribute {file[attr]} invalid. Options: "
|
||||
for option, description in reset_overlay_options.items():
|
||||
final_text = f"{final_text}\n {option} ({description})"
|
||||
logger.error(final_text)
|
||||
if "schedule" in file and file["schedule"]:
|
||||
logger.debug(f"Value: {file['schedule']}")
|
||||
err = None
|
||||
|
|
|
@ -93,6 +93,7 @@ class Library(ABC):
|
|||
self.remove_title_parentheses = params["remove_title_parentheses"]
|
||||
self.remove_overlays = params["remove_overlays"]
|
||||
self.reapply_overlays = params["reapply_overlays"]
|
||||
self.reset_overlays = params["reset_overlays"]
|
||||
self.mass_collection_mode = params["mass_collection_mode"]
|
||||
self.metadata_backup = params["metadata_backup"]
|
||||
self.genre_mapper = params["genre_mapper"]
|
||||
|
|
|
@ -898,7 +898,7 @@ class MetadataFile(DataFile):
|
|||
item = self.library.search_item(alt_title)
|
||||
|
||||
if item is None:
|
||||
logger.error(f"Skipping {mapping_name}: Item {mapping_name} not found")
|
||||
logger.error(f"Skipping {mapping_name}: Item {title} not found")
|
||||
continue
|
||||
if not isinstance(item, list):
|
||||
item = [item]
|
||||
|
|
|
@ -153,14 +153,19 @@ class Overlays:
|
|||
if image_compare and str(poster.compare) != str(image_compare):
|
||||
changed_image = True
|
||||
elif has_overlay:
|
||||
if os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png")):
|
||||
if self.library.reset_overlays is not None:
|
||||
if self.library.reset_overlays == "tmdb":
|
||||
new_backup = self.find_poster_url(item)
|
||||
else:
|
||||
posters = item.posters()
|
||||
if posters:
|
||||
new_backup = posters[0]
|
||||
elif os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png")):
|
||||
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.png")
|
||||
elif os.path.exists(os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")):
|
||||
has_original = os.path.join(self.library.overlay_backup, f"{item.ratingKey}.jpg")
|
||||
else:
|
||||
new_backup = self.find_poster_url(item)
|
||||
if new_backup is None:
|
||||
new_backup = item.posterUrl
|
||||
else:
|
||||
new_backup = item.posterUrl
|
||||
if new_backup:
|
||||
|
|
Loading…
Add table
Reference in a new issue