[39] more batch edit fixes

pull/1760/head
meisnate12 12 months ago
parent 8afd78ea96
commit 3222135ba0

@ -1 +1 @@
1.19.1-develop38
1.19.1-develop39

@ -558,6 +558,8 @@ class Operations:
if self.library.mass_originally_available_update:
current_available = item.originallyAvailableAt
if current_available:
current_available = current_available.strftime("%Y-%m-%d")
has_edit = False
if self.library.mass_originally_available_update == "remove" and current_available:
if "originallyAvailableAt" not in remove_edits:
@ -585,14 +587,16 @@ class Operations:
new_available = mal_item.aired
else:
raise Failed
if not new_available:
logger.info("No Originally Available Date Found")
elif str(current_available) != str(new_available):
if str(new_available) not in available_edits:
available_edits[str(new_available)] = []
available_edits[str(new_available)].append(item.ratingKey)
item_edits += f"\nUpdate Originally Available Date (Batched) | {new_available.strftime('%Y-%m-%d')}"
if new_available:
new_available = new_available.strftime("%Y-%m-%d")
if current_available != new_available:
if new_available not in available_edits:
available_edits[new_available] = []
available_edits[new_available].append(item.ratingKey)
item_edits += f"\nUpdate Originally Available Date (Batched) | {new_available}"
has_edit = True
else:
logger.info("No Originally Available Date Found")
except Failed:
pass
@ -779,7 +783,7 @@ class Operations:
self.library.Plex.saveMultiEdits()
for new_available, rating_keys in sorted(available_edits.items()):
logger.info(get_batch_info("originallyAvailableAt", len(rating_keys), display_value=new_available.strftime("%Y-%m-%d"))) # noqa
logger.info(get_batch_info("originallyAvailableAt", len(rating_keys), display_value=new_available))
self.library.Plex.batchMultiEdits(self.library.load_list_from_cache(rating_keys))
self.library.Plex.editOriginallyAvailable(new_available)
self.library.Plex.saveMultiEdits()

@ -103,8 +103,8 @@ class TMDBObj:
self.vote_average = data["vote_average"] if isinstance(data, dict) else data.vote_average
self.language_iso = data["language_iso"] if isinstance(data, dict) else data.original_language.iso_639_1 if data.original_language else None
self.language_name = data["language_name"] if isinstance(data, dict) else data.original_language.english_name if data.original_language else None
self.genres = data["genres"].split("|") if isinstance(data, dict) else [g.name for g in data.genres if g]
self.keywords = data["keywords"].split("|") if isinstance(data, dict) else [k.name for k in data.keywords if k]
self.genres = [g for g in data["genres"].split("|") if g] if isinstance(data, dict) else [g.name for g in data.genres if g]
self.keywords = [k for k in data["keywords"].split("|") if k] if isinstance(data, dict) else [k.name for k in data.keywords if k]
class TMDbMovie(TMDBObj):

Loading…
Cancel
Save