[1] minor fixes

This commit is contained in:
meisnate12 2022-04-17 13:40:23 -04:00
parent 3dff8fbee8
commit 4d014c9512
6 changed files with 13 additions and 10 deletions

View file

@ -1 +1 @@
1.16.5
1.16.5-develop1

View file

@ -62,6 +62,7 @@ class ConfigFile:
elif os.path.exists(os.path.join(default_dir, "config.yml")): self.config_path = os.path.abspath(os.path.join(default_dir, "config.yml"))
else: raise Failed(f"Config Error: config not found at {os.path.abspath(default_dir)}")
logger.info(f"Using {self.config_path} as config")
logger.clear_errors()
self.default_dir = default_dir
self.read_only = attrs["read_only"] if "read_only" in attrs else False

View file

@ -173,7 +173,10 @@ class Mdblist:
url_base = url_base if url_base.endswith("/") else f"{url_base}/"
url_base = url_base if url_base.endswith("json/") else f"{url_base}json/"
try:
return [(i["imdb_id"], "imdb") for i in self.config.get_json(url_base, headers=headers, params=params)]
response = self.config.get_json(url_base, headers=headers, params=params)
if "error" in response:
raise Failed(f"Mdblist Error: Invalid Response {response}")
return [(i["imdb_id"], "imdb") for i in response]
except JSONDecodeError:
raise Failed(f"Mdblist Error: Invalid Response")
else:

View file

@ -7,8 +7,6 @@ from ruamel import yaml
logger = util.logger
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
all_auto = ["genre"]
ms_auto = [
"actor", "year", "content_rating", "original_language", "tmdb_popular_people", "trakt_user_lists", "studio",
@ -70,7 +68,7 @@ class DataFile:
self.templates = {}
def get_file_name(self):
data = f"{github_base}{self.path}.yml" if self.type == "GIT" else self.path
data = f"{util.github_base}{self.path}.yml" if self.type == "GIT" else self.path
if "/" in data:
return data[data.rfind("/") + 1:-4]
elif "\\" in data:
@ -83,7 +81,7 @@ class DataFile:
if file_type in ["URL", "Git", "Repo"]:
if file_type == "Repo" and not self.config.custom_repo:
raise Failed("Config Error: No custom_repo defined")
content_path = file_path if file_type == "URL" else f"{self.config.custom_repo if file_type == 'Repo' else github_base}{file_path}.yml"
content_path = file_path if file_type == "URL" else f"{self.config.custom_repo if file_type == 'Repo' else util.github_base}{file_path}.yml"
response = self.config.get(content_path)
if response.status_code >= 400:
raise Failed(f"URL Error: No file found at {content_path}")
@ -427,12 +425,12 @@ class MetadataFile(DataFile):
roles = [data for _, data in people.items()]
roles.sort(key=operator.itemgetter('count'), reverse=True)
if not person_minimum:
person_minimum = 0 if person_limit else 3
person_minimum = 1 if person_limit else 3
if not person_limit:
person_limit = len(roles)
person_count = 0
for role in roles:
if person_count < person_limit and role["count"] > person_minimum and role["name"] not in exclude:
if person_count < person_limit and role["count"] >= person_minimum and role["name"] not in exclude:
auto_list[role["name"]] = role["name"]
all_keys.append(role["name"])
person_count += 1

View file

@ -82,6 +82,7 @@ collection_mode_options = {
"hide_items": "hideItems", "hideitems": "hideItems",
"show_items": "showItems", "showitems": "showItems"
}
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
def tab_new_lines(data):
return str(data).replace("\n", "\n ") if "\n" in str(data) else str(data)
@ -556,7 +557,7 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
return f"{start}{range_split}{end}"
else:
value = check_int(value, datatype=datatype, minimum=minimum, maximum=maximum)
if value:
if value is not None:
return value
message = f"{display} {value} must {'each ' if range_split else ''}be {'an integer' if datatype == 'int' else 'a number'}"
message = f"{message} {minimum} or greater" if maximum is None else f"{message} between {minimum} and {maximum}"

View file

@ -16,7 +16,7 @@ class Webhooks:
def _request(self, webhooks, json):
if self.config.trace_mode:
logger.separator("Webhooks", space=False, border=False)
logger.separator("Webhooks", space=False, border=False, debug=True)
logger.debug("")
logger.debug(f"JSON: {json}")
for webhook in list(set(webhooks)):