Merge branch 'develop'

pull/8/head
l3uddz 7 years ago
commit 9e965e3c2d

@ -37,7 +37,8 @@ base_config = {
'allowed_countries': ['us', 'gb', 'ca'], 'allowed_countries': ['us', 'gb', 'ca'],
'blacklisted_min_runtime': 15, 'blacklisted_min_runtime': 15,
'blacklisted_min_year': 2000, 'blacklisted_min_year': 2000,
'blacklisted_max_year': 2019 'blacklisted_max_year': 2019,
'blacklisted_tvdb_ids': [],
}, },
'movies': { 'movies': {
'blacklisted_genres': ['documentary', 'music'], 'blacklisted_genres': ['documentary', 'music'],
@ -45,6 +46,7 @@ base_config = {
'blacklisted_min_year': 2000, 'blacklisted_min_year': 2000,
'blacklisted_max_year': 2019, 'blacklisted_max_year': 2019,
'blacklist_title_keywords': ['untitled', 'barbie'], 'blacklist_title_keywords': ['untitled', 'barbie'],
'blacklisted_tmdb_ids': [],
'allowed_countries': ['us', 'gb', 'ca'] 'allowed_countries': ['us', 'gb', 'ca']
} }
}, },

@ -169,6 +169,22 @@ def trakt_blacklisted_show_runtime(show, lowest_runtime):
return blacklisted return blacklisted
def trakt_blacklisted_show_id(show, blacklisted_ids):
blacklisted = False
try:
if not show['show']['ids']['tvdb'] or not isinstance(show['show']['ids']['tvdb'], int):
log.debug("%s was blacklisted because it had an invalid tvdb id", show['show']['title'])
blacklisted = True
elif show['show']['ids']['tvdb'] in blacklisted_ids:
log.debug("%s was blacklisted because it had a blacklisted tvdb id of: %d", show['show']['title'],
show['show']['ids']['tvdb'])
blacklisted = True
except Exception:
log.exception("Exception determining if show had a blacklisted tvdb id %s: ", show)
return blacklisted
def trakt_is_show_blacklisted(show, blacklist_settings): def trakt_is_show_blacklisted(show, blacklist_settings):
blacklisted = False blacklisted = False
try: try:
@ -183,6 +199,8 @@ def trakt_is_show_blacklisted(show, blacklist_settings):
blacklisted = True blacklisted = True
if trakt_blacklisted_show_runtime(show, blacklist_settings.blacklisted_min_runtime): if trakt_blacklisted_show_runtime(show, blacklist_settings.blacklisted_min_runtime):
blacklisted = True blacklisted = True
if trakt_blacklisted_show_id(show, blacklist_settings.blacklisted_tvdb_ids):
blacklisted = True
except Exception: except Exception:
log.exception("Exception determining if show was blacklisted %s: ", show) log.exception("Exception determining if show was blacklisted %s: ", show)
return blacklisted return blacklisted
@ -324,6 +342,22 @@ def trakt_blacklisted_movie_runtime(movie, lowest_runtime):
return blacklisted return blacklisted
def trakt_blacklisted_movie_id(movie, blacklisted_ids):
blacklisted = False
try:
if not movie['movie']['ids']['tmdb'] or not isinstance(movie['movie']['ids']['tmdb'], int):
log.debug("%s was blacklisted because it had an invalid tmdb id", movie['movie']['title'])
blacklisted = True
elif movie['movie']['ids']['tmdb'] in blacklisted_ids:
log.debug("%s was blacklisted because it had a blacklisted tmdb id of: %d", movie['movie']['title'],
movie['movie']['ids']['tmdb'])
blacklisted = True
except Exception:
log.exception("Exception determining if show had a blacklisted tmdb id %s: ", movie)
return blacklisted
def trakt_is_movie_blacklisted(movie, blacklist_settings): def trakt_is_movie_blacklisted(movie, blacklist_settings):
blacklisted = False blacklisted = False
try: try:
@ -338,6 +372,8 @@ def trakt_is_movie_blacklisted(movie, blacklist_settings):
blacklisted = True blacklisted = True
if trakt_blacklisted_movie_runtime(movie, blacklist_settings.blacklisted_min_runtime): if trakt_blacklisted_movie_runtime(movie, blacklist_settings.blacklisted_min_runtime):
blacklisted = True blacklisted = True
if trakt_blacklisted_movie_id(movie, blacklist_settings.blacklisted_tmdb_ids):
blacklisted = True
except Exception: except Exception:
log.exception("Exception determining if movie was blacklisted %s: ", movie) log.exception("Exception determining if movie was blacklisted %s: ", movie)
return blacklisted return blacklisted

Loading…
Cancel
Save