|
|
@ -21,25 +21,44 @@ def blacklisted_show_id(show, blacklisted_ids):
|
|
|
|
blacklisted_ids = sorted(map(int, blacklisted_ids))
|
|
|
|
blacklisted_ids = sorted(map(int, blacklisted_ids))
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if show['show']['ids']['tvdb'] in blacklisted_ids:
|
|
|
|
if show['show']['ids']['tvdb'] in blacklisted_ids:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had a blacklisted TVDB ID of: %d", show['show']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted IDs Check | Blacklisted because it had a blacklisted TVDB ID: %d",
|
|
|
|
|
|
|
|
show['show']['title'],
|
|
|
|
show['show']['ids']['tvdb'])
|
|
|
|
show['show']['ids']['tvdb'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted IDs Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if show had a blacklisted TVDB ID %s: ", show)
|
|
|
|
log.exception("Exception determining if show had a blacklisted TVDB ID %s: ", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def blacklisted_show_title(show):
|
|
|
|
|
|
|
|
blacklisted = False
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if not show['show']['title']:
|
|
|
|
|
|
|
|
log.debug("Blacklisted Titles Check | Blacklisted show because it had no title: %s", show)
|
|
|
|
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
log.exception("Exception determining if show had a blacklisted title %s: ", show)
|
|
|
|
|
|
|
|
return blacklisted
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def blacklisted_show_year(show, earliest_year, latest_year):
|
|
|
|
def blacklisted_show_year(show, earliest_year, latest_year):
|
|
|
|
blacklisted = False
|
|
|
|
blacklisted = False
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
year = misc_str.get_year_from_timestamp(show['show']['first_aired'])
|
|
|
|
year = misc_str.get_year_from_timestamp(show['show']['first_aired'])
|
|
|
|
if not year:
|
|
|
|
if not year:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had an unknown first-aired date.", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Years Check | Blacklisted because it had no "
|
|
|
|
|
|
|
|
"first-aired date specified.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if year < earliest_year or year > latest_year:
|
|
|
|
if year < earliest_year or year > latest_year:
|
|
|
|
log.debug("\'%s\' was blacklisted because it first aired in: %d", show['show']['title'], year)
|
|
|
|
log.debug("\'%s\' | Blacklisted Years Check | Blacklisted because it first aired in: %d",
|
|
|
|
|
|
|
|
show['show']['title'], year)
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Years Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if show is within min_year and max_year range %s:", show)
|
|
|
|
log.exception("Exception determining if show is within min_year and max_year range %s:", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -49,15 +68,18 @@ def blacklisted_show_network(show, networks):
|
|
|
|
blacklisted = False
|
|
|
|
blacklisted = False
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if not show['show']['network']:
|
|
|
|
if not show['show']['network']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no network", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Networks Check | Blacklisted because it had no network specified.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
for network in networks:
|
|
|
|
for network in networks:
|
|
|
|
if network.lower() in show['show']['network'].lower():
|
|
|
|
if network.lower() in show['show']['network'].lower():
|
|
|
|
log.debug("\'%s\' was blacklisted because it's from the network: %s", show['show']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Networks Check | Blacklisted because it's from the network: %s",
|
|
|
|
show['show']['network'])
|
|
|
|
show['show']['title'], show['show']['network'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Networks Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if show is from a blacklisted network %s: ", show)
|
|
|
|
log.exception("Exception determining if show is from a blacklisted network %s: ", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -68,19 +90,24 @@ def blacklisted_show_country(show, allowed_countries):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# ["ignore"] - add show item even if it is missing a country
|
|
|
|
# ["ignore"] - add show item even if it is missing a country
|
|
|
|
if len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore':
|
|
|
|
if len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore':
|
|
|
|
log.debug("\'%s\' - skipping valid countries check.", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Ignoring valid countries check.", show['show']['title'])
|
|
|
|
# List provided - skip adding show item because it is missing a country
|
|
|
|
# List provided - skip adding show item because it is missing a country
|
|
|
|
elif not show['show']['country']:
|
|
|
|
elif not show['show']['country']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no country", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Blacklisted because it had no country specified.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
# [] - add show item from any valid country
|
|
|
|
# [] - add show item from any valid country
|
|
|
|
elif not allowed_countries:
|
|
|
|
elif not allowed_countries:
|
|
|
|
log.debug("\'%s\' - skipping allowed countries check.", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Skipping allowed countries check.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
# List provided - skip adding show item if the country is blacklisted
|
|
|
|
# List provided - skip adding show item if the country is blacklisted
|
|
|
|
elif show['show']['country'].lower() not in allowed_countries:
|
|
|
|
elif show['show']['country'].lower() not in allowed_countries:
|
|
|
|
log.debug("\'%s\' was blacklisted because it's from the country: %s", show['show']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Blacklisted because it's from the country: %s",
|
|
|
|
|
|
|
|
show['show']['title'],
|
|
|
|
show['show']['country'].upper())
|
|
|
|
show['show']['country'].upper())
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if show was from an allowed country %s: ", show)
|
|
|
|
log.exception("Exception determining if show was from an allowed country %s: ", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -94,16 +121,19 @@ def blacklisted_show_language(show, allowed_languages):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# ["ignore"] - add show item even if it is missing a language
|
|
|
|
# ["ignore"] - add show item even if it is missing a language
|
|
|
|
if len(allowed_languages) == 1 and allowed_languages[0].lower() == 'ignore':
|
|
|
|
if len(allowed_languages) == 1 and allowed_languages[0].lower() == 'ignore':
|
|
|
|
log.debug("\'%s\' - skipping valid countries check.", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Ignoring valid languages check.", show['show']['title'])
|
|
|
|
# List provided - skip adding show item because it is missing a language
|
|
|
|
# List provided - skip adding show item because it is missing a language
|
|
|
|
elif not show['show']['language']:
|
|
|
|
elif not show['show']['language']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no language", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Blacklisted because it had no language specified.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
# List provided - skip adding show item if the language is blacklisted
|
|
|
|
# List provided - skip adding show item if the language is blacklisted
|
|
|
|
elif show['show']['language'].lower() not in allowed_languages:
|
|
|
|
elif show['show']['language'].lower() not in allowed_languages:
|
|
|
|
log.debug("\'%s\' was blacklisted because it's in the language: %s", show['show']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Blacklisted because it's in the language: %s",
|
|
|
|
show['show']['language'].upper())
|
|
|
|
show['show']['title'], show['show']['language'].upper())
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining what language the show was in %s: ", show)
|
|
|
|
log.exception("Exception determining what language the show was in %s: ", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -114,21 +144,25 @@ def blacklisted_show_genre(show, genres):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# ["ignore"] - add show item even if it is missing a genre
|
|
|
|
# ["ignore"] - add show item even if it is missing a genre
|
|
|
|
if len(genres) == 1 and genres[0].lower() == 'ignore':
|
|
|
|
if len(genres) == 1 and genres[0].lower() == 'ignore':
|
|
|
|
log.debug("\'%s\' - skipping valid genre check.", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Ignoring valid genres check.", show['show']['title'])
|
|
|
|
elif not show['show']['genres']:
|
|
|
|
elif not show['show']['genres']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no genre", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
# [] - add show item with any valid genre
|
|
|
|
# [] - add show item with any valid genre
|
|
|
|
elif not genres:
|
|
|
|
elif not genres:
|
|
|
|
log.debug("\'%s\' - skipping blacklisted genre check.", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Skipping blacklisted genres check.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
# List provided - skip adding show item if the genre is blacklisted
|
|
|
|
# List provided - skip adding show item if the genre is blacklisted
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
for genre in genres:
|
|
|
|
for genre in genres:
|
|
|
|
if genre.lower() in show['show']['genres']:
|
|
|
|
if genre.lower() in show['show']['genres']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it was from the genre: %s", show['show']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it was from the genre: %s",
|
|
|
|
genre.title())
|
|
|
|
show['show']['title'], genre.title())
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if show has a blacklisted genre %s: ", show)
|
|
|
|
log.exception("Exception determining if show has a blacklisted genre %s: ", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -138,12 +172,15 @@ def blacklisted_show_runtime(show, lowest_runtime):
|
|
|
|
blacklisted = False
|
|
|
|
blacklisted = False
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if not show['show']['runtime'] or not isinstance(show['show']['runtime'], int):
|
|
|
|
if not show['show']['runtime'] or not isinstance(show['show']['runtime'], int):
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no runtime", show['show']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Runtime Check | Blacklisted because it had no runtime specified.",
|
|
|
|
|
|
|
|
show['show']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
elif int(show['show']['runtime']) < lowest_runtime:
|
|
|
|
elif int(show['show']['runtime']) < lowest_runtime:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had a runtime of: %d", show['show']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Runtime Check | Blacklisted because it had the runtime of: %d min.",
|
|
|
|
show['show']['runtime'])
|
|
|
|
show['show']['title'], show['show']['runtime'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Runtime Check | Passed.", show['show']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if show had sufficient runtime %s: ", show)
|
|
|
|
log.exception("Exception determining if show had sufficient runtime %s: ", show)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -157,6 +194,8 @@ def is_show_blacklisted(show, blacklist_settings, ignore_blacklist, callback=Non
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if blacklisted_show_id(show, blacklist_settings.blacklisted_tvdb_ids):
|
|
|
|
if blacklisted_show_id(show, blacklist_settings.blacklisted_tvdb_ids):
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if blacklisted_show_title(show):
|
|
|
|
|
|
|
|
blacklisted = True
|
|
|
|
if blacklisted_show_year(show, blacklist_settings.blacklisted_min_year,
|
|
|
|
if blacklisted_show_year(show, blacklist_settings.blacklisted_min_year,
|
|
|
|
blacklist_settings.blacklisted_max_year):
|
|
|
|
blacklist_settings.blacklisted_max_year):
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
@ -182,9 +221,11 @@ def blacklisted_movie_id(movie, blacklisted_ids):
|
|
|
|
blacklisted_ids = sorted(map(int, blacklisted_ids))
|
|
|
|
blacklisted_ids = sorted(map(int, blacklisted_ids))
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if movie['movie']['ids']['tmdb'] in blacklisted_ids:
|
|
|
|
if movie['movie']['ids']['tmdb'] in blacklisted_ids:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had a blacklisted TMDb ID of: %d", movie['movie']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted IDs Check | Blacklisted because it had a blacklisted TMDb ID: %d",
|
|
|
|
movie['movie']['ids']['tmdb'])
|
|
|
|
movie['movie']['title'], movie['movie']['ids']['tmdb'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted IDs Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if movie had a blacklisted TMDb ID %s: ", movie)
|
|
|
|
log.exception("Exception determining if movie had a blacklisted TMDb ID %s: ", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -194,15 +235,17 @@ def blacklisted_movie_title(movie, blacklisted_keywords):
|
|
|
|
blacklisted = False
|
|
|
|
blacklisted = False
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if not movie['movie']['title']:
|
|
|
|
if not movie['movie']['title']:
|
|
|
|
log.debug("Blacklisted movie because it had no title: %s", movie)
|
|
|
|
log.debug("Blacklisted Titles Check | Blacklisted movie because it had no title: %s", movie)
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
for keyword in blacklisted_keywords:
|
|
|
|
for keyword in blacklisted_keywords:
|
|
|
|
if keyword.lower() in movie['movie']['title'].lower():
|
|
|
|
if keyword.lower() in movie['movie']['title'].lower():
|
|
|
|
log.debug("\'%s\' was blacklisted because it had title keyword: %s", movie['movie']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Titles Check | Blacklisted because it had title keyword: %s",
|
|
|
|
keyword)
|
|
|
|
movie['movie']['title'], keyword)
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Titles Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if movie had a blacklisted title %s: ", movie)
|
|
|
|
log.exception("Exception determining if movie had a blacklisted title %s: ", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -213,12 +256,16 @@ def blacklisted_movie_year(movie, earliest_year, latest_year):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
year = movie['movie']['year']
|
|
|
|
year = movie['movie']['year']
|
|
|
|
if year is None or not isinstance(year, int):
|
|
|
|
if year is None or not isinstance(year, int):
|
|
|
|
log.debug("\'%s\' was blacklisted because it had an unknown year.", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Years Check | Blacklisted because it had no year specified.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if int(year) < earliest_year or int(year) > latest_year:
|
|
|
|
if int(year) < earliest_year or int(year) > latest_year:
|
|
|
|
log.debug("\'%s\' was blacklisted because its year is: %d", movie['movie']['title'], int(year))
|
|
|
|
log.debug("\'%s\' | Blacklisted Years Check | Blacklisted because its year is: %d",
|
|
|
|
|
|
|
|
movie['movie']['title'], int(year))
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Years Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if movie is within min_year and max_year ranger %s:", movie)
|
|
|
|
log.exception("Exception determining if movie is within min_year and max_year ranger %s:", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -229,19 +276,24 @@ def blacklisted_movie_country(movie, allowed_countries):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# ["ignore"] - add movie item even if it is missing a country
|
|
|
|
# ["ignore"] - add movie item even if it is missing a country
|
|
|
|
if len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore':
|
|
|
|
if len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore':
|
|
|
|
log.debug("\'%s\' - skipping valid countries check. ", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Ignoring valid countries check.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
# List provided - skip adding movie item because it is missing a country
|
|
|
|
# List provided - skip adding movie item because it is missing a country
|
|
|
|
elif not movie['movie']['country']:
|
|
|
|
elif not movie['movie']['country']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no country", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Blacklisted because it had no country specified.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
# [] - add movie item with from any valid country
|
|
|
|
# [] - add movie item with from any valid country
|
|
|
|
elif not allowed_countries:
|
|
|
|
elif not allowed_countries:
|
|
|
|
log.debug("\'%s\' - skipping allowed countries check.", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Skipping allowed countries check.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
# List provided - skip adding movie item if the country is blacklisted
|
|
|
|
# List provided - skip adding movie item if the country is blacklisted
|
|
|
|
elif movie['movie']['country'].lower() not in allowed_countries:
|
|
|
|
elif movie['movie']['country'].lower() not in allowed_countries:
|
|
|
|
log.debug("\'%s\' was blacklisted because it's from the country: %s", movie['movie']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Blacklisted because it's from the country: %s",
|
|
|
|
movie['movie']['country'].upper())
|
|
|
|
movie['movie']['title'], movie['movie']['country'].upper())
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Countries Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if movie was from an allowed country %s: ", movie)
|
|
|
|
log.exception("Exception determining if movie was from an allowed country %s: ", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -255,16 +307,20 @@ def blacklisted_movie_language(movie, allowed_languages):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# ["ignore"] - add movie item even if it is missing a language
|
|
|
|
# ["ignore"] - add movie item even if it is missing a language
|
|
|
|
if len(allowed_languages) == 1 and allowed_languages[0].lower() == 'ignore':
|
|
|
|
if len(allowed_languages) == 1 and allowed_languages[0].lower() == 'ignore':
|
|
|
|
log.debug("\'%s\' - skipping valid countries check.", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Ignoring valid languages check.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
# List provided - skip adding movie item because it is missing a language
|
|
|
|
# List provided - skip adding movie item because it is missing a language
|
|
|
|
elif not movie['movie']['language']:
|
|
|
|
elif not movie['movie']['language']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no language", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Blacklisted because it had no language specified.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
# List provided - skip adding movie item if the language is blacklisted
|
|
|
|
# List provided - skip adding movie item if the language is blacklisted
|
|
|
|
elif movie['movie']['language'].lower() not in allowed_languages:
|
|
|
|
elif movie['movie']['language'].lower() not in allowed_languages:
|
|
|
|
log.debug("\'%s\' was blacklisted because it's in the language: %s", movie['movie']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Blacklisted because it's in the language: %s",
|
|
|
|
movie['movie']['language'].upper())
|
|
|
|
movie['movie']['title'], movie['movie']['language'].upper())
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Languages Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining what language the movie was %s: ", movie)
|
|
|
|
log.exception("Exception determining what language the movie was %s: ", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -275,21 +331,25 @@ def blacklisted_movie_genre(movie, genres):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# ["ignore"] - add movie item even if it is missing a genre
|
|
|
|
# ["ignore"] - add movie item even if it is missing a genre
|
|
|
|
if len(genres) == 1 and genres[0].lower() == 'ignore':
|
|
|
|
if len(genres) == 1 and genres[0].lower() == 'ignore':
|
|
|
|
log.debug("\'%s\' - skipping valid genre check.", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Ignoring valid genres check.", movie['movie']['title'])
|
|
|
|
elif not movie['movie']['genres']:
|
|
|
|
elif not movie['movie']['genres']:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no genre", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
# [] - add movie item with any valid genre
|
|
|
|
# [] - add movie item with any valid genre
|
|
|
|
elif not genres:
|
|
|
|
elif not genres:
|
|
|
|
log.debug("\'%s\' - skipping blacklisted genre check.", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Skipping blacklisted genres check.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
# List provided - skip adding movie item if the genre is blacklisted
|
|
|
|
# List provided - skip adding movie item if the genre is blacklisted
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
for genre in genres:
|
|
|
|
for genre in genres:
|
|
|
|
if genre.lower() in movie['movie']['genres']:
|
|
|
|
if genre.lower() in movie['movie']['genres']:
|
|
|
|
log.debug("%s was blacklisted because it was from the genre: %s", movie['movie']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it was from the genre: %s",
|
|
|
|
genre.title())
|
|
|
|
movie['movie']['title'], genre.title())
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Genres Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if movie has a blacklisted genre %s: ", movie)
|
|
|
|
log.exception("Exception determining if movie has a blacklisted genre %s: ", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
@ -299,12 +359,15 @@ def blacklisted_movie_runtime(movie, lowest_runtime):
|
|
|
|
blacklisted = False
|
|
|
|
blacklisted = False
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if not movie['movie']['runtime'] or not isinstance(movie['movie']['runtime'], int):
|
|
|
|
if not movie['movie']['runtime'] or not isinstance(movie['movie']['runtime'], int):
|
|
|
|
log.debug("\'%s\' was blacklisted because it had no runtime", movie['movie']['title'])
|
|
|
|
log.debug("\'%s\' | Blacklisted Runtime Check | Blacklisted because it had no runtime specified.",
|
|
|
|
|
|
|
|
movie['movie']['title'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
elif int(movie['movie']['runtime']) < lowest_runtime:
|
|
|
|
elif int(movie['movie']['runtime']) < lowest_runtime:
|
|
|
|
log.debug("\'%s\' was blacklisted because it had a runtime of: %d", movie['movie']['title'],
|
|
|
|
log.debug("\'%s\' | Blacklisted Runtime Check | Blacklisted because it had the runtime of: %d min.",
|
|
|
|
movie['movie']['runtime'])
|
|
|
|
movie['movie']['title'], movie['movie']['runtime'])
|
|
|
|
blacklisted = True
|
|
|
|
blacklisted = True
|
|
|
|
|
|
|
|
if not blacklisted:
|
|
|
|
|
|
|
|
log.debug("\'%s\' | Blacklisted Runtime Check | Passed.", movie['movie']['title'])
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
log.exception("Exception determining if movie had sufficient runtime %s: ", movie)
|
|
|
|
log.exception("Exception determining if movie had sufficient runtime %s: ", movie)
|
|
|
|
return blacklisted
|
|
|
|
return blacklisted
|
|
|
|