From 6cafca3020cadd096338bd1b29a499317bcadab9 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 10 Nov 2022 13:44:38 -0500 Subject: [PATCH] [5] update tmdb region --- VERSION | 2 +- docs/config/tmdb.md | 14 ++++++++------ docs/metadata/builders/tmdb.md | 2 +- modules/tmdb.py | 2 ++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index b09c8060..089349c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.0-develop4 +1.18.0-develop5 diff --git a/docs/config/tmdb.md b/docs/config/tmdb.md index 0c22d2dd..99c71b43 100644 --- a/docs/config/tmdb.md +++ b/docs/config/tmdb.md @@ -9,13 +9,15 @@ Below is a `tmdb` mapping example and the full set of attributes: tmdb: apikey: ################################ language: en + region: US + cache_expiration: 60 ``` -| Attribute | Allowed Values | Default | Required | -|:-------------------|:----------------------------------------------------------------------------------------------------------|:-------:|:--------:| -| `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 | ❌ | -| `region` | [ISO 3166-1 Code](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) of the User Region for Searches | None | ❌ | -| `cache_expiration` | Number of days before each cache mapping expires and has to be re-cached. | 60 | ❌ | +| Attribute | Allowed Values | Default | Required | +|:-------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------:|:--------:| +| `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 | ❌ | +| `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 | ❌ | If you do not have a TMDb V3 API key please refer to this [guide](https://developers.themoviedb.org/3/getting-started/introduction). diff --git a/docs/metadata/builders/tmdb.md b/docs/metadata/builders/tmdb.md index 14f58dc8..b63383f5 100644 --- a/docs/metadata/builders/tmdb.md +++ b/docs/metadata/builders/tmdb.md @@ -436,7 +436,7 @@ The `sync_mode: sync` and `collection_order: custom` Details are recommended sin | Movie Parameters | Description | |:--------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `limit` | Specify how many movies you want returned by the query.
**Type:** Integer
**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.
**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.
**Type:** `^[A-Z]{2}$` | | `sort_by` | Choose from one of the many available sort options.
**Type:** Any [sort options](#sort-options) below
**Default:** `popularity.desc` | | `certification_country` | Used in conjunction with the certification parameter, use this to specify a country with a valid certification.
**Type:** String | | `certification` | Filter results with a valid certification from the `certification_country` parameter.
**Type:** String | diff --git a/modules/tmdb.py b/modules/tmdb.py index 6a1c1a45..de300715 100644 --- a/modules/tmdb.py +++ b/modules/tmdb.py @@ -339,6 +339,8 @@ class TMDb: for date_attr in date_methods: 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") + if is_movie and region and "region" not in attrs: + attrs["region"] = region logger.trace(f"Params: {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