|
|
|
@ -117,7 +117,7 @@ numbered_builders = [
|
|
|
|
|
"trakt_watched",
|
|
|
|
|
"trakt_collected"
|
|
|
|
|
]
|
|
|
|
|
smart_collection_invalid = ["collection_mode", "collection_order"]
|
|
|
|
|
smart_collection_invalid = ["collection_order"]
|
|
|
|
|
smart_url_collection_invalid = [
|
|
|
|
|
"run_again", "sync_mode", "show_filtered", "show_missing", "save_missing", "smart_label",
|
|
|
|
|
"radarr_add", "radarr_folder", "radarr_monitor", "radarr_availability",
|
|
|
|
@ -1098,35 +1098,57 @@ class CollectionBuilder:
|
|
|
|
|
logger.info("Validation Successful")
|
|
|
|
|
|
|
|
|
|
def collect_rating_keys(self):
|
|
|
|
|
filtered_keys = {}
|
|
|
|
|
name = self.obj.title if self.obj else self.name
|
|
|
|
|
def add_rating_keys(keys):
|
|
|
|
|
if not isinstance(keys, list):
|
|
|
|
|
keys = [keys]
|
|
|
|
|
self.rating_keys.extend([key for key in keys if key not in self.rating_keys])
|
|
|
|
|
total = len(keys)
|
|
|
|
|
max_length = len(str(total))
|
|
|
|
|
if self.filters and self.details["show_filtered"] is True:
|
|
|
|
|
logger.info("")
|
|
|
|
|
logger.info("Filtering Builder:")
|
|
|
|
|
for i, key in enumerate(keys, 1):
|
|
|
|
|
if key not in self.rating_keys:
|
|
|
|
|
if key in filtered_keys:
|
|
|
|
|
if self.details["show_filtered"] is True:
|
|
|
|
|
logger.info(f"{name} Collection | X | {filtered_keys[key]}")
|
|
|
|
|
else:
|
|
|
|
|
try:
|
|
|
|
|
current = self.fetch_item(key)
|
|
|
|
|
except Failed as e:
|
|
|
|
|
logger.error(e)
|
|
|
|
|
continue
|
|
|
|
|
current_title = f"{current.title} ({current.year})" if current.year else current.title
|
|
|
|
|
if self.check_filters(current, f"{(' ' * (max_length - len(str(i))))}{i}/{total}"):
|
|
|
|
|
self.rating_keys.append(key)
|
|
|
|
|
else:
|
|
|
|
|
if key not in filtered_keys:
|
|
|
|
|
filtered_keys[key] = current_title
|
|
|
|
|
if self.details["show_filtered"] is True:
|
|
|
|
|
logger.info(f"{name} Collection | X | {current_title}")
|
|
|
|
|
def check_map(input_ids):
|
|
|
|
|
movie_ids, show_ids = input_ids
|
|
|
|
|
items_found_inside = 0
|
|
|
|
|
if len(movie_ids) > 0:
|
|
|
|
|
items_found_inside += len(movie_ids)
|
|
|
|
|
for movie_id in movie_ids:
|
|
|
|
|
if movie_id in self.library.movie_map:
|
|
|
|
|
add_rating_keys(self.library.movie_map[movie_id])
|
|
|
|
|
elif movie_id not in self.missing_movies:
|
|
|
|
|
self.missing_movies.append(movie_id)
|
|
|
|
|
if len(show_ids) > 0:
|
|
|
|
|
items_found_inside += len(show_ids)
|
|
|
|
|
for show_id in show_ids:
|
|
|
|
|
if show_id in self.library.show_map:
|
|
|
|
|
add_rating_keys(self.library.show_map[show_id])
|
|
|
|
|
elif show_id not in self.missing_shows:
|
|
|
|
|
self.missing_shows.append(show_id)
|
|
|
|
|
return items_found_inside
|
|
|
|
|
for method, values in self.methods:
|
|
|
|
|
logger.debug("")
|
|
|
|
|
logger.debug(f"Method: {method}")
|
|
|
|
|
logger.debug(f"Values: {values}")
|
|
|
|
|
for value in values:
|
|
|
|
|
def check_map(input_ids):
|
|
|
|
|
movie_ids, show_ids = input_ids
|
|
|
|
|
items_found_inside = 0
|
|
|
|
|
if len(movie_ids) > 0:
|
|
|
|
|
items_found_inside += len(movie_ids)
|
|
|
|
|
for movie_id in movie_ids:
|
|
|
|
|
if movie_id in self.library.movie_map:
|
|
|
|
|
add_rating_keys(self.library.movie_map[movie_id])
|
|
|
|
|
elif movie_id not in self.missing_movies:
|
|
|
|
|
self.missing_movies.append(movie_id)
|
|
|
|
|
if len(show_ids) > 0:
|
|
|
|
|
items_found_inside += len(show_ids)
|
|
|
|
|
for show_id in show_ids:
|
|
|
|
|
if show_id in self.library.show_map:
|
|
|
|
|
add_rating_keys(self.library.show_map[show_id])
|
|
|
|
|
elif show_id not in self.missing_shows:
|
|
|
|
|
self.missing_shows.append(show_id)
|
|
|
|
|
return items_found_inside
|
|
|
|
|
logger.debug("")
|
|
|
|
|
logger.debug(f"Value: {value}")
|
|
|
|
|
logger.debug(f"Builder: {method}: {value}")
|
|
|
|
|
logger.info("")
|
|
|
|
|
if "plex" in method: add_rating_keys(self.library.get_items(method, value))
|
|
|
|
|
elif "tautulli" in method: add_rating_keys(self.library.Tautulli.get_items(self.library, value))
|
|
|
|
@ -1409,16 +1431,14 @@ class CollectionBuilder:
|
|
|
|
|
logger.error(e)
|
|
|
|
|
continue
|
|
|
|
|
current_title = f"{current.title} ({current.year})" if current.year else current.title
|
|
|
|
|
if self.check_filters(current, f"{(' ' * (max_length - len(str(i))))}{i}/{total}"):
|
|
|
|
|
logger.info(util.adjust_space(f"{name} Collection | {'=' if current in collection_items else '+'} | {current_title}"))
|
|
|
|
|
if current in collection_items:
|
|
|
|
|
self.plex_map[current.ratingKey] = None
|
|
|
|
|
elif self.smart_label_collection:
|
|
|
|
|
self.library.query_data(current.addLabel, name)
|
|
|
|
|
else:
|
|
|
|
|
self.library.query_data(current.addCollection, name)
|
|
|
|
|
elif self.details["show_filtered"] is True:
|
|
|
|
|
logger.info(f"{name} Collection | X | {current_title}")
|
|
|
|
|
current_operation = "=" if current in collection_items else "+"
|
|
|
|
|
logger.info(util.adjust_space(f"{name} Collection | {current_operation} | {current_title}"))
|
|
|
|
|
if current in collection_items:
|
|
|
|
|
self.plex_map[current.ratingKey] = None
|
|
|
|
|
elif self.smart_label_collection:
|
|
|
|
|
self.library.query_data(current.addLabel, name)
|
|
|
|
|
else:
|
|
|
|
|
self.library.query_data(current.addCollection, name)
|
|
|
|
|
media_type = f"{'Movie' if self.library.is_movie else 'Show'}{'s' if total > 1 else ''}"
|
|
|
|
|
util.print_end()
|
|
|
|
|
logger.info("")
|
|
|
|
|