diff --git a/README.md b/README.md index a3c1d42..1805824 100644 --- a/README.md +++ b/README.md @@ -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. - - No other list item should be present. - `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.) @@ -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. - - No other list item should be present. - `blacklisted_min_runtime` - Blacklist runtime duration shorter than specified time (in minutes). `blacklisted_max_runtime` - Blacklist runtime duration longer than specified time (in minutes). @@ -726,8 +722,6 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi - Blank list (i.e. `[]`) - Add shows from any country. - `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. @@ -750,8 +744,6 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi - Blank list (i.e. `[]`) - Add shows from any genre. - `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. diff --git a/helpers/trakt.py b/helpers/trakt.py index 556a985..1e88011 100644 --- a/helpers/trakt.py +++ b/helpers/trakt.py @@ -96,7 +96,7 @@ def blacklisted_show_country(show, allowed_countries): blacklisted = False try: # ["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']) # List provided - skip adding show item because it is missing a country elif not show['show']['country']: @@ -127,7 +127,7 @@ def blacklisted_show_language(show, allowed_languages): allowed_languages = ['en'] try: # ["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']) # List provided - skip adding show item because it is missing a language elif not show['show']['language']: @@ -150,7 +150,7 @@ def blacklisted_show_genre(show, genres): blacklisted = False try: # ["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']) elif not show['show']['genres']: 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 try: # ["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.", movie['movie']['title']) # 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'] try: # ["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.", movie['movie']['title']) # List provided - skip adding movie item because it is missing a language @@ -337,7 +337,7 @@ def blacklisted_movie_genre(movie, genres): blacklisted = False try: # ["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']) elif not movie['movie']['genres']: log.debug("\'%s\' | Blacklisted Genres Check | Blacklisted because it had no genre specified.", diff --git a/traktarr.py b/traktarr.py index 7989b28..64f3b65 100755 --- a/traktarr.py +++ b/traktarr.py @@ -367,14 +367,18 @@ def shows( # process genres if genres: - # set special genre keyword to show's blacklisted_genres list - if genres.lower() == 'ignore': + # split comma separated list + 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'] genres = None - # remove genres from show's blacklisted_genres list else: + # remove genres from show's blacklisted_genres list 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 r = re.compile('[0-9]{4}-[0-9]{4}') @@ -868,13 +872,13 @@ def movies( genres = sorted(genres.split(','), key=str.lower) # 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 cfg['filters']['movies']['blacklisted_genres'] = ['ignore'] # set genre search parameter to None genres = None - # remove genre from movies's blacklisted_genres list, if it's there else: + # remove genre from movies's blacklisted_genres list, if it's there 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)))