mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-26 06:20:23 +00:00
[1] minor fixes
This commit is contained in:
parent
3dff8fbee8
commit
4d014c9512
6 changed files with 13 additions and 10 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
1.16.5
|
1.16.5-develop1
|
||||||
|
|
|
@ -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"))
|
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)}")
|
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.info(f"Using {self.config_path} as config")
|
||||||
|
logger.clear_errors()
|
||||||
|
|
||||||
self.default_dir = default_dir
|
self.default_dir = default_dir
|
||||||
self.read_only = attrs["read_only"] if "read_only" in attrs else False
|
self.read_only = attrs["read_only"] if "read_only" in attrs else False
|
||||||
|
|
|
@ -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("/") else f"{url_base}/"
|
||||||
url_base = url_base if url_base.endswith("json/") else f"{url_base}json/"
|
url_base = url_base if url_base.endswith("json/") else f"{url_base}json/"
|
||||||
try:
|
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:
|
except JSONDecodeError:
|
||||||
raise Failed(f"Mdblist Error: Invalid Response")
|
raise Failed(f"Mdblist Error: Invalid Response")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -7,8 +7,6 @@ from ruamel import yaml
|
||||||
|
|
||||||
logger = util.logger
|
logger = util.logger
|
||||||
|
|
||||||
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
|
|
||||||
|
|
||||||
all_auto = ["genre"]
|
all_auto = ["genre"]
|
||||||
ms_auto = [
|
ms_auto = [
|
||||||
"actor", "year", "content_rating", "original_language", "tmdb_popular_people", "trakt_user_lists", "studio",
|
"actor", "year", "content_rating", "original_language", "tmdb_popular_people", "trakt_user_lists", "studio",
|
||||||
|
@ -70,7 +68,7 @@ class DataFile:
|
||||||
self.templates = {}
|
self.templates = {}
|
||||||
|
|
||||||
def get_file_name(self):
|
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:
|
if "/" in data:
|
||||||
return data[data.rfind("/") + 1:-4]
|
return data[data.rfind("/") + 1:-4]
|
||||||
elif "\\" in data:
|
elif "\\" in data:
|
||||||
|
@ -83,7 +81,7 @@ class DataFile:
|
||||||
if file_type in ["URL", "Git", "Repo"]:
|
if file_type in ["URL", "Git", "Repo"]:
|
||||||
if file_type == "Repo" and not self.config.custom_repo:
|
if file_type == "Repo" and not self.config.custom_repo:
|
||||||
raise Failed("Config Error: No custom_repo defined")
|
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)
|
response = self.config.get(content_path)
|
||||||
if response.status_code >= 400:
|
if response.status_code >= 400:
|
||||||
raise Failed(f"URL Error: No file found at {content_path}")
|
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 = [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:
|
if not person_minimum:
|
||||||
person_minimum = 0 if person_limit else 3
|
person_minimum = 1 if person_limit else 3
|
||||||
if not person_limit:
|
if not person_limit:
|
||||||
person_limit = len(roles)
|
person_limit = len(roles)
|
||||||
person_count = 0
|
person_count = 0
|
||||||
for role in roles:
|
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"]
|
auto_list[role["name"]] = role["name"]
|
||||||
all_keys.append(role["name"])
|
all_keys.append(role["name"])
|
||||||
person_count += 1
|
person_count += 1
|
||||||
|
|
|
@ -82,6 +82,7 @@ collection_mode_options = {
|
||||||
"hide_items": "hideItems", "hideitems": "hideItems",
|
"hide_items": "hideItems", "hideitems": "hideItems",
|
||||||
"show_items": "showItems", "showitems": "showItems"
|
"show_items": "showItems", "showitems": "showItems"
|
||||||
}
|
}
|
||||||
|
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
|
||||||
|
|
||||||
def tab_new_lines(data):
|
def tab_new_lines(data):
|
||||||
return str(data).replace("\n", "\n ") if "\n" in str(data) else str(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}"
|
return f"{start}{range_split}{end}"
|
||||||
else:
|
else:
|
||||||
value = check_int(value, datatype=datatype, minimum=minimum, maximum=maximum)
|
value = check_int(value, datatype=datatype, minimum=minimum, maximum=maximum)
|
||||||
if value:
|
if value is not None:
|
||||||
return value
|
return value
|
||||||
message = f"{display} {value} must {'each ' if range_split else ''}be {'an integer' if datatype == 'int' else 'a number'}"
|
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}"
|
message = f"{message} {minimum} or greater" if maximum is None else f"{message} between {minimum} and {maximum}"
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Webhooks:
|
||||||
|
|
||||||
def _request(self, webhooks, json):
|
def _request(self, webhooks, json):
|
||||||
if self.config.trace_mode:
|
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("")
|
||||||
logger.debug(f"JSON: {json}")
|
logger.debug(f"JSON: {json}")
|
||||||
for webhook in list(set(webhooks)):
|
for webhook in list(set(webhooks)):
|
||||||
|
|
Loading…
Reference in a new issue