[14] tmdb update

pull/811/head
meisnate12 3 years ago
parent 2efc79fa2c
commit 1679fabbdf

@ -18,5 +18,5 @@ jobs:
webhook_token: ${{ secrets.DEVELOP_WEBHOOK_TOKEN }}
title: Plex Meta Manager Develop Push
commits: "true"
username: PMM Develop
username: Metabot
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/develop/.github/pmm.png

@ -18,5 +18,6 @@ jobs:
webhook_token: ${{ secrets.RELEASE_WEBHOOK_TOKEN }}
release: true
title: Plex Meta Manager Release VERSION
username: PMM Releases
username: Metabot
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/pmm.png
message: "@everyone"

@ -1 +1 @@
1.16.2-develop13
1.16.2-develop14

@ -45,7 +45,7 @@ method_alias = {
"anilist_tag": "anilist_search", "anilist_genre": "anilist_search", "anilist_season": "anilist_search",
"mal_producer": "mal_studio", "mal_licensor": "mal_studio",
"trakt_recommended": "trakt_recommended_weekly", "trakt_watched": "trakt_watched_weekly", "trakt_collected": "trakt_collected_weekly",
"collection_changes_webhooks": "changes_webhooks", "sort_by": "collection_order",
"collection_changes_webhooks": "changes_webhooks",
"radarr_add": "radarr_add_missing", "sonarr_add": "sonarr_add_missing",
}
filter_translation = {
@ -1182,9 +1182,8 @@ class CollectionBuilder:
raise Failed(f"{self.Type} Error: {method_name} {discover_method} attribute only works for show libraries")
elif self.library.is_show and discover_attr in tmdb.discover_movie_only:
raise Failed(f"{self.Type} Error: {method_name} {discover_method} attribute only works for movie libraries")
elif discover_attr in ["language", "region"]:
regex = ("([a-z]{2})-([A-Z]{2})", "en-US") if discover_attr == "language" else ("^[A-Z]{2}$", "US")
new_dictionary[discover_attr] = util.parse(self.Type, discover_attr, discover_data, parent=method_name, regex=regex)
elif discover_attr == "region":
new_dictionary[discover_attr] = util.parse(self.Type, discover_attr, discover_data, 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
new_dictionary[discover_method] = util.parse(self.Type, discover_attr, discover_data, parent=method_name, options=options)
@ -1209,20 +1208,20 @@ class CollectionBuilder:
else:
raise Failed(f"{self.Type} Error: {method_name} {discover_method} attribute: must be used with watch_region")
elif discover_attr in tmdb.discover_booleans:
new_dictionary[discover_attr] = util.parse(self.Type, discover_attr, discover_data, datatype="bool", parent=method_name)
new_dictionary[discover_method] = util.parse(self.Type, discover_attr, discover_data, datatype="bool", parent=method_name)
elif discover_attr == "vote_average":
new_dictionary[discover_method] = util.parse(self.Type, discover_method, discover_data, datatype="float", parent=method_name)
elif discover_attr == "with_status":
new_dictionary[discover_attr] = util.parse(self.Type, discover_attr, discover_data, datatype="int", parent=method_name, minimum=0, maximum=5)
new_dictionary[discover_method] = util.parse(self.Type, discover_attr, discover_data, datatype="int", parent=method_name, minimum=0, maximum=5)
elif discover_attr == "with_type":
new_dictionary[discover_attr] = util.parse(self.Type, discover_attr, discover_data, datatype="int", parent=method_name, minimum=0, maximum=6)
elif discover_method in tmdb.discover_dates:
new_dictionary[discover_method] = util.parse(self.Type, discover_attr, discover_data, datatype="int", parent=method_name, minimum=0, maximum=6)
elif discover_attr in tmdb.discover_dates:
new_dictionary[discover_method] = util.validate_date(discover_data, f"{method_name} {discover_method} attribute", return_as="%m/%d/%Y")
elif discover_attr in tmdb.discover_years:
new_dictionary[discover_attr] = util.parse(self.Type, discover_attr, discover_data, datatype="int", parent=method_name, minimum=1800, maximum=self.current_year + 1)
new_dictionary[discover_method] = util.parse(self.Type, discover_attr, discover_data, datatype="int", parent=method_name, minimum=1800, maximum=self.current_year + 1)
elif discover_attr in tmdb.discover_ints:
new_dictionary[discover_method] = util.parse(self.Type, discover_method, discover_data, datatype="int", parent=method_name)
elif discover_method in tmdb.discover_strings:
elif discover_attr in tmdb.discover_strings:
new_dictionary[discover_method] = discover_data
elif discover_attr != "limit":
raise Failed(f"{self.Type} Error: {method_name} {discover_method} attribute not supported")

@ -33,7 +33,7 @@ logger = util.logger
sync_modes = {"append": "Only Add Items to the Collection or Playlist", "sync": "Add & Remove Items from the Collection or Playlist"}
mass_genre_options = {"tmdb": "Use TMDb Metadata", "omdb": "Use IMDb Metadata through OMDb", "tvdb": "Use TVDb Metadata", "anidb": "Use AniDB Tag Metadata"}
mass_content_options = {"omdb": "Use IMDb Metadata through OMDb", "mdb": "Use MdbList Metadata", "mdb_commonsense": "Use Commonsense Rating through MDbList"}
mass_content_options = {"tmdb": "Use TMDb Metadata", "omdb": "Use IMDb Metadata through OMDb", "mdb": "Use MdbList Metadata", "mdb_commonsense": "Use Commonsense Rating through MDbList"}
mass_available_options = {"tmdb": "Use TMDb Metadata", "omdb": "Use IMDb Metadata through OMDb", "mdb": "Use MdbList Metadata", "tvdb": "Use TVDb Metadata", "anidb": "Use AniDB Metadata"}
imdb_label_options = {"with_none": "Add IMDb Parental Labels including None", "without_none": "Add IMDb Parental Labels including None"}
mass_rating_options = {

@ -19,17 +19,6 @@ type_map = {
"tmdb_network": "Network", "tmdb_person": "Person", "tmdb_producer": "Person", "tmdb_producer_details": "Person",
"tmdb_show": "Show", "tmdb_show_details": "Show", "tmdb_writer": "Person", "tmdb_writer_details": "Person"
}
discover_all = [
"with_overview_translation", "with_original_language", "region", "sort_by", "with_cast", "with_crew", "with_people",
"certification_country", "certification", "certification.lte", "certification.gte",
"year", "primary_release_year", "primary_release_date.gte", "primary_release_date.lte",
"release_date.gte", "release_date.lte", "vote_count.gte", "vote_count.lte",
"vote_average.gte", "vote_average.lte", "with_runtime.gte", "with_runtime.lte",
"with_companies", "without_companies ", "with_genres", "without_genres", "with_keywords", "without_keywords",
"with_watch_providers", "without_watch_providers", "watch_region", "with_watch_monetization_types", "with_status",
"include_adult", "include_video", "timezone", "screened_theatrically", "include_null_first_air_dates", "limit", "with_type",
"air_date.gte", "air_date.lte", "first_air_date.gte", "first_air_date.lte", "first_air_date_year", "with_networks", "with_release_type"
]
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"
@ -39,16 +28,24 @@ discover_tv_only = [
"first_air_date_year", "with_networks", "with_status", "with_type", "with_name_translation"
]
discover_strings = [
"with_cast", "with_crew", "with_people", "with_companies", "with_networks", "with_genres", "without_genres", "with_release_type",
"with_keywords", "without_keywords", "with_original_language", "timezone", "with_watch_providers", "without_watch_providers"
"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",
"with_watch_providers", "without_watch_providers", "with_overview_translation", "with_title_translation", "with_name_translation"
]
discover_ints = ["vote_count", "with_runtime"]
modifiers = [".gte", ".lte"]
discover_years = ["primary_release_year", "year", "first_air_date_year"]
discover_booleans = ["include_adult", "include_video", "include_null_first_air_dates", "screened_theatrically"]
discover_dates = [
"primary_release_date.gte", "primary_release_date.lte", "release_date.gte", "release_date.lte",
"air_date.gte", "air_date.lte", "first_air_date.gte", "first_air_date.lte"
discover_dates = ["primary_release_date", "release_date", "air_date", "first_air_date"]
date_methods = [f"{f}{m}" for f in discover_dates for m in modifiers]
discover_numbers = ["vote_average"]
discover_special = [
"region", "sort_by", "certification_country", "certification", "certification.lte", "certification.gte",
"watch_region", "with_watch_monetization_types", "with_status", "limit", "with_type"
]
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",
@ -272,7 +269,7 @@ class TMDb:
elif method == "tmdb_discover":
attrs = data.copy()
limit = int(attrs.pop("limit"))
for date_attr in discover_dates:
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 self.config.trace_mode:

@ -503,7 +503,8 @@ def library_operations(config, library):
tmdb_item = None
if library.tmdb_collections or library.mass_genre_update == "tmdb" or library.mass_audience_rating_update == "tmdb" \
or library.mass_critic_rating_update == "tmdb" or library.mass_originally_available_update == "tmdb":
or library.mass_critic_rating_update == "tmdb" or library.mass_originally_available_update == "tmdb" \
or library.mass_content_rating_update == "tmdb":
tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=library.is_movie)
omdb_item = None
@ -665,6 +666,8 @@ def library_operations(config, library):
new_rating = mdb_item.content_rating if mdb_item.content_rating else None
elif mdb_item and library.mass_content_rating_update == "mdb_commonsense":
new_rating = mdb_item.commonsense if mdb_item.commonsense else None
elif tmdb_item and library.mass_content_rating_update == "tmdb":
new_rating = tmdb_item.content_rating if tmdb_item.content_rating else None
else:
raise Failed
if new_rating is None:

Loading…
Cancel
Save