[34] fix plex_collectionless

This commit is contained in:
meisnate12 2022-06-10 09:53:16 -04:00
parent e7e3372ed4
commit 7eb8bc4e6b
7 changed files with 24 additions and 10 deletions

View file

@ -1 +1 @@
1.17.0-develop33
1.17.0-develop34

View file

@ -775,6 +775,7 @@ class ConfigFile:
params["overlay_path"] = []
params["remove_overlays"] = False
params["reapply_overlay"] = False
if lib and "overlay_path" in lib:
try:
if not lib["overlay_path"]:
@ -787,6 +788,8 @@ class ConfigFile:
if ("remove_overlays" in file and file["remove_overlays"] is True) \
or ("revert_overlays" in file and file["revert_overlays"] is True):
params["remove_overlays"] = True
if "reapply_overlay" in file and file["reapply_overlay"] is True:
params["reapply_overlay"] = True
if "schedule" in file and file["schedule"]:
logger.debug(f"Value: {file['schedule']}")
err = None

View file

@ -217,11 +217,18 @@ class IMDb:
with open(tsv, "r") as t:
if interface == "ratings":
return {line[0]: line[1] for line in csv.reader(t, delimiter="\t")}
data = {line[0]: line[1] for line in csv.reader(t, delimiter="\t")}
elif interface == "basics":
return {line[0]: str(line[-1]).split(",") for line in csv.reader(tsv, delimiter="\t")}
data = {line[0]: str(line[-1]).split(",") for line in csv.reader(tsv, delimiter="\t")}
else:
return [line for line in csv.reader(t, delimiter="\t")]
data = [line for line in csv.reader(t, delimiter="\t")]
if os.path.exists(gz):
os.remove(gz)
if os.path.exists(tsv):
os.remove(tsv)
return data
@property
def ratings(self):

View file

@ -92,6 +92,7 @@ class Library(ABC):
self.update_blank_track_titles = params["update_blank_track_titles"]
self.remove_title_parentheses = params["remove_title_parentheses"]
self.remove_overlays = params["remove_overlays"]
self.reapply_overlay = params["reapply_overlay"]
self.mass_collection_mode = params["mass_collection_mode"]
self.metadata_backup = params["metadata_backup"]
self.genre_mapper = params["genre_mapper"]

View file

@ -89,7 +89,7 @@ class Operations:
tmdb_id, tvdb_id, imdb_id = self.library.get_ids(item)
item.batchEdits()
batch_display = "Batch Edits"
batch_display = ""
if self.library.remove_title_parentheses:
if not any([f.name == "title" and f.locked for f in item.fields]) and item.title.endswith(")"):
@ -341,7 +341,8 @@ class Operations:
pass
item.saveEdits()
logger.info(batch_display)
if batch_display:
logger.info(f"Batch Edits{batch_display}")
episode_ops = [self.library.mass_episode_audience_rating_update, self.library.mass_episode_critic_rating_update, self.library.mass_episode_user_rating_update]

View file

@ -101,6 +101,8 @@ class Overlays:
if overlay.queue:
if overlay.queue not in queue_overlays:
queue_overlays[overlay.queue] = {}
if overlay.weight in queue_overlays[overlay.queue]:
raise Failed("Overlay Error: Overlays in a queue cannot have the same weight")
queue_overlays[overlay.queue][overlay.weight] = over_name
else:
applied_names.append(over_name)
@ -170,7 +172,7 @@ class Overlays:
poster_compare = None
if poster is None and has_original is None:
logger.error(f"{item_title[:60]:<60} | Overlay Error: No poster found")
elif changed_image or overlay_change:
elif self.library.reapply_overlay or changed_image or overlay_change:
try:
canvas_width = 1920 if isinstance(item, Episode) else 1000
canvas_height = 1080 if isinstance(item, Episode) else 1500

View file

@ -815,14 +815,14 @@ class Plex(Library):
logger.info("Collections Not Excluded (Items in these collections are not added to Collectionless)")
for col in good_collections:
logger.info(col.title)
collection_indexes = [c.index for c in good_collections]
logger.info("")
collection_indexes = [c.title for c in good_collections]
all_items = self.get_all()
for i, item in enumerate(all_items, 1):
logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}")
self.reload(item)
add_item = True
for collection in item.collections:
if collection.id in collection_indexes:
if collection.tag in collection_indexes:
add_item = False
break
if add_item: