[7] many minor fixes

pull/847/head
meisnate12 3 years ago
parent 62c426522f
commit d4b7819539

@ -1 +1 @@
1.16.3-develop6 1.16.3-develop7

@ -76,10 +76,11 @@ radarr:
The available attributes for each library are as follows: The available attributes for each library are as follows:
| Attribute | Values | Default | Required | | Attribute | Values | Default | Required |
|:----------------------------------|:--------------------------------------------------------------------------------------|:--------------------------------------:|:-------------------------------:| |:-------------------------------------------|:---------------------------------------------------------------------------------------------|:--------------------------------------:|:-------------------------------:|
| [`library_name`](#library-name) | Library name (required only when trying to use multiple libraries with the same name) | Base Attribute Name | ❌ | | [`library_name`](#library-name) | Library name (required only when trying to use multiple libraries with the same name) | Base Attribute Name | ❌ |
| [`metadata_path`](#metadata-path) | Location of Metadata YAML files | `/config/<<MAPPING_NAME>>.yml` | &#10060; | | [`metadata_path`](#metadata-path) | Location of Metadata YAML files | `/config/<<MAPPING_NAME>>.yml` | &#10060; |
| [`missing_path`](#missing-path) | Location to create the YAML file listing missing items for this library | `/config/<<MAPPING_NAME>>_missing.yml` | &#10060; | | [`missing_path`](#missing-path) | Location to create the YAML file listing missing items for this library | `/config/<<MAPPING_NAME>>_missing.yml` | &#10060; |
| [`schedule`](../metadata/details/schedule) | Use any [schedule option](../metadata/details/schedule) to control when this library is run. | daily | &#10060; |
| [`operations`](operations) | Library Operations to run | N/A | &#10060; | | [`operations`](operations) | Library Operations to run | N/A | &#10060; |
| [`settings`](settings) | Any `setting` attribute that overrides a global value | global | &#10060; | | [`settings`](settings) | Any `setting` attribute that overrides a global value | global | &#10060; |
| [`plex`](plex) | Any `plex` attribute that overrides a global value | global | &#9989; Either here or globally | | [`plex`](plex) | Any `plex` attribute that overrides a global value | global | &#9989; Either here or globally |

@ -173,7 +173,7 @@ all_filters = boolean_filters + special_filters + \
[f"{f}{m}" for f in date_filters for m in date_modifiers] + \ [f"{f}{m}" for f in date_filters for m in date_modifiers] + \
[f"{f}{m}" for f in number_filters for m in number_modifiers] [f"{f}{m}" for f in number_filters for m in number_modifiers]
smart_invalid = ["collection_order", "collection_level"] smart_invalid = ["collection_order", "collection_level"]
smart_url_invalid = ["minimum_items", "filters", "run_again", "sync_mode", "show_filtered", "show_missing", "save_missing", "smart_label"] + radarr_details + sonarr_details smart_url_invalid = ["filters", "run_again", "sync_mode", "show_filtered", "show_missing", "save_missing", "smart_label"] + radarr_details + sonarr_details
custom_sort_builders = [ custom_sort_builders = [
"plex_search", "plex_pilots", "tmdb_list", "tmdb_popular", "tmdb_now_playing", "tmdb_top_rated", "plex_search", "plex_pilots", "tmdb_list", "tmdb_popular", "tmdb_now_playing", "tmdb_top_rated",
"tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", "reciperr_list", "trakt_chart", "trakt_userlist", "tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", "reciperr_list", "trakt_chart", "trakt_userlist",
@ -463,13 +463,28 @@ class CollectionBuilder:
else: else:
logger.debug(f"Value: {self.data[methods['tmdb_person']]}") logger.debug(f"Value: {self.data[methods['tmdb_person']]}")
valid_names = [] valid_names = []
for tmdb_id in util.get_int_list(self.data[methods["tmdb_person"]], "TMDb Person ID"): for tmdb_person in util.get_list(self.data[methods["tmdb_person"]]):
person = self.config.TMDb.get_person(tmdb_id) try:
person = self.config.TMDb.get_person(util.regex_first_int(tmdb_person, "TMDb Person ID"))
valid_names.append(person.name) valid_names.append(person.name)
if person.biography: if person.biography:
self.summaries["tmdb_person"] = person.biography self.summaries["tmdb_person"] = person.biography
if person.profile_url: if person.profile_url:
self.posters["tmdb_person"] = person.profile_url self.posters["tmdb_person"] = person.profile_url
except Failed as e:
if str(e).startswith("TMDb Error"):
logger.error(e)
else:
try:
results = self.config.TMDb.search_people(tmdb_person)
if results:
valid_names.append(results[0].name)
if results[0].biography:
self.summaries["tmdb_person"] = results[0].biography
if results[0].profile_url:
self.posters["tmdb_person"] = results[0].profile_url
except Failed as ee:
logger.error(ee)
if len(valid_names) > 0: if len(valid_names) > 0:
self.details["tmdb_person"] = valid_names self.details["tmdb_person"] = valid_names
else: else:

@ -3,7 +3,6 @@ from datetime import datetime
from modules import plex, ergast, util from modules import plex, ergast, util
from modules.util import Failed, ImageData from modules.util import Failed, ImageData
from plexapi.exceptions import NotFound, BadRequest from plexapi.exceptions import NotFound, BadRequest
from tmdbapis import NotFound as TMDbNotFound
from ruamel import yaml from ruamel import yaml
logger = util.logger logger = util.logger
@ -390,8 +389,6 @@ class MetadataFile(DataFile):
person_depth = util.parse("Config", "depth", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=3, minimum=1) person_depth = util.parse("Config", "depth", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=3, minimum=1)
person_minimum = util.parse("Config", "minimum", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=3, minimum=1) if "minimum" in person_methods else None person_minimum = util.parse("Config", "minimum", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=3, minimum=1) if "minimum" in person_methods else None
person_limit = util.parse("Config", "limit", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=25, minimum=1) if "limit" in person_methods else None person_limit = util.parse("Config", "limit", dynamic_data, parent=f"{map_name} data", methods=person_methods, datatype="int", default=25, minimum=1) if "limit" in person_methods else None
if not person_minimum and not person_limit:
person_minimum = 3
for i, item in enumerate(library.get_all(), 1): for i, item in enumerate(library.get_all(), 1):
try: try:
self.library.reload(item) self.library.reload(item)
@ -403,19 +400,16 @@ class MetadataFile(DataFile):
logger.error(f"Plex Error: {e}") logger.error(f"Plex Error: {e}")
roles = [data for _, data in people.items()] roles = [data for _, data in people.items()]
roles.sort(key=operator.itemgetter('count'), reverse=True) roles.sort(key=operator.itemgetter('count'), reverse=True)
if not person_minimum:
person_minimum = 0 if person_limit else 3
if not person_limit:
person_limit = len(roles)
person_count = 0 person_count = 0
for role in roles: for role in roles:
if (person_limit and person_count >= person_limit) or (person_minimum and role["count"] < person_minimum): if person_count < person_limit and role["count"] > person_minimum and role["name"] not in exclude:
break auto_list[role["name"]] = role["name"]
if role["name"] not in exclude:
try:
results = self.config.TMDb.search_people(role["name"])
if results[0].id not in exclude:
auto_list[str(results[0].id)] = results[0].name
person_count += 1 person_count += 1
except TMDbNotFound: default_template = {"plex_search": {"any": {auto_type: "<<value>>"}}}
logger.error(f"TMDb Error: Actor {role['name']} Not Found")
default_template = {"tmdb_person": "<<value>>", "plex_search": {"all": {auto_type: "tmdb"}}}
elif auto_type == "trakt_user_lists": elif auto_type == "trakt_user_lists":
dynamic_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="list") dynamic_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="list")
for option in dynamic_data: for option in dynamic_data:

@ -234,7 +234,10 @@ class TMDb:
return {str(p.id): p.name for p in self.TMDb.popular_people().get_results(limit)} return {str(p.id): p.name for p in self.TMDb.popular_people().get_results(limit)}
def search_people(self, name): def search_people(self, name):
try:
return self.TMDb.people_search(name) return self.TMDb.people_search(name)
except NotFound:
raise Failed(f"TMDb Error: Actor {name} Not Found")
def validate_tmdb_ids(self, tmdb_ids, tmdb_method): def validate_tmdb_ids(self, tmdb_ids, tmdb_method):
tmdb_list = util.get_int_list(tmdb_ids, f"TMDb {type_map[tmdb_method]} ID") tmdb_list = util.get_int_list(tmdb_ids, f"TMDb {type_map[tmdb_method]} ID")

@ -408,5 +408,8 @@ class Trakt:
elif method == "trakt_userlist": elif method == "trakt_userlist":
logger.info(f"Processing {pretty} {media_type}s from {data['user']}'s {data['userlist'].capitalize()}") logger.info(f"Processing {pretty} {media_type}s from {data['user']}'s {data['userlist'].capitalize()}")
return self._userlist(data["userlist"], data["user"], is_movie, sort_by=data["sort_by"]) return self._userlist(data["userlist"], data["user"], is_movie, sort_by=data["sort_by"])
elif method == "trakt_boxoffice":
logger.info(f"Processing {pretty}: {data} {media_type}{'' if data == 1 else 's'}")
return self._charts("boxoffice", is_movie, {"limit": data})
else: else:
raise Failed(f"Trakt Error: Method {method} not supported") raise Failed(f"Trakt Error: Method {method} not supported")

@ -640,20 +640,27 @@ def library_operations(config, library):
batch_display += f"\n{library.edit_tags('genre', item, sync_tags=new_genres)}" batch_display += f"\n{library.edit_tags('genre', item, sync_tags=new_genres)}"
if library.mass_audience_rating_update: if library.mass_audience_rating_update:
try:
new_rating = get_rating(library.mass_audience_rating_update) new_rating = get_rating(library.mass_audience_rating_update)
if new_rating is None: if new_rating is None:
logger.info(f"{item.title[:25]:<25} | No Rating Found") logger.info(f"{item.title[:25]:<25} | No Rating Found")
elif str(item.audienceRating) != str(new_rating): elif str(item.audienceRating) != str(new_rating):
item.editField("audienceRating", new_rating) item.editField("audienceRating", new_rating)
batch_display += f"\n{item.title[:25]:<25} | Audience Rating | {new_rating}" batch_display += f"\n{item.title[:25]:<25} | Audience Rating | {new_rating}"
except Failed:
pass
if library.mass_critic_rating_update: if library.mass_critic_rating_update:
try:
new_rating = get_rating(library.mass_critic_rating_update) new_rating = get_rating(library.mass_critic_rating_update)
if new_rating is None: if new_rating is None:
logger.info(f"{item.title[:25]:<25} | No Rating Found") logger.info(f"{item.title[:25]:<25} | No Rating Found")
elif str(item.rating) != str(new_rating): elif str(item.rating) != str(new_rating):
item.editField("rating", new_rating) item.editField("rating", new_rating)
batch_display += f"{item.title[:25]:<25} | Critic Rating | {new_rating}" batch_display += f"{item.title[:25]:<25} | Critic Rating | {new_rating}"
except Failed:
pass
if library.mass_content_rating_update or library.content_rating_mapper: if library.mass_content_rating_update or library.content_rating_mapper:
try: try:
new_rating = None new_rating = None
@ -1210,7 +1217,7 @@ try:
valid_times.append(datetime.strftime(datetime.strptime(time_to_run, "%H:%M"), "%H:%M")) valid_times.append(datetime.strftime(datetime.strptime(time_to_run, "%H:%M"), "%H:%M"))
except ValueError: except ValueError:
if time_to_run: if time_to_run:
raise Failed(f"Argument Error: time argument invalid: {time_to_run} must be in the HH:MM format") raise Failed(f"Argument Error: time argument invalid: {time_to_run} must be in the HH:MM format between 00:00-23:59")
else: else:
raise Failed(f"Argument Error: blank time argument") raise Failed(f"Argument Error: blank time argument")
for time_to_run in valid_times: for time_to_run in valid_times:

Loading…
Cancel
Save