From b6ce715a5f7d0fd30974de4d7320408c98fd53c4 Mon Sep 17 00:00:00 2001 From: James Date: Sat, 26 May 2018 14:47:13 +0100 Subject: [PATCH] added allowed_countries to config --- media/trakt.py | 2 +- misc/config.py | 9 +++------ traktarr.py | 12 ++++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/media/trakt.py b/media/trakt.py index ca73011..ddc2d7a 100644 --- a/media/trakt.py +++ b/media/trakt.py @@ -58,7 +58,7 @@ class Trakt: @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) def _make_items_request(self, url, limit, languages, type_name, object_name, authenticate_user=None, payload={}, sleep_between=5, genres=None): - if languages is None: + if not languages: languages = ['en'] payload = dict_merge(payload, {'extended': 'full', 'limit': limit, 'page': 1, 'languages': ','.join(languages)}) diff --git a/misc/config.py b/misc/config.py index 1f9dea2..f123139 100644 --- a/misc/config.py +++ b/misc/config.py @@ -60,6 +60,7 @@ class Config(object, metaclass=Singleton): 'blacklisted_genres': [], 'blacklisted_networks': [], 'allowed_countries': [], + 'allowed_languages': [], 'blacklisted_min_runtime': 15, 'blacklisted_min_year': 2000, 'blacklisted_max_year': 2019, @@ -72,7 +73,8 @@ class Config(object, metaclass=Singleton): 'blacklisted_max_year': 2019, 'blacklist_title_keywords': [], 'blacklisted_tmdb_ids': [], - 'allowed_countries': [] + 'allowed_countries': [], + 'allowed_languages': [] } }, 'automatic': { @@ -154,11 +156,6 @@ class Config(object, metaclass=Singleton): sub_upgraded = False merged = settings2.copy() - # print(settings1) - # print(settings2) - # print(overwrite) - # print("_______________") - if isinstance(settings1, dict): for k, v in settings1.items(): # missing k diff --git a/traktarr.py b/traktarr.py index 78524c6..b846e66 100755 --- a/traktarr.py +++ b/traktarr.py @@ -212,11 +212,11 @@ def shows(list_type, add_limit=0, add_delay=2.5, genre=None, folder=None, no_sea # get trakt series list if list_type.lower() == 'anticipated': - trakt_objects_list = trakt.get_anticipated_shows(genres=genre) + trakt_objects_list = trakt.get_anticipated_shows(genres=genre, languages=cfg.filters.shows.allowed_languages) elif list_type.lower() == 'trending': - trakt_objects_list = trakt.get_trending_shows(genres=genre) + trakt_objects_list = trakt.get_trending_shows(genres=genre, languages=cfg.filters.shows.allowed_languages) elif list_type.lower() == 'popular': - trakt_objects_list = trakt.get_popular_shows(genres=genre) + trakt_objects_list = trakt.get_popular_shows(genres=genre, languages=cfg.filters.shows.allowed_languages) elif list_type.lower() == 'watchlist': trakt_objects_list = trakt.get_watchlist_shows(authenticate_user) else: @@ -388,11 +388,11 @@ def movies(list_type, add_limit=0, add_delay=2.5, genre=None, folder=None, no_se # get trakt movies list if list_type.lower() == 'anticipated': - trakt_objects_list = trakt.get_anticipated_movies(genres=genre) + trakt_objects_list = trakt.get_anticipated_movies(genres=genre, languages=cfg.filters.movies.allowed_languages) elif list_type.lower() == 'trending': - trakt_objects_list = trakt.get_trending_movies(genres=genre) + trakt_objects_list = trakt.get_trending_movies(genres=genre, languages=cfg.filters.movies.allowed_languages) elif list_type.lower() == 'popular': - trakt_objects_list = trakt.get_popular_movies(genres=genre) + trakt_objects_list = trakt.get_popular_movies(genres=genre, languages=cfg.filters.movies.allowed_languages) elif list_type.lower() == 'boxoffice': trakt_objects_list = trakt.get_boxoffice_movies() elif list_type.lower() == 'watchlist':