|
|
@ -322,19 +322,24 @@ class CollectionBuilder:
|
|
|
|
elif data[m][f] is None:
|
|
|
|
elif data[m][f] is None:
|
|
|
|
raise Failed(f"Collection Error: {filter_method} filter is blank")
|
|
|
|
raise Failed(f"Collection Error: {filter_method} filter is blank")
|
|
|
|
elif filter_method == "year":
|
|
|
|
elif filter_method == "year":
|
|
|
|
self.filters.append((filter_method, util.get_year_list(data[m][f], f"{filter_method} filter")))
|
|
|
|
filter_data = util.get_year_list(data[m][f], f"{filter_method} filter")
|
|
|
|
elif filter_method in ["max_age", "duration.gte", "duration.lte"]:
|
|
|
|
elif filter_method in ["max_age", "duration.gte", "duration.lte", "tmdb_vote_count.gte", "tmdb_vote_count.lte"]:
|
|
|
|
self.filters.append((filter_method, util.check_number(data[m][f], f"{filter_method} filter", minimum=1)))
|
|
|
|
filter_data = util.check_number(data[m][f], f"{filter_method} filter", minimum=1)
|
|
|
|
elif filter_method in ["year.gte", "year.lte"]:
|
|
|
|
elif filter_method in ["year.gte", "year.lte"]:
|
|
|
|
self.filters.append((filter_method, util.check_number(data[m][f], f"{filter_method} filter", minimum=1800, maximum=current_year)))
|
|
|
|
filter_data = util.check_number(data[m][f], f"{filter_method} filter", minimum=1800, maximum=current_year)
|
|
|
|
elif filter_method in ["rating.gte", "rating.lte"]:
|
|
|
|
elif filter_method in ["rating.gte", "rating.lte"]:
|
|
|
|
self.filters.append((filter_method, util.check_number(data[m][f], f"{filter_method} filter", number_type="float", minimum=0.1, maximum=10)))
|
|
|
|
filter_data = util.check_number(data[m][f], f"{filter_method} filter", number_type="float", minimum=0.1, maximum=10)
|
|
|
|
elif filter_method in ["originally_available.gte", "originally_available.lte"]:
|
|
|
|
elif filter_method in ["originally_available.gte", "originally_available.lte"]:
|
|
|
|
self.filters.append((filter_method, util.check_date(data[m][f], f"{filter_method} filter")))
|
|
|
|
filter_data = util.check_date(data[m][f], f"{filter_method} filter")
|
|
|
|
|
|
|
|
elif filter_method == "original_language":
|
|
|
|
|
|
|
|
filter_data = util.get_list(data[m][f], lower=True)
|
|
|
|
|
|
|
|
elif filter_method == "collection":
|
|
|
|
|
|
|
|
filter_data = data[m][f] if isinstance(data[m][f], list) else [data[m][f]]
|
|
|
|
elif filter_method in util.all_filters:
|
|
|
|
elif filter_method in util.all_filters:
|
|
|
|
self.filters.append((filter_method, data[m][f]))
|
|
|
|
filter_data = util.get_list(data[m][f])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Failed(f"Collection Error: {filter_method} filter not supported")
|
|
|
|
raise Failed(f"Collection Error: {filter_method} filter not supported")
|
|
|
|
|
|
|
|
self.filters.append((filter_method, filter_data))
|
|
|
|
elif method_name == "plex_collectionless":
|
|
|
|
elif method_name == "plex_collectionless":
|
|
|
|
new_dictionary = {}
|
|
|
|
new_dictionary = {}
|
|
|
|
prefix_list = []
|
|
|
|
prefix_list = []
|
|
|
@ -613,28 +618,32 @@ class CollectionBuilder:
|
|
|
|
|
|
|
|
|
|
|
|
if len(missing_movies) > 0 or len(missing_shows) > 0:
|
|
|
|
if len(missing_movies) > 0 or len(missing_shows) > 0:
|
|
|
|
logger.info("")
|
|
|
|
logger.info("")
|
|
|
|
if len(missing_movies) > 0:
|
|
|
|
arr_filters = []
|
|
|
|
not_lang = None
|
|
|
|
|
|
|
|
terms = None
|
|
|
|
|
|
|
|
for filter_method, filter_data in self.filters:
|
|
|
|
for filter_method, filter_data in self.filters:
|
|
|
|
if filter_method.startswith("original_language"):
|
|
|
|
if (filter_method.startswith("original_language") and self.library.is_movie) or filter_method.startswith("tmdb_vote_count"):
|
|
|
|
terms = util.get_list(filter_data, lower=True)
|
|
|
|
arr_filters.append((filter_method, filter_data))
|
|
|
|
not_lang = filter_method.endswith(".not")
|
|
|
|
if len(missing_movies) > 0:
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
missing_movies_with_names = []
|
|
|
|
missing_movies_with_names = []
|
|
|
|
for missing_id in missing_movies:
|
|
|
|
for missing_id in missing_movies:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
movie = self.config.TMDb.get_movie(missing_id)
|
|
|
|
movie = self.config.TMDb.get_movie(missing_id)
|
|
|
|
title = str(movie.title)
|
|
|
|
|
|
|
|
if not_lang is None or (not_lang is True and movie.original_language not in terms) or (not_lang is False and movie.original_language in terms):
|
|
|
|
|
|
|
|
missing_movies_with_names.append((title, missing_id))
|
|
|
|
|
|
|
|
if self.details["show_missing"] is True:
|
|
|
|
|
|
|
|
logger.info(f"{collection_name} Collection | ? | {title} (TMDb: {missing_id})")
|
|
|
|
|
|
|
|
elif self.details["show_filtered"] is True:
|
|
|
|
|
|
|
|
logger.info(f"{collection_name} Collection | X | {title} (TMDb: {missing_id})")
|
|
|
|
|
|
|
|
except Failed as e:
|
|
|
|
except Failed as e:
|
|
|
|
logger.error(e)
|
|
|
|
logger.error(e)
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
match = True
|
|
|
|
|
|
|
|
for filter_method, filter_data in arr_filters:
|
|
|
|
|
|
|
|
if (filter_method == "original_language" and movie.original_language not in filter_data) \
|
|
|
|
|
|
|
|
or (filter_method == "original_language.not" and movie.original_language in filter_data) \
|
|
|
|
|
|
|
|
or (filter_method == "tmdb_vote_count.gte" and movie.vote_count < filter_data) \
|
|
|
|
|
|
|
|
or (filter_method == "tmdb_vote_count.lte" and movie.vote_count > filter_data):
|
|
|
|
|
|
|
|
match = False
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
if match:
|
|
|
|
|
|
|
|
missing_movies_with_names.append((movie.title, missing_id))
|
|
|
|
|
|
|
|
if self.details["show_missing"] is True:
|
|
|
|
|
|
|
|
logger.info(f"{collection_name} Collection | ? | {movie.title} (TMDb: {missing_id})")
|
|
|
|
|
|
|
|
elif self.details["show_filtered"] is True:
|
|
|
|
|
|
|
|
logger.info(f"{collection_name} Collection | X | {movie.title} (TMDb: {missing_id})")
|
|
|
|
logger.info(f"{len(missing_movies_with_names)} Movie{'s' if len(missing_movies_with_names) > 1 else ''} Missing")
|
|
|
|
logger.info(f"{len(missing_movies_with_names)} Movie{'s' if len(missing_movies_with_names) > 1 else ''} Missing")
|
|
|
|
if self.details["save_missing"] is True:
|
|
|
|
if self.details["save_missing"] is True:
|
|
|
|
self.library.add_missing(collection_name, missing_movies_with_names, True)
|
|
|
|
self.library.add_missing(collection_name, missing_movies_with_names, True)
|
|
|
@ -645,11 +654,23 @@ class CollectionBuilder:
|
|
|
|
for missing_id in missing_shows:
|
|
|
|
for missing_id in missing_shows:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
title = str(self.config.TVDb.get_series(self.library.Plex.language, tvdb_id=missing_id).title.encode("ascii", "replace").decode())
|
|
|
|
title = str(self.config.TVDb.get_series(self.library.Plex.language, tvdb_id=missing_id).title.encode("ascii", "replace").decode())
|
|
|
|
|
|
|
|
except Failed as e:
|
|
|
|
|
|
|
|
logger.error(e)
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
match = True
|
|
|
|
|
|
|
|
if arr_filters:
|
|
|
|
|
|
|
|
show = self.config.TMDb.get_show(self.config.TMDb.convert_tvdb_to_tmdb(missing_id))
|
|
|
|
|
|
|
|
for filter_method, filter_data in arr_filters:
|
|
|
|
|
|
|
|
if (filter_method == "tmdb_vote_count.gte" and show.vote_count < filter_data) \
|
|
|
|
|
|
|
|
or (filter_method == "tmdb_vote_count.lte" and show.vote_count > filter_data):
|
|
|
|
|
|
|
|
match = False
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
if match:
|
|
|
|
missing_shows_with_names.append((title, missing_id))
|
|
|
|
missing_shows_with_names.append((title, missing_id))
|
|
|
|
if self.details["show_missing"] is True:
|
|
|
|
if self.details["show_missing"] is True:
|
|
|
|
logger.info(f"{collection_name} Collection | ? | {title} (TVDB: {missing_id})")
|
|
|
|
logger.info(f"{collection_name} Collection | ? | {title} (TVDB: {missing_id})")
|
|
|
|
except Failed as e:
|
|
|
|
elif self.details["show_filtered"] is True:
|
|
|
|
logger.error(e)
|
|
|
|
logger.info(f"{collection_name} Collection | X | {title} (TMDb: {missing_id})")
|
|
|
|
logger.info(f"{len(missing_shows_with_names)} Show{'s' if len(missing_shows_with_names) > 1 else ''} Missing")
|
|
|
|
logger.info(f"{len(missing_shows_with_names)} Show{'s' if len(missing_shows_with_names) > 1 else ''} Missing")
|
|
|
|
if self.details["save_missing"] is True:
|
|
|
|
if self.details["save_missing"] is True:
|
|
|
|
self.library.add_missing(collection_name, missing_shows_with_names, False)
|
|
|
|
self.library.add_missing(collection_name, missing_shows_with_names, False)
|
|
|
|