Add ability to specify blacklist ignore in config

pull/54/head
Mitchell Klijs 7 years ago
parent 54d528b0c5
commit 2061c2e42c

@ -193,6 +193,7 @@ You can repeat this process for as many users as you like.
},
"filters": {
"movies": {
"disabled_for": [],
"allowed_countries": [
"us",
"gb",
@ -215,6 +216,7 @@ You can repeat this process for as many users as you like.
"blacklisted_tmdb_ids": []
},
"shows": {
"disabled_for": [],
"allowed_countries": [
"us",
"gb",
@ -444,6 +446,7 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
```json
"movies": {
"disabled_for": [],
"allowed_countries": [
"us",
"gb",
@ -466,6 +469,18 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
},
```
`disabled_for` - specify for which lists the blacklist must be disabled when running in automatic mode
Example:
```
"disabled_for": [
"anticipated",
"watchlist:user1",
"list:http://url-to-list"
],
```
`allowed_countries` - only add movies from these countries.
`allowed_languages` - only add movies with these languages (default/blank=English).
@ -530,6 +545,18 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
}
```
`disabled_for` - specify for which lists the blacklist must be disabled when running in automatic mode
Example:
```
"disabled_for": [
"anticipated",
"watchlist:user1",
"list:http://url-to-list"
],
```
`allowed_countries` - only add shows from these countries.
`allowed_languages` - only add shows with these languages (default/blank=English).

@ -57,6 +57,7 @@ class Config(object, metaclass=Singleton):
},
'filters': {
'shows': {
'disabled_for': [],
'blacklisted_genres': [],
'blacklisted_networks': [],
'allowed_countries': [],
@ -67,6 +68,7 @@ class Config(object, metaclass=Singleton):
'blacklisted_tvdb_ids': [],
},
'movies': {
'disabled_for': [],
'blacklisted_genres': [],
'blacklisted_min_runtime': 60,
'blacklisted_min_year': 2000,

@ -523,10 +523,15 @@ def automatic_shows(add_delay=2.5, no_search=False, notifications=False, ignore_
else:
log.info("Adding %d shows from Trakt's %s list", limit, list_type)
local_ignore_blacklist = ignore_blacklist
if list_type.lower() in cfg.filters.shows.disabled_for:
local_ignore_blacklist = True
# run shows
added_shows = shows.callback(list_type=list_type, add_limit=limit,
add_delay=add_delay, no_search=no_search,
notifications=notifications, ignore_blacklist=ignore_blacklist)
notifications=notifications, ignore_blacklist=local_ignore_blacklist)
elif list_type.lower() == 'watchlist':
for authenticate_user, limit in value.items():
if limit <= 0:
@ -535,11 +540,16 @@ def automatic_shows(add_delay=2.5, no_search=False, notifications=False, ignore_
else:
log.info("Adding %d shows from the %s from %s", limit, list_type, authenticate_user)
local_ignore_blacklist = ignore_blacklist
if "watchlist:%s".format(authenticate_user) in cfg.filters.shows.disabled_for:
local_ignore_blacklist = True
# run shows
added_shows = shows.callback(list_type=list_type, add_limit=limit,
add_delay=add_delay, no_search=no_search,
notifications=notifications, authenticate_user=authenticate_user,
ignore_blacklist=ignore_blacklist)
ignore_blacklist=local_ignore_blacklist)
elif list_type.lower() == 'lists':
for list, v in value.items():
if isinstance(v, dict):
@ -549,11 +559,16 @@ def automatic_shows(add_delay=2.5, no_search=False, notifications=False, ignore_
authenticate_user = None
limit = v
local_ignore_blacklist = ignore_blacklist
if "list:%s".format(list) in cfg.filters.shows.disabled_for:
local_ignore_blacklist = True
# run shows
added_shows = shows.callback(list_type=list, add_limit=limit,
add_delay=add_delay, no_search=no_search,
notifications=notifications, authenticate_user=authenticate_user,
ignore_blacklist=ignore_blacklist)
ignore_blacklist=local_ignore_blacklist)
if added_shows is None:
log.error("Failed adding shows from Trakt's %s list", list_type)
@ -596,10 +611,15 @@ def automatic_movies(add_delay=2.5, no_search=False, notifications=False, ignore
else:
log.info("Adding %d movies from Trakt's %s list", limit, list_type)
local_ignore_blacklist = ignore_blacklist
if list_type.lower() in cfg.filters.movies.disabled_for:
local_ignore_blacklist = True
# run movies
added_movies = movies.callback(list_type=list_type, add_limit=limit,
add_delay=add_delay, no_search=no_search,
notifications=notifications, ignore_blacklist=ignore_blacklist)
notifications=notifications, ignore_blacklist=local_ignore_blacklist)
elif list_type.lower() == 'watchlist':
for authenticate_user, limit in value.items():
if limit <= 0:
@ -608,11 +628,16 @@ def automatic_movies(add_delay=2.5, no_search=False, notifications=False, ignore
else:
log.info("Adding %d movies from the %s from %s", limit, list_type, authenticate_user)
local_ignore_blacklist = ignore_blacklist
if "watchlist:%s".format(authenticate_user) in cfg.filters.movies.disabled_for:
local_ignore_blacklist = True
# run movies
added_movies = movies.callback(list_type=list_type, add_limit=limit,
add_delay=add_delay, no_search=no_search,
notifications=notifications, authenticate_user=authenticate_user,
ignore_blacklist=ignore_blacklist)
ignore_blacklist=local_ignore_blacklist)
elif list_type.lower() == 'lists':
for list, v in value.items():
if isinstance(v, dict):
@ -622,11 +647,16 @@ def automatic_movies(add_delay=2.5, no_search=False, notifications=False, ignore
authenticate_user = None
limit = v
local_ignore_blacklist = ignore_blacklist
if "list:%s".format(list) in cfg.filters.movies.disabled_for:
local_ignore_blacklist = True
# run shows
added_movies = movies.callback(list_type=list, add_limit=limit,
add_delay=add_delay, no_search=no_search,
notifications=notifications, authenticate_user=authenticate_user,
ignore_blacklist=ignore_blacklist)
ignore_blacklist=local_ignore_blacklist)
if added_movies is None:
log.error("Failed adding movies from Trakt's %s list", list_type)

Loading…
Cancel
Save