added allowed_countries to config

pull/28/head
James 7 years ago
parent 20e4443306
commit b6ce715a5f

@ -58,7 +58,7 @@ class Trakt:
@backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) @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={}, def _make_items_request(self, url, limit, languages, type_name, object_name, authenticate_user=None, payload={},
sleep_between=5, genres=None): sleep_between=5, genres=None):
if languages is None: if not languages:
languages = ['en'] languages = ['en']
payload = dict_merge(payload, {'extended': 'full', 'limit': limit, 'page': 1, 'languages': ','.join(languages)}) payload = dict_merge(payload, {'extended': 'full', 'limit': limit, 'page': 1, 'languages': ','.join(languages)})

@ -60,6 +60,7 @@ class Config(object, metaclass=Singleton):
'blacklisted_genres': [], 'blacklisted_genres': [],
'blacklisted_networks': [], 'blacklisted_networks': [],
'allowed_countries': [], 'allowed_countries': [],
'allowed_languages': [],
'blacklisted_min_runtime': 15, 'blacklisted_min_runtime': 15,
'blacklisted_min_year': 2000, 'blacklisted_min_year': 2000,
'blacklisted_max_year': 2019, 'blacklisted_max_year': 2019,
@ -72,7 +73,8 @@ class Config(object, metaclass=Singleton):
'blacklisted_max_year': 2019, 'blacklisted_max_year': 2019,
'blacklist_title_keywords': [], 'blacklist_title_keywords': [],
'blacklisted_tmdb_ids': [], 'blacklisted_tmdb_ids': [],
'allowed_countries': [] 'allowed_countries': [],
'allowed_languages': []
} }
}, },
'automatic': { 'automatic': {
@ -154,11 +156,6 @@ class Config(object, metaclass=Singleton):
sub_upgraded = False sub_upgraded = False
merged = settings2.copy() merged = settings2.copy()
# print(settings1)
# print(settings2)
# print(overwrite)
# print("_______________")
if isinstance(settings1, dict): if isinstance(settings1, dict):
for k, v in settings1.items(): for k, v in settings1.items():
# missing k # missing k

@ -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 # get trakt series list
if list_type.lower() == 'anticipated': 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': 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': 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': elif list_type.lower() == 'watchlist':
trakt_objects_list = trakt.get_watchlist_shows(authenticate_user) trakt_objects_list = trakt.get_watchlist_shows(authenticate_user)
else: 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 # get trakt movies list
if list_type.lower() == 'anticipated': 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': 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': 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': elif list_type.lower() == 'boxoffice':
trakt_objects_list = trakt.get_boxoffice_movies() trakt_objects_list = trakt.get_boxoffice_movies()
elif list_type.lower() == 'watchlist': elif list_type.lower() == 'watchlist':

Loading…
Cancel
Save