[33] Add `ignore_locked` for Mass Poster/Background Update and `ignore_overlays` for Mass Poster Update (#2384)

pull/2387/head
YozoraXCII 7 days ago committed by GitHub Action
parent 8deafb10a6
commit 8f749eed6f

@ -11,6 +11,8 @@ Added the `character` search option to the `imdb_search` builder
Added ability to use Show-level ratings at the season and episode level for Overlays if the original source does not provide ratings at the season or episode level. This is accomplished using (Special Text Variables)[https://kometa.wiki/en/latest/files/overlays/#special-text-variables] but is not yet available for the `Ratings` Defaults file.
Add `show_unfiltered` setting to display items which make it through a filter
Allow `sync_to_trakt_list` on episode-level collections
When using `mass_poster_update`, added `ignore_locked` and `ignore_overlays` attributes which will prevent Kometa from resetting the image if the poster field is locked (i.e. a previous mass poster update) or if the item has an Overlay. This can effectively act as a differential update system.
When using `mass_background_update`, added `ignore_locked` attribute which will prevent Kometa from resetting the image if the poster field is locked (i.e. a previous mass poster update). This can effectively act as a differential update system.
# Docs
Added "getting started" page

@ -1 +1 @@
2.1.0-build32
2.1.0-build33

@ -495,10 +495,15 @@ You can create individual blocks of operations by using a list under `operations
<table class="clearTable">
<tr><td>`source`</td><td>Source of the poster update</td><td>`tmdb`, `plex`, `lock`, or `unlock`</td></tr>
<tr><td>`seasons`</td><td>Update season posters while updating shows **Default:** `true`</td><td>`true` (default) or `false`</td></tr>
<tr><td>`episodes`</td><td>Update episode posters while updating shows **Default:** `true`</td><td>`true` (default) or `false`</td></tr>
<tr><td>`seasons`</td><td>Update season posters while updating shows **Default:** `true`</td><td>`true` or `false`</td></tr>
<tr><td>`episodes`</td><td>Update episode posters while updating shows **Default:** `true`</td><td>`true` or `false`</td></tr>
<tr><td>`ignore_locked`</td><td>Skip updating image if the poster field is locked<sup>1</sup>.<br> **Default:** `false`</td><td>`true` or `false`</td></tr>
<tr><td>`ignore_overlays`</td><td>Skip updating image if the current image has an Overlay<sup>2</sup>.<br> **Default:** `false`</td><td>`true` or `false`</td></tr>
</table>
1. The poster field will be locked if a previous `mass_poster_update` was run or if an Overlay has been applied.
2. Kometa checks for the `Overlay` label on the item in Plex to determine if an Overlay is applied.
???+ example "Example"
```yaml
@ -531,10 +536,13 @@ You can create individual blocks of operations by using a list under `operations
<table class="clearTable">
<tr><td>`source`</td><td>Source of the poster update</td><td>`tmdb`, `plex`, `lock`, or `unlock`</td></tr>
<tr><td>`seasons`</td><td>Update season posters while updating shows **Default:** `true`</td><td>`true` (default) or `false`</td></tr>
<tr><td>`episodes`</td><td>Update episode posters while updating shows **Default:** `true`</td><td>`true` (default) or `false`</td></tr>
<tr><td>`seasons`</td><td>Update season posters while updating shows **Default:** `true`</td><td>`true` or `false`</td></tr>
<tr><td>`episodes`</td><td>Update episode posters while updating shows **Default:** `true`</td><td>`true` or `false`</td></tr>
<tr><td>`ignore_locked`</td><td>Skip updating image if the poster field is locked.<sup>1</sup> **Default:** `false`</td><td>`true` or `false`</td></tr>
</table>
1. The background field will be locked if a previous `mass_background_update` was run.
???+ example "Example"
```yaml

@ -941,6 +941,8 @@ class ConfigFile:
"source": check_for_attribute(input_dict, "source", test_list=mass_image_options, default_is_none=True, save=False),
"seasons": check_for_attribute(input_dict, "seasons", var_type="bool", default=True, save=False),
"episodes": check_for_attribute(input_dict, "episodes", var_type="bool", default=True, save=False),
"ignore_locked": check_for_attribute(input_dict, "ignore_locked", var_type="bool", default=False, save=False),
"ignore_overlays": check_for_attribute(input_dict, "ignore_overlays", var_type="bool", default=False, save=False)
}
elif op == "metadata_backup":
default_path = os.path.join(default_dir, f"{str(library_name)}_Metadata_Backup.yml")

@ -755,18 +755,44 @@ class Operations:
try:
new_poster, new_background, item_dir, name = self.library.find_item_assets(item)
except Failed:
item_dir = None
name = None
new_poster = None
new_background = None
new_poster, new_background, item_dir, name = None, None, None, None
try:
tmdb_item = tmdb_obj()
except Failed:
tmdb_item = None
if self.library.mass_poster_update:
self.library.poster_update(item, new_poster, tmdb=tmdb_item.poster_url if tmdb_item else None, title=item.title) # noqa
source = self.library.mass_poster_update["source"]
ignore_locked = self.library.mass_poster_update["ignore_locked"]
ignore_overlays = self.library.mass_poster_update.get("ignore_overlays")
thumb_locked = any(f.name == "thumb" and f.locked for f in item.fields)
labels = [la.tag for la in self.library.item_labels(item)]
has_overlay_label = "Overlay" in labels
# Bypass ignore_locked and ignore_overlays checks if the source is "unlock" or "lock"
if source in ["unlock", "lock"]:
self.library.poster_update(item, new_poster, tmdb=tmdb_item.poster_url if tmdb_item else None, title=item.title) # noqa
elif ignore_locked and thumb_locked:
# Skip processing if ignore_locked is True and thumb is locked
pass
elif ignore_overlays and has_overlay_label:
# Skip processing if ignore_overlays is True and Overlay label is found
pass
else:
self.library.poster_update(item, new_poster, tmdb=tmdb_item.poster_url if tmdb_item else None, title=item.title) # noqa
if self.library.mass_background_update:
self.library.background_update(item, new_background, tmdb=tmdb_item.backdrop_url if tmdb_item else None, title=item.title) # noqa
source = self.library.mass_background_update["source"]
ignore_locked = self.library.mass_background_update["ignore_locked"]
ignore_overlays = self.library.mass_poster_update["ignore_overlays"]
art_locked = any(f.name == "art" and f.locked for f in item.fields)
if source in ["unlock", "lock"]:
self.library.background_update(item, new_background, tmdb=tmdb_item.backdrop_url if tmdb_item else None, title=item.title) # noqa
elif not (ignore_locked and art_locked):
self.library.background_update(item, new_background, tmdb=tmdb_item.backdrop_url if tmdb_item else None, title=item.title) # noqa
if self.library.is_show and (
(self.library.mass_poster_update and

Loading…
Cancel
Save