sort lists to process by highest vote count.

pull/3/head
l3uddz 7 years ago
parent 14262e9172
commit affa47afb5

@ -95,9 +95,13 @@ def shows(list_type, add_limit=0, add_delay=2.5, no_search=False):
log.info("Removed existing Sonarr series from Trakt series list, series left to process: %d", log.info("Removed existing Sonarr series from Trakt series list, series left to process: %d",
len(processed_series_list)) len(processed_series_list))
# sort filtered series list by highest votes
sorted_series_list = sorted(processed_series_list, key=lambda k: k['show']['votes'], reverse=True)
log.info("Sorted series list to process by highest votes")
# loop series_list # loop series_list
log.info("Processing list now...") log.info("Processing list now...")
for series in processed_series_list: for series in sorted_series_list:
try: try:
# check if series passes out blacklist criteria inspection # check if series passes out blacklist criteria inspection
if not helpers.trakt_is_show_blacklisted(series, cfg.filters.shows): if not helpers.trakt_is_show_blacklisted(series, cfg.filters.shows):
@ -184,7 +188,7 @@ def movies(list_type, add_limit=0, add_delay=2.5, no_search=False):
else: else:
log.info("Retrieved Trakt %s movies list, movies found: %d", list_type, len(trakt_movies_list)) log.info("Retrieved Trakt %s movies list, movies found: %d", list_type, len(trakt_movies_list))
# build filtered series list without series that exist in sonarr # build filtered movie list without movies that exist in radarr
processed_movies_list = helpers.radarr_remove_existing_movies(radarr_movie_list, trakt_movies_list) processed_movies_list = helpers.radarr_remove_existing_movies(radarr_movie_list, trakt_movies_list)
if not processed_movies_list: if not processed_movies_list:
log.error("Aborting due to failure to remove existing Radarr movies from retrieved Trakt movies list") log.error("Aborting due to failure to remove existing Radarr movies from retrieved Trakt movies list")
@ -193,9 +197,13 @@ def movies(list_type, add_limit=0, add_delay=2.5, no_search=False):
log.info("Removed existing Radarr movies from Trakt movies list, movies left to process: %d", log.info("Removed existing Radarr movies from Trakt movies list, movies left to process: %d",
len(processed_movies_list)) len(processed_movies_list))
# sort filtered movie list by highest votes
sorted_movies_list = sorted(processed_movies_list, key=lambda k: k['movie']['votes'], reverse=True)
log.info("Sorted movie list to process by highest votes")
# loop movies # loop movies
log.info("Processing list now...") log.info("Processing list now...")
for movie in processed_movies_list: for movie in sorted_movies_list:
try: try:
# check if movie passes out blacklist criteria inspection # check if movie passes out blacklist criteria inspection
if not helpers.trakt_is_movie_blacklisted(movie, cfg.filters.movies): if not helpers.trakt_is_movie_blacklisted(movie, cfg.filters.movies):

Loading…
Cancel
Save