Filters: Tweaked special keyword behavior for genre and country

pull/105/head
desimaniac 5 years ago
parent 4abf1a1eba
commit ba4e84cdff

@ -569,9 +569,11 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- Special keywords (used as the only list item):
- `any` - Add movies from any country.
- Blank list (i.e. `[]`) - Add movies from any country.
- `ignore` (also empty list i.e. `[]`) - Like `any`, but also add movies even if it is missing a country.
- `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.
@ -585,15 +587,17 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
`blacklisted_genres` - Blacklist certain genres.
- [List of available movie genres](assets/list_of_movie_genres.md).
- [List of available movie genres](assets/list_of_movie_genres.md).
- For an updated list, visit [here](https://trakt.docs.apiary.io/#reference/genres/list/get-genres).
- For an updated list, visit [here](https://trakt.docs.apiary.io/#reference/genres/list/get-genres).
- Special Keywords:
- Special Keywords:
- Blank list (i.e. `[]`) - Add movies from any genre.
- Blank list (i.e. `[]`) - Add movies from any genre.
- `ignore` (used as the only list item) - 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_max_year` - Blacklist release dates after specified year.
@ -679,10 +683,12 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- Special keywords (used as the only list item):
- `any` - Add shows from any country.
- Blank list (i.e. `[]`) - Add shows from any country.
- `ignore` (also empty list i.e. `[]`) - Like `any`, but also add shows even if it is missing a 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.
- By default, Traktarr will only query shows in English. If you need to search for other languages (e.g. Japanese for anime), you must add those languages here.
@ -701,8 +707,10 @@ 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` (used as the only list item) - 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_max_year` - Blacklist release dates after specified year.
`blacklisted_min_runtime` - Blacklist runtime duration lower than specified time (in minutes).

@ -10,10 +10,12 @@ def blacklisted_show_genre(show, genres):
# ["ignore"] - add show item even if it is missing a genre
if len(genres) == 1 and genres[0].lower() == 'ignore':
log.debug("Skipping valid genre check for: \'%s\'", show['show']['title'])
# [] - add show item with any valid genre
elif not show['show']['genres']:
log.debug("\'%s\' was blacklisted because it had no genre", show['show']['title'])
blacklisted = True
# [] - add show item with any valid genre
elif not genres:
log.debug("Skipping blacklisted genre check for: \'%s\'", show['show']['title'])
# List provided - skip adding show item if the genre is blacklisted
else:
for genre in genres:
@ -47,16 +49,16 @@ def blacklisted_show_year(show, earliest_year, latest_year):
def blacklisted_show_country(show, allowed_countries):
blacklisted = False
try:
# [] or ["ignore"] - add show item even if it is missing a country
if (not allowed_countries) or (len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore'):
# ["ignore"] - add show item even if it is missing a country
if len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore':
log.debug("Skipping valid countries check for: \'%s\'", show['show']['title'])
# List provided - skip adding show item because it is missing a country
elif not show['show']['country']:
log.debug("\'%s\' was blacklisted because it had no country", show['show']['title'])
blacklisted = True
# ["any"] - add show item with any valid country
elif len(allowed_countries) == 1 and allowed_countries[0].lower() == 'any':
log.debug("Skipping allowed countries check for: \'%s\'")
# [] - add show item from any valid country
elif not allowed_countries:
log.debug("Skipping allowed countries check for: \'%s\'", show['show']['title'])
# List provided - skip adding show item if the country is blacklisted
elif show['show']['country'].lower() not in allowed_countries:
log.debug("\'%s\' was blacklisted because it's from the country: %s", show['show']['title'],
@ -154,10 +156,12 @@ def blacklisted_movie_genre(movie, genres):
# ["ignore"] - add movie item even if it is missing a genre
if len(genres) == 1 and genres[0].lower() == 'ignore':
log.debug("Skipping valid genre check for: \'%s\'", movie['movie']['title'])
# [] - add movie item with any valid genre
elif not movie['movie']['genres']:
log.debug("\'%s\' was blacklisted because it had no genre", movie['movie']['title'])
blacklisted = True
# [] - add movie item with any valid genre
elif not genres:
log.debug("Skipping blacklisted genre check for: \'%s\'", movie['movie']['title'])
# List provided - skip adding movie item if the genre is blacklisted
else:
for genre in genres:
@ -191,16 +195,16 @@ def blacklisted_movie_year(movie, earliest_year, latest_year):
def blacklisted_movie_country(movie, allowed_countries):
blacklisted = False
try:
# [] or ["ignore"] - add movie item even if it is missing a country
if (not allowed_countries) or (len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore'):
# ["ignore"] - add movie item even if it is missing a country
if len(allowed_countries) == 1 and allowed_countries[0].lower() == 'ignore':
log.debug("Skipping valid countries check for: \'%s\'", movie['movie']['title'])
# List provided - skip adding movie item because it is missing a country
elif not movie['movie']['country']:
log.debug("\'%s\' was blacklisted because it had no country", movie['movie']['title'])
blacklisted = True
# ["any"] - add movie item with any valid country
elif len(allowed_countries) == 1 and allowed_countries[0].lower() == 'any':
log.debug("Skipping allowed countries check.")
# [] - add movie item with from any valid country
elif not allowed_countries:
log.debug("Skipping allowed countries check for: \'%s\'", movie['movie']['title'])
# List provided - skip adding movie item if the country is blacklisted
elif movie['movie']['country'].lower() not in allowed_countries:
log.debug("\'%s\' was blacklisted because it's from the country: %s", movie['movie']['title'],

Loading…
Cancel
Save