[49] Update `tmdb_discover` (#2241)

pull/2242/head
meisnate12 2 months ago committed by GitHub Action
parent 7bdb069242
commit 0c4718f888

@ -1 +1 @@
2.0.2-build48
2.0.2-build49

@ -468,14 +468,13 @@ and in a specific order.
!!!bug
We have noticed inconsistent responses from TMDb when using `desc`as the sort order. This can result in movies/shows disappearing from and reapparing in collections/overlays sporadically. **We suggest users do not use the popularity.desc sort options with `tmdb_discover`**.
We have noticed inconsistent responses from TMDb when using `popularity.asc` and `popularity.desc` as the sort order. This can result in movies/shows disappearing from and reapparing in collections/overlays sporadically. **We suggest users do not use the popularity sort options with `tmdb_discover`**.
This bug is on TMDb's side and we are awaiting a fix from them.
| Movie Parameters | Description |
|:--------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `limit` | Specify how many movies you want returned by the query.<br>**Type:** Integer<br>**Default:** 100 |
| `language` | ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it.<br>**Type:** String<br>**Default:** en-US |
| `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.md) 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` |
| `certification_country` | Used in conjunction with the certification parameter, use this to specify a country with a valid certification.<br>**Type:** String |
@ -506,10 +505,10 @@ and in a specific order.
| `without_keywords` | Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic.<br>**Type:** String |
| `with_runtime.gte` | Filter and only include movies that have a runtime that is greater or equal to a value.<br>**Type:** Integer |
| `with_runtime.lte` | Filter and only include movies that have a runtime that is less than or equal to a value.<br>**Type:** Integer |
| `with_origin_country` | Specify an ISO 639-1 string to filter and only include movies that have the given origin country.<br>**Type:** String |
| `with_origin_country` | Specify an origin country string to filter results by their original country value.<br>**Type:** String |
| `with_original_language` | Specify an ISO 639-1 string to filter results by their original language value.<br>**Type:** String |
| `with_watch_providers` | A comma or pipe separated list of watch provider ID's.<br>use in conjunction with watch_region, can be a comma (`,`) for an AND, or a pipe (`|`) for an OR separated query<br>**Type:** String |
| `without_watch_providers` | A comma or pipe separated list of watch provider ID's to exclude.<br>use in conjunction with watch_region, can be a comma (`,`) for an AND, or a pipe (` |`) for an OR separated query<br>**Type:** String |
| `without_watch_providers` | Filter the results to exclude certain watch providers.<br>**Type:** String |
| `watch_region` | An [ISO 3166-1 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). Combine this filter with `with_watch_providers` in order to filter your results by a specific watch provider in a specific region.<br>**Type:** String<br>**Values:** [ISO 3166-1 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) |
| `with_watch_monetization_types` | In combination with `watch_region`, you can filter by monetization type.<br>Can be a comma (`,`) for an AND, or a pipe (`|`) for an OR separated query<br>**Type:** String<br>**Values:** `flatrate`, `free`, `ads`, `rent`, `buy` |
@ -523,23 +522,21 @@ and in a specific order.
!!!bug
We have noticed inconsistent responses from TMDb when using `desc`as the sort order. This can result in movies/shows disappearing from and reapparing in collections/overlays sporadically. **We suggest users do not use the popularity.desc sort options with `tmdb_discover`**.
We have noticed inconsistent responses from TMDb when using `popularity.desc` as the sort order. This can result in movies disappearing from and reapparing in collections/overlays sporadically. **We suggest users do not use the popularity.desc sort options with `tmdb_discover`**.
This bug is on TMDb's side and we are awaiting a fix from them.
| Show Parameters | Description |
|:--------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `limit` | Specify how many movies you want to be returned by the query.<br>**Type:** Integer<br>**Default:** 100 |
| `language` | ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it.<br>**Type:** String<br>**Default:** en-US |
| `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.md) 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` |
| `air_date.gte` | Filter and only include TV shows that have an air date (by looking at all episodes) that is greater or equal to the specified value.<br>**Type:** Date: `MM/DD/YYYY` |
| `air_date.lte` | Filter and only include TV shows that have an air date (by looking at all episodes) that is less than or equal to the specified value.<br>**Type:** Date: `MM/DD/YYYY` |
| `first_air_date.gte` | Filter and only include TV shows that have a original air date that is greater or equal to the specified value. Can be used in conjunction with the `include_null_first_air_dates` filter if you want to include items with no air date.<br>**Type:** Date: `MM/DD/YYYY` |
| `first_air_date.lte` | Filter and only include TV shows that have a original air date that is less than or equal to the specified value. Can be used in conjunction with the `include_null_first_air_dates` filter if you want to include items with no air date.<br>**Type:** Date: `MM/DD/YYYY` |
| `first_air_date_year` | Filter and only include TV shows that have an original air date year that equal to the specified value. Can be used in conjunction with the `include_null_first_air_dates` filter if you want to include items with no air date.<br>**Type:** Year: `YYYY` |
| `include_null_first_air_dates` | Use this filter to include TV shows that don't have an air date while using any of the `first_air_date` filters.<br>**Type:** Boolean |
| `include_adult` | A filter and include or exclude adult movies.<br>**Type:** Boolean |
| `include_null_first_air_dates` | Use this filter to include TV shows that don't have an air date while using any of the `first_air_date` filters.<br>**Type:** Boolean |
| `timezone` | Used in conjunction with the `air_date.gte/lte` filter to calculate the proper UTC offset.<br>**Type:** String<br>**Default:** `America/New_York` |
| `vote_count.gte` | Filter and only include TV that have a vote count that is greater or equal to the specified value.<br>**Type:** Integer |
| `vote_count.lte` | Filter and only include TV that have a vote count that is less than or equal to the specified value.<br>**Type:** Integer |
@ -555,9 +552,10 @@ and in a specific order.
| `with_runtime.gte` | Filter and only include TV shows with an episode runtime that is greater than or equal to a value.<br>**Type:** Integer |
| `with_runtime.lte` | Filter and only include TV shows with an episode runtime that is less than or equal to a value.<br>**Type:** Integer |
| `with_original_language` | Specify an ISO 639-1 string to filter results by their original language value.<br>**Type:** String |
| `with_name_translation` | Specify a language/country string to filter the results by if the item has a type of name translation.<br>**Type:** String<br>**Values:** `ar-AE`, `ar-SA`, `bg-BG`, `bn-BD`, `ca-ES`, `ch-GU`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-US`, `eo-EO`, `es-ES`, `es-MX`, `eu-ES`, `fa-IR`, `fi-FI`, `fr-CA`, `fr-FR`, `he-IL`, `hi-IN`, `hu-HU`, `id-ID`, `it-IT`, `ja-JP`, `ka-GE`, `kn-IN`, `ko-KR`, `lt-LT`, `ml-IN`, `nb-NO`, `nl-NL`, `no-NO`, `pl-PL`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sk-SK`, `sl-SI`, `sr-RS`, `sv-SE`, `ta-IN`, `te-IN`, `th-TH`, `tr-TR`, `uk-UA`, `vi-VN`, `zh-CN`, `zh-TW` |
| `screened_theatrically` | Filter results to include items that have been screened theatrically.<br>**Type:** Boolean |
| `with_watch_providers` | A comma or pipe separated list of watch provider ID's.<br>use in conjunction with watch_region, can be a comma (`,`) for an AND, or a pipe (`|`) for an OR separated query<br>**Type:** String |
| `without_watch_providers` | A comma or pipe separated list of watch provider ID's to exclude.<br>use in conjunction with watch_region, can be a comma (`,`) for an AND, or a pipe (` |`) for an OR separated query<br>**Type:** String |
| `without_watch_providers` | Filter the results to exclude certain watch providers.<br>**Type:** String |
| `watch_region` | An [ISO 3166-1 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes). Combine this filter with `with_watch_providers` in order to filter your results by a specific watch provider in a specific region.<br>**Type:** String |
| `with_watch_monetization_types` | In combination with `watch_region`, you can filter by monetization type.<br>Can be a comma (`,`) for an AND, or a pipe (`|`) for an OR separated query<br>**Type:** String<br>**Values:** `flatrate`, `free`, `ads`, `rent`, `buy` |
| `with_status` | Filter TV shows by their status.<br>**Type:** String<br>Can be a comma (`,`) for an AND, or a pipe (`|`) for an OR separated query<br>**Values:** `0`: Returning Series, `1`: Planned, `2`: In Production, `3`: Ended, `4`: Cancelled, `5`: Pilot |
@ -567,9 +565,9 @@ and in a specific order.
!!!bug
We have noticed inconsistent responses from TMDb when using `desc`as the sort order. This can result in movies/shows disappearing from and reapparing in collections/overlays sporadically.
We have noticed inconsistent responses from TMDb when using `popularity.desc` as the sort order. This can result in shows disappearing from and reapparing in collections/overlays sporadically.
**Due to the nature of this bug, we suggest you do not use the popularity.desc sort options with `tmdb_discover` unless you also set a `limit` of 20 or less**. If you do not set a limit, the data that TMDb returns may be inconsistent.**
**Due to the nature of this bug, we suggest you do not use the `popularity.desc` sort options with `tmdb_discover` unless you also set a `limit` of 20 or less**. If you do not set a limit, the data that TMDb returns may be inconsistent.**
This bug is on TMDb's side that we have made them aware of and are currently awaiting a fix.
@ -578,8 +576,14 @@ and in a specific order.
|:----------------------------|:------------------------------------------:|:------------------------------------------:|
| `popularity.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-check:{ .green } |
| `popularity.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-check:{ .green } |
| `title.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `title.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `original_title.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `original_title.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `name.asc` | :fontawesome-solid-circle-xmark:{ .red } | :fontawesome-solid-circle-check:{ .green } |
| `name.desc` | :fontawesome-solid-circle-xmark:{ .red } | :fontawesome-solid-circle-check:{ .green } |
| `original_name.asc` | :fontawesome-solid-circle-xmark:{ .red } | :fontawesome-solid-circle-check:{ .green } |
| `original_name.desc` | :fontawesome-solid-circle-xmark:{ .red } | :fontawesome-solid-circle-check:{ .green } |
| `revenue.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `revenue.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `release_date.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
@ -590,8 +594,8 @@ and in a specific order.
| `first_air_date.desc` | :fontawesome-solid-circle-xmark:{ .red } | :fontawesome-solid-circle-check:{ .green } |
| `vote_average.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-check:{ .green } |
| `vote_average.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-check:{ .green } |
| `vote_count.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `vote_count.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-xmark:{ .red } |
| `vote_count.asc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-check:{ .green } |
| `vote_count.desc` | :fontawesome-solid-circle-check:{ .green } | :fontawesome-solid-circle-check:{ .green } |
```yaml
collections:

@ -10,6 +10,7 @@ from modules.request import quote
from plexapi.audio import Artist, Album, Track
from plexapi.exceptions import NotFound
from plexapi.video import Movie, Show, Season, Episode
from tmdbapis.tmdb import discover_movie_sort_options, discover_tv_sort_options
logger = util.logger
@ -1975,7 +1976,7 @@ class CollectionBuilder:
if method_name == "tmdb_discover":
for dict_data in util.parse(self.Type, method_name, method_data, datatype="listdict"):
dict_methods = {dm.lower(): dm for dm in dict_data}
new_dictionary = {"limit": util.parse(self.Type, "limit", dict_data, datatype="int", methods=dict_methods, default=100, parent=method_name)}
new_dictionary = {"limit": util.parse(self.Type, "limit", dict_data, datatype="int", methods=dict_methods, minimum=0, default=100, parent=method_name)}
for discover_method, discover_data in dict_data.items():
lower_method = str(discover_method).lower()
discover_attr, modifier = os.path.splitext(lower_method)
@ -1990,7 +1991,7 @@ class CollectionBuilder:
elif discover_attr == "region":
new_dictionary[discover_attr] = util.parse(self.Type, discover_method, discover_data.upper(), parent=method_name, regex=("^[A-Z]{2}$", "US"))
elif discover_attr == "sort_by":
options = tmdb.discover_movie_sort if self.library.is_movie else tmdb.discover_tv_sort
options = discover_movie_sort_options if self.library.is_movie else discover_tv_sort_options
new_dictionary[lower_method] = util.parse(self.Type, discover_method, discover_data, parent=method_name, options=options)
elif discover_attr == "certification_country":
if "certification" in dict_data or "certification.lte" in dict_data or "certification.gte" in dict_data:

@ -27,7 +27,7 @@ type_map = {
}
discover_movie_only = [
"region", "with_cast", "with_crew", "with_people", "certification_country", "certification", "include_video", "year",
"primary_release_year", "primary_release_date", "release_date", "include_adult", "with_release_type", "with_title_translation"
"primary_release_year", "primary_release_date", "release_date", "with_release_type", "with_title_translation", "with_origin_country"
]
discover_tv_only = [
"timezone", "screened_theatrically", "include_null_first_air_dates", "air_date", "first_air_date",
@ -35,7 +35,7 @@ discover_tv_only = [
]
discover_strings = [
"with_cast", "with_crew", "with_people", "with_companies", "without_companies", "with_networks", "with_genres",
"without_genres", "with_release_type", "with_keywords", "without_keywords", "with_original_language", "timezone",
"without_genres", "with_release_type", "with_keywords", "without_keywords", "with_origin_country", "with_original_language", "timezone",
"with_watch_providers", "without_watch_providers", "with_overview_translation", "with_title_translation", "with_name_translation"
]
discover_ints = ["vote_count", "with_runtime"]
@ -52,12 +52,6 @@ discover_special = [
discover_all = discover_special + discover_strings + discover_years + discover_booleans + date_methods + \
[f"{f}{m}" for f in discover_ints for m in modifiers] + \
[f"{f}{m}" for f in discover_numbers for m in modifiers]
discover_movie_sort = [
"popularity.asc", "popularity.desc", "release_date.asc", "release_date.desc", "revenue.asc", "revenue.desc",
"primary_release_date.asc", "primary_release_date.desc", "original_title.asc", "original_title.desc",
"vote_average.asc", "vote_average.desc", "vote_count.asc", "vote_count.desc"
]
discover_tv_sort = ["vote_average.desc", "vote_average.asc", "first_air_date.desc", "first_air_date.asc", "popularity.desc", "popularity.asc"]
discover_monetization_types = ["flatrate", "free", "ads", "rent", "buy"]
discover_types = {
"Documentary": "documentary", "News": "news", "Miniseries": "miniseries",

@ -13,4 +13,4 @@ tenacity==9.0.0
ruamel.yaml==0.18.6
schedule==1.2.2
setuptools==75.1.0
tmdbapis==1.2.18
tmdbapis==1.2.19
Loading…
Cancel
Save