Blacklists: No longer require 'ignore' to be the only list item when using the ignore special keyword.

pull/105/head
desimaniac 5 years ago
parent e9c11f73d4
commit 7996278d32

@ -605,8 +605,6 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- `ignore` (i.e. `["ignore"]`) Add movies from any country, including ones with no country specified. - `ignore` (i.e. `["ignore"]`) Add movies from any country, including ones with no country specified.
- No other list item should be present.
`allowed_languages` - Only add movies with these languages. Listed as two-letter language codes. `allowed_languages` - Only add movies with these languages. Listed as two-letter language codes.
- Languages are in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format (e.g. `ja` for Japanese.) - Languages are in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format (e.g. `ja` for Japanese.)
@ -629,8 +627,6 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- `ignore` (i.e. `["ignore"]`) - Add movies from any genre, including ones with no genre specified. - `ignore` (i.e. `["ignore"]`) - Add movies from any genre, including ones with no genre specified.
- No other list item should be present.
`blacklisted_min_runtime` - Blacklist runtime duration shorter than specified time (in minutes). `blacklisted_min_runtime` - Blacklist runtime duration shorter than specified time (in minutes).
`blacklisted_max_runtime` - Blacklist runtime duration longer than specified time (in minutes). `blacklisted_max_runtime` - Blacklist runtime duration longer than specified time (in minutes).
@ -727,8 +723,6 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- `ignore` (i.e. `["ignore"]`) Add shows from any country, including ones with no country specified. - `ignore` (i.e. `["ignore"]`) Add shows from any country, including ones with no country specified.
- No other list item should be present.
`allowed_languages` - Only add shows with these languages. `allowed_languages` - Only add shows with these languages.
- Languages are in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format (e.g. `ja` for Japanese.) - Languages are in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format (e.g. `ja` for Japanese.)
@ -751,8 +745,6 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- `ignore` (i.e. `["ignore"]`) - Add shows from any genre, including ones with no genre specified. - `ignore` (i.e. `["ignore"]`) - Add shows from any genre, including ones with no genre specified.
- No other list item should be present.
`blacklisted_networks` - Blacklist certain network. `blacklisted_networks` - Blacklist certain network.
`blacklisted_min_runtime` - Blacklist runtime duration shorter than specified time (in minutes). `blacklisted_min_runtime` - Blacklist runtime duration shorter than specified time (in minutes).

@ -96,7 +96,7 @@ def blacklisted_show_country(show, allowed_countries):
blacklisted = False blacklisted = False
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 any('ignore' in s.lower() for s in allowed_countries):
log.debug("\'%s\' | Blacklisted Countries Check | Ignored.", show['show']['title']) log.debug("\'%s\' | Blacklisted Countries Check | Ignored.", 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']:
@ -127,7 +127,7 @@ def blacklisted_show_language(show, allowed_languages):
allowed_languages = ['en'] allowed_languages = ['en']
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 any('ignore' in s.lower() for s in allowed_languages):
log.debug("\'%s\' | Blacklisted Languages Check | Ignored.", show['show']['title']) log.debug("\'%s\' | Blacklisted Languages Check | Ignored.", 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']:
@ -150,7 +150,7 @@ def blacklisted_show_genre(show, genres):
blacklisted = False blacklisted = False
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 any('ignore' in s.lower() for s in genres):
log.debug("\'%s\' | Blacklisted Genres Check | Ignored.", show['show']['title']) log.debug("\'%s\' | Blacklisted Genres Check | Ignored.", show['show']['title'])
elif not show['show']['genres']: elif not show['show']['genres']:
log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.", log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.",
@ -282,7 +282,7 @@ def blacklisted_movie_country(movie, allowed_countries):
blacklisted = False blacklisted = False
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 any('ignore' in s.lower() for s in allowed_countries):
log.debug("\'%s\' | Blacklisted Countries Check | Ignored.", log.debug("\'%s\' | Blacklisted Countries Check | Ignored.",
movie['movie']['title']) 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
@ -313,7 +313,7 @@ def blacklisted_movie_language(movie, allowed_languages):
allowed_languages = ['en'] allowed_languages = ['en']
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 any('ignore' in s.lower() for s in allowed_languages):
log.debug("\'%s\' | Blacklisted Languages Check | Ignored.", log.debug("\'%s\' | Blacklisted Languages Check | Ignored.",
movie['movie']['title']) 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
@ -337,7 +337,7 @@ def blacklisted_movie_genre(movie, genres):
blacklisted = False blacklisted = False
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 any('ignore' in s.lower() for s in genres):
log.debug("\'%s\' | Blacklisted Genres Check | Ignored.", movie['movie']['title']) log.debug("\'%s\' | Blacklisted Genres Check | Ignored.", movie['movie']['title'])
elif not movie['movie']['genres']: elif not movie['movie']['genres']:
log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.", log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.",

@ -367,14 +367,18 @@ def shows(
# process genres # process genres
if genres: if genres:
# set special genre keyword to show's blacklisted_genres list # split comma separated list
if genres.lower() == 'ignore': genres = sorted(genres.split(','), key=str.lower)
# look for special keyword 'ignore'
if 'ignore' in genres:
# set special genre keyword to show's blacklisted_genres list
cfg['filters']['shows']['blacklisted_genres'] = ['ignore'] cfg['filters']['shows']['blacklisted_genres'] = ['ignore']
genres = None genres = None
# remove genres from show's blacklisted_genres list
else: else:
# remove genres from show's blacklisted_genres list
misc_helper.unblacklist_genres(genres, cfg['filters']['shows']['blacklisted_genres']) misc_helper.unblacklist_genres(genres, cfg['filters']['shows']['blacklisted_genres'])
log.debug("Filter Trakt results with genre(s): %s", ', '.join(map(lambda x: x.title(), genres.split(',')))) log.debug("Filter Trakt results with genre(s): %s", ', '.join(map(lambda x: x.title(), genres)))
# set years range # set years range
r = re.compile('[0-9]{4}-[0-9]{4}') r = re.compile('[0-9]{4}-[0-9]{4}')
@ -868,13 +872,13 @@ def movies(
genres = sorted(genres.split(','), key=str.lower) genres = sorted(genres.split(','), key=str.lower)
# look for special keyword 'ignore' # look for special keyword 'ignore'
if len(genres) == 1 and genres[0].lower() == 'ignore': if 'ignore' in genres:
# set special keyword 'ignore' to movies's blacklisted_genres list # set special keyword 'ignore' to movies's blacklisted_genres list
cfg['filters']['movies']['blacklisted_genres'] = ['ignore'] cfg['filters']['movies']['blacklisted_genres'] = ['ignore']
# set genre search parameter to None # set genre search parameter to None
genres = None genres = None
# remove genre from movies's blacklisted_genres list, if it's there
else: else:
# remove genre from movies's blacklisted_genres list, if it's there
misc_helper.unblacklist_genres(genres, cfg['filters']['movies']['blacklisted_genres']) misc_helper.unblacklist_genres(genres, cfg['filters']['movies']['blacklisted_genres'])
log.debug("Filter Trakt results with genre(s): %s", ', '.join(map(lambda x: x.title(), genres))) log.debug("Filter Trakt results with genre(s): %s", ', '.join(map(lambda x: x.title(), genres)))

Loading…
Cancel
Save