Config: New option for allowed countries: 'any' or 'ignore'.

pull/93/head
desimaniac 6 years ago
parent a8bb4ece61
commit 8d02d56297

@ -183,7 +183,12 @@ For each user you want to access the private lists for (i.e. watchlist and/or cu
Repeat the following steps for every user you want to authenticate:
1. Run `traktarr trakt_authentication`
1. Run the following command:
```
traktarr trakt_authentication
```
2. You wil get the following prompt:
@ -195,11 +200,11 @@ Repeat the following steps for every user you want to authenticate:
4. Enter the code you see in your terminal.
5. Click continue.
5. Click **Continue**.
6. If you are not logged in to Trakt, login now.
6. If you are not logged in to Trakt.tv, login now.
7. Click "Accept".
7. Click **Accept**.
8. You will get the message: "Woohoo! Your device is now connected and will automatically refresh in a few seconds.".
@ -442,6 +447,8 @@ You can also schedule any number of public or private custom lists.
For both public and private lists you'll need the url to that list. When viewing the list on Trakt, simply copy the url from the address bar of the your browser.
_Note: These are for non-watchlist lists. If you want to add a watchlist list, use the section above._
#### Public Lists
Public lists can be added by specifying the url and the item limit like this:
@ -559,6 +566,12 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- [List of available country codes](assets/list_of_country_codes.md).
- Special keywords (used as the only list item):
- `any` - Add movies from any country.
- `ignore` (also empty list i.e. `[]`) - Like `any`, but also add movies even if it is missing a country.
`allowed_languages` - Only add movies with these languages. Listed as two-letter language codes.
- By default, Traktarr will only query movies in English. If you need to search for other languages (e.g. Japanese for anime), you must add those languages here.
@ -657,6 +670,12 @@ Use filters to specify the movie/shows's country of origin or blacklist (i.e. fi
- [List of available country codes](assets/list_of_country_codes.md).
- Special keywords (used as the only list item):
- `any` - Add shows from any country.
- `ignore` (also empty list i.e. `[]`) - Like `any`, but also add shows even if it is missing a country.
`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.

@ -41,14 +41,21 @@ def blacklisted_show_year(show, earliest_year, latest_year):
def blacklisted_show_country(show, allowed_countries):
blacklisted = False
try:
if not show['show']['country']:
# [] 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'):
log.debug("Skipping valid countries check.")
# 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
else:
if show['show']['country'].lower() not in allowed_countries:
log.debug("%s was blacklisted because it's from country: %s", show['show']['title'],
show['show']['country'])
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.")
# 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 country: %s", show['show']['title'],
show['show']['country'])
blacklisted = True
except Exception:
log.exception("Exception determining if show was from an allowed country %s: ", show)
@ -172,15 +179,21 @@ def blacklisted_movie_year(movie, earliest_year, latest_year):
def blacklisted_movie_country(movie, allowed_countries):
blacklisted = False
try:
if not movie['movie']['country']:
# [] 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'):
log.debug("Skipping valid countries check.")
# 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
else:
if movie['movie']['country'].lower() not in allowed_countries:
log.debug("%s was blacklisted because it's from country: %s", movie['movie']['title'],
movie['movie']['country'])
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.")
# 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 country: %s", movie['movie']['title'],
movie['movie']['country'])
blacklisted = True
except Exception:
log.exception("Exception determining if movie was from an allowed country %s: ", movie)
return blacklisted

Loading…
Cancel
Save