diff --git a/VERSION b/VERSION index 9e4d84f0..2bf337b5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.2-develop26 +1.16.2-develop27 diff --git a/docs/config/libraries.md b/docs/config/libraries.md index e9cd75af..f0f6f147 100644 --- a/docs/config/libraries.md +++ b/docs/config/libraries.md @@ -161,7 +161,7 @@ The default and recommended path is `/config/<>_missing.yml` where ```yaml libraries: Movies: - missing_path: /config/Movies_movies.yml + missing_path: /config/Movies_missing.yml ``` Alternatively, "missing items" YAML files can be placed in their own directory, as below: diff --git a/docs/config/tmdb.md b/docs/config/tmdb.md index 4acc06d2..0c22d2dd 100644 --- a/docs/config/tmdb.md +++ b/docs/config/tmdb.md @@ -11,10 +11,11 @@ tmdb: language: en ``` -| Attribute | Allowed Values | Default | Required | -|:-------------------|:--------------------------------------------------------------------------|:-------:|:--------:| -| `apikey` | User TMDb V3 API Key | N/A | ✅ | -| `language` | User Language | en | ❌ | -| `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 Searches | 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 072233de..14f58dc8 100644 --- a/docs/metadata/builders/tmdb.md +++ b/docs/metadata/builders/tmdb.md @@ -39,6 +39,9 @@ You can find items using the features of [TheMovieDb.org](https://www.themoviedb | [`tmdb_popular`](#tmdb-popular) | Finds the movies/shows in TMDb's [Popular Movies](https://www.themoviedb.org/movie)/[Popular Shows](https://www.themoviedb.org/tv) list | ✅ | ✅ | ✅ | | [`tmdb_now_playing`](#tmdb-now-playing) | Finds the movies in TMDb's [Now Playing](https://www.themoviedb.org/movie/now-playing) list | ✅ | ❌ | ✅ | | [`tmdb_top_rated`](#tmdb-top-rated) | Finds the movies/shows in TMDb's [Top Rated Movies](https://www.themoviedb.org/movie/top-rated)/[Top Rated Shows](https://www.themoviedb.org/tv/top-rated) list | ✅ | ✅ | ✅ | +| [`tmdb_upcoming`](#tmdb-upcoming) | Finds the movies in TMDb's [Upcoming Movies](https://www.themoviedb.org/movie/upcoming) list | ✅ | ❌ | ✅ | +| [`tmdb_airing_today`](#tmdb-airing-today) | Finds the shows in TMDb's [Airing Today Shows](https://www.themoviedb.org/tv/airing-today) list | ❌ | ✅ | ✅ | +| [`tmdb_on_the_air`](#tmdb-on-the-air) | Finds the shows in TMDb's [On TV Shows](https://www.themoviedb.org/tv/on-the-air) list | ❌ | ✅ | ✅ | | [`tmdb_trending_daily`](#tmdb-trending-daily) | Finds the movies/shows in TMDb's Trending Daily list | ✅ | ✅ | ✅ | | [`tmdb_trending_weekly`](#tmdb-trending-weekly) | Finds the movies/shows in TMDb's Trending Weekly list | ✅ | ✅ | ✅ | | [`tmdb_discover`](#tmdb-discover) | Uses [TMDb's Discover Search](https://www.themoviedb.org/documentation/api/discover) to find every movie/show based on the [movie search parameters](https://developers.themoviedb.org/3/discover/movie-discover) or [show search parameters](https://developers.themoviedb.org/3/discover/tv-discover) provided | ✅ | ✅ | ✅ | @@ -295,6 +298,8 @@ collections: Finds the movies/shows in TMDb's [Popular Movies](https://www.themoviedb.org/movie)/[Popular Shows](https://www.themoviedb.org/tv) list. +Use `tmdb_region` with this builder to set the region. + The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. ```yaml @@ -309,6 +314,8 @@ collections: Finds the movies in TMDb's [Now Playing](https://www.themoviedb.org/movie/now-playing) list. +Use `tmdb_region` with this builder to set the region. + The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. ```yaml @@ -323,6 +330,8 @@ collections: Finds the movies/shows in TMDb's [Top Rated Movies](https://www.themoviedb.org/movie/top-rated)/[Top Rated Shows](https://www.themoviedb.org/tv/top-rated) list. +Use `tmdb_region` with this builder to set the region. + The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. ```yaml @@ -333,6 +342,50 @@ collections: sync_mode: sync ``` +## TMDb Upcoming + +Finds the movies in TMDb's [Upcoming Movies](https://www.themoviedb.org/movie/upcoming) list. + +Use `tmdb_region` with this builder to set the region. + +The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. + +```yaml +collections: + TMDb Upcoming: + tmdb_upcoming: 30 + collection_order: custom + sync_mode: sync +``` + +## TMDb Airing Today + +Finds the shows in TMDb's [Airing Today Shows](https://www.themoviedb.org/tv/airing-today) list. + +The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. + +```yaml +collections: + TMDb Airing Today: + tmdb_airing_today: 30 + collection_order: custom + sync_mode: sync +``` + +## TMDb On the Air + +Finds the shows in TMDb's [On TV Shows](https://www.themoviedb.org/tv/on-the-air) list. + +The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. + +```yaml +collections: + TMDb On the Air: + tmdb_on_the_air: 30 + collection_order: custom + sync_mode: sync +``` + ## TMDb Trending Daily Finds the movies/shows in TMDb's Trending Daily list. diff --git a/docs/metadata/details/setting.md b/docs/metadata/details/setting.md index 68973f5f..aa1c123e 100644 --- a/docs/metadata/details/setting.md +++ b/docs/metadata/details/setting.md @@ -12,6 +12,7 @@ All the following attributes serve various functions as how the collection/playl | `minimum_items` | **Description:** Minimum items that must be found to add to a collection/playlist.
**Default:** `minimum_items` [settings value](../../config/settings) in the Configuration File
**Values:** number greater then 0 | | `delete_below_minimum` | **Description:** Deletes the collection/playlist if below the minimum.
**Default:** `delete_below_minimum` [settings value](../../config/settings) in the Configuration File
**Values:** `true` or `false` | | `delete_not_scheduled` | **Description:** Deletes the collection/playlist if its skipped because its not scheduled.
**Default:** `delete_not_scheduled` [settings value](../../config/settings) in the Configuration File
**Values:** `true` or `false` | +| `tmdb_region` | **Description:** Sets the region for `tmdb_popular`, `tmdb_now_playing`, `tmdb_top_rated`, and `tmdb_upcoming` | | `validate_builders` | **Description:** When set to false the collection/playlist will not fail if one builder fails.
**Default:** `true`
**Values:** `true` or `false` | | `cache_builders` | **Description:** Caches the items found by the builders for a number of days. This is useful if you run the same configuration on multiple libraries/servers in one run just set the value to `1`.
**Default:** `0`
**Values:** number 0 or greater | | `blank_collection` | **Description:** When set to true the collection will be created with no builders and no items added.
**Default:** `false`
**Values:** `true` or `false` | diff --git a/modules/builder.py b/modules/builder.py index ac6a69cb..e6f3c2e6 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -100,8 +100,10 @@ ignored_details = [ "delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "collection_level", "validate_builders", "libraries", "sync_to_users", "collection_name", "playlist_name", "name", "blank_collection" ] -details = ["ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "collection_mode", "limit", "url_theme", "file_theme", - "minimum_items", "label", "album_sorting", "cache_builders"] + boolean_details + scheduled_boolean + string_details +details = [ + "ignore_ids", "ignore_imdb_ids", "server_preroll", "changes_webhooks", "collection_mode", "limit", "url_theme", + "file_theme", "minimum_items", "label", "album_sorting", "cache_builders", "tmdb_region" +] + boolean_details + scheduled_boolean + string_details collectionless_details = ["collection_order", "plex_collectionless", "label", "label_sync_mode", "test"] + \ poster_details + background_details + summary_details + string_details item_false_details = ["item_lock_background", "item_lock_poster", "item_lock_title"] @@ -303,6 +305,7 @@ class CollectionBuilder: self.limit = 0 self.beginning_count = 0 self.minimum = self.library.minimum_items + self.tmdb_region = None self.ignore_ids = [i for i in self.library.ignore_ids] self.ignore_imdb_ids = [i for i in self.library.ignore_imdb_ids] self.server_preroll = None @@ -784,6 +787,8 @@ class CollectionBuilder: self.file_theme = os.path.abspath(method_data) else: logger.error(f"{self.Type} Error: Theme Path Does Not Exist: {os.path.abspath(method_data)}") + elif method_name == "tmdb_region": + self.tmdb_region = util.parse(self.Type, method_name, str(method_data).upper(), options=self.config.TMDb.iso_3166_1) elif method_name == "collection_mode": self.details[method_name] = util.check_collection_mode(method_data) elif method_name == "minimum_items": @@ -1355,7 +1360,7 @@ class CollectionBuilder: elif "mdblist" in method: ids = self.config.Mdblist.get_imdb_ids(method, value) elif "tmdb" in method: - ids = self.config.TMDb.get_tmdb_ids(method, value, self.library.is_movie) + ids = self.config.TMDb.get_tmdb_ids(method, value, self.library.is_movie, self.tmdb_region) elif "trakt" in method: ids = self.config.Trakt.get_trakt_ids(method, value, self.library.is_movie) else: diff --git a/modules/config.py b/modules/config.py index 5170d1e3..4c7cddd3 100644 --- a/modules/config.py +++ b/modules/config.py @@ -381,6 +381,7 @@ class ConfigFile: "language": check_for_attribute(self.data, "language", parent="tmdb", default="en"), "expiration": check_for_attribute(self.data, "cache_expiration", parent="tmdb", var_type="int", default=60) }) + self.TMDb.region = check_for_attribute(self.data, "region", parent="tmdb", test_list=self.TMDb.iso_3166_1, default_is_none=True) logger.info(f"TMDb Connection {'Failed' if self.TMDb is None else 'Successful'}") else: raise Failed("Config Error: tmdb attribute not found") diff --git a/modules/tmdb.py b/modules/tmdb.py index 93699092..956949ec 100644 --- a/modules/tmdb.py +++ b/modules/tmdb.py @@ -151,12 +151,14 @@ class TMDb: self.config = config self.apikey = params["apikey"] self.language = params["language"] + self.region = None self.expiration = params["expiration"] logger.secret(self.apikey) try: self.TMDb = TMDbAPIs(self.apikey, language=self.language, session=self.config.session) except TMDbException as e: raise Failed(f"TMDb Error: {e}") + self.iso_3166_1 = [i.upper() for i in self.TMDb._iso_3166_1] def convert_from(self, tmdb_id, convert_to, is_movie): item = self.get_movie(tmdb_id) if is_movie else self.get_show(tmdb_id) @@ -255,7 +257,9 @@ class TMDb: elif tmdb_type == "List": self.get_list(tmdb_id) return tmdb_id - def get_tmdb_ids(self, method, data, is_movie): + def get_tmdb_ids(self, method, data, is_movie, region): + if not region and self.region: + region = self.region pretty = method.replace("_", " ").title().replace("Tmdb", "TMDb") media_type = "Movie" if is_movie else "Show" result_type = "tmdb" if is_movie else "tmdb_show" @@ -286,13 +290,13 @@ class TMDb: logger.info(f" {attr}: {value}") elif method in int_builders: if method == "tmdb_popular": - results = self.TMDb.popular_movies() if is_movie else self.TMDb.popular_tv() + results = self.TMDb.popular_movies(region=region) if is_movie else self.TMDb.popular_tv() elif method == "tmdb_top_rated": - results = self.TMDb.top_rated_movies() if is_movie else self.TMDb.top_rated_tv() + results = self.TMDb.top_rated_movies(region=region) if is_movie else self.TMDb.top_rated_tv() elif method == "tmdb_now_playing": - results = self.TMDb.now_playing_movies() + results = self.TMDb.now_playing_movies(region=region) elif method == "tmdb_upcoming": - results = self.TMDb.upcoming_movies() + results = self.TMDb.upcoming_movies(region=region) elif method == "tmdb_airing_today": results = self.TMDb.tv_airing_today() elif method == "tmdb_on_the_air":