[5] update tmdb region

pull/1168/head
meisnate12 2 years ago
parent d932f3bdbb
commit 6cafca3020

@ -1 +1 @@
1.18.0-develop4 1.18.0-develop5

@ -9,13 +9,15 @@ Below is a `tmdb` mapping example and the full set of attributes:
tmdb: tmdb:
apikey: ################################ apikey: ################################
language: en language: en
region: US
cache_expiration: 60
``` ```
| Attribute | Allowed Values | Default | Required | | Attribute | Allowed Values | Default | Required |
|:-------------------|:----------------------------------------------------------------------------------------------------------|:-------:|:--------:| |:-------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------:|:--------:|
| `apikey` | User TMDb V3 API Key | N/A | ✅ | | `apikey` | User TMDb V3 API Key | N/A | ✅ |
| `language` | [ISO 639-1 Code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) of the User Language | en | ❌ | | `language` | [ISO 639-1 Code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) of the User Language | en | ❌ |
| `region` | [ISO 3166-1 Code](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) of the User Region for Searches | None | ❌ | | `region` | [ISO 3166-1 Code](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) of the User Region for use with [Other TMDb Builders](../metadata/builders/tmdb.md#other-tmdb-builders) | None | ❌ |
| `cache_expiration` | Number of days before each cache mapping expires and has to be re-cached. | 60 | ❌ | | `cache_expiration` | Number of days before each cache mapping expires and has to be re-cached. | 60 | ❌ |
If you do not have a TMDb V3 API key please refer to this [guide](https://developers.themoviedb.org/3/getting-started/introduction). If you do not have a TMDb V3 API key please refer to this [guide](https://developers.themoviedb.org/3/getting-started/introduction).

@ -436,7 +436,7 @@ The `sync_mode: sync` and `collection_order: custom` Details are recommended sin
| Movie Parameters | Description | | Movie Parameters | Description |
|:--------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |:--------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `limit` | Specify how many movies you want returned by the query.<br>**Type:** Integer<br>**Default:** 100 | | `limit` | Specify how many movies you want returned by the query.<br>**Type:** Integer<br>**Default:** 100 |
| `region` | Specify a [ISO 3166-1 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) to filter release dates. Must be uppercase.<br>**Type:** `^[A-Z]{2}$` | | `region` | Specify a [ISO 3166-1 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) to filter release dates. Must be uppercase. Will use the `region` specified in the [TMDb Config](../../config/tmdb) by default.<br>**Type:** `^[A-Z]{2}$` |
| `sort_by` | Choose from one of the many available sort options.<br>**Type:** Any [sort options](#sort-options) below<br>**Default:** `popularity.desc` | | `sort_by` | Choose from one of the many available sort options.<br>**Type:** Any [sort options](#sort-options) below<br>**Default:** `popularity.desc` |
| `certification_country` | Used in conjunction with the certification parameter, use this to specify a country with a valid certification.<br>**Type:** String | | `certification_country` | Used in conjunction with the certification parameter, use this to specify a country with a valid certification.<br>**Type:** String |
| `certification` | Filter results with a valid certification from the `certification_country` parameter.<br>**Type:** String | | `certification` | Filter results with a valid certification from the `certification_country` parameter.<br>**Type:** String |

@ -339,6 +339,8 @@ class TMDb:
for date_attr in date_methods: for date_attr in date_methods:
if date_attr in attrs: if date_attr in attrs:
attrs[date_attr] = util.validate_date(attrs[date_attr], f"tmdb_discover attribute {date_attr}", return_as="%Y-%m-%d") attrs[date_attr] = util.validate_date(attrs[date_attr], f"tmdb_discover attribute {date_attr}", return_as="%Y-%m-%d")
if is_movie and region and "region" not in attrs:
attrs["region"] = region
logger.trace(f"Params: {attrs}") logger.trace(f"Params: {attrs}")
results = self.TMDb.discover_movies(**attrs) if is_movie else self.TMDb.discover_tv_shows(**attrs) results = self.TMDb.discover_movies(**attrs) if is_movie else self.TMDb.discover_tv_shows(**attrs)
amount = results.total_results if limit == 0 or results.total_results < limit else limit amount = results.total_results if limit == 0 or results.total_results < limit else limit

Loading…
Cancel
Save