Merge branch 'meisnate12:nightly' into nightly

pull/1261/head
YozoraXCII 2 years ago committed by GitHub
commit 416cde00eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
1.18.2-develop9 1.18.2-develop12

@ -279,8 +279,7 @@ class Library(ABC):
self.report_data[collection][other] = [] self.report_data[collection][other] = []
self.report_data[collection][other].append(title) self.report_data[collection][other].append(title)
with open(self.report_path, "w"): pass yaml = YAML(self.report_path, start_empty=True)
yaml = YAML(self.report_path)
yaml.data = self.report_data yaml.data = self.report_data
yaml.save() yaml.save()

@ -306,8 +306,8 @@ class DataFile:
conditionals[k] = v conditionals[k] = v
language = variables["language"] if "language" in variables else "default" language = variables["language"] if "language" in variables else "default"
translation_variables = {k: v[language if language in v else "default"] for k, v in self.translations.items()} translation_variables = {k: v[language if language in v else "default"] for k, v in self.translations.items() if k not in optional}
translation_variables.update({k: v[language if language in v else "default"] for k, v in self.translation_variables.items() if language in v or "default" in v}) translation_variables.update({k: v[language if language in v else "default"] for k, v in self.translation_variables.items() if (language in v or "default" in v) and k not in optional})
key_name_variables = {} key_name_variables = {}
for var_key, var_value in self.key_names.items(): for var_key, var_value in self.key_names.items():
if var_key == "library_type" and language in var_value: if var_key == "library_type" and language in var_value:
@ -474,8 +474,16 @@ class DataFile:
return og_txt return og_txt
elif str(og_txt) == f"<<{var}>>": elif str(og_txt) == f"<<{var}>>":
return actual_value return actual_value
elif f"<<{var}>>" in str(og_txt): elif f"<<{var}" in str(og_txt):
return str(og_txt).replace(f"<<{var}>>", str(actual_value)) final = str(og_txt).replace(f"<<{var}>>", str(actual_value)) if f"<<{var}>>" in str(og_txt) else str(og_txt)
if f"<<{var}" in final:
match = re.search(f"<<({var}([+-])(\d+))>>", final)
if match:
try:
final = final.replace(f"<<{match.group(1)}>>", str(int(actual_value) + (int(match.group(3)) * (-1 if match.group(2) == "-" else 1))))
except ValueError:
raise Failed(f"Template Error: {actual_value} must be a number to use {match.group(1)}")
return final
else: else:
return og_txt return og_txt
if _debug: if _debug:

@ -931,7 +931,7 @@ def get_system_fonts():
return system_fonts return system_fonts
class YAML: class YAML:
def __init__(self, path=None, input_data=None, check_empty=False, create=False): def __init__(self, path=None, input_data=None, check_empty=False, create=False, start_empty=False):
self.path = path self.path = path
self.input_data = input_data self.input_data = input_data
self.yaml = ruamel.yaml.YAML() self.yaml = ruamel.yaml.YAML()
@ -940,7 +940,7 @@ class YAML:
if input_data: if input_data:
self.data = self.yaml.load(input_data) self.data = self.yaml.load(input_data)
else: else:
if create and not os.path.exists(self.path): if start_empty or (create and not os.path.exists(self.path)):
with open(self.path, 'w'): with open(self.path, 'w'):
pass pass
self.data = {} self.data = {}

@ -1,4 +1,5 @@
import argparse, os, platform, psutil, sys, time, uuid import argparse, os, platform, psutil, sys, time, uuid
from collections import Counter
from concurrent.futures import ProcessPoolExecutor from concurrent.futures import ProcessPoolExecutor
from datetime import datetime from datetime import datetime
from modules.logs import MyLogger from modules.logs import MyLogger
@ -274,6 +275,32 @@ def start(attrs):
version_line = f"Version: {version[0]}" version_line = f"Version: {version[0]}"
if new_version: if new_version:
version_line = f"{version_line} Newest Version: {new_version}" version_line = f"{version_line} Newest Version: {new_version}"
try:
log_data = {}
with open(logger.main_log, encoding="utf-8") as f:
for log_line in f:
for err_type in ["WARNING", "ERROR", "CRITICAL"]:
if f"[{err_type}]" in log_line:
log_line = log_line.split("|")[1].strip()
if err_type not in log_data:
log_data[err_type] = []
log_data[err_type].append(log_line)
for err_type in ["WARNING", "ERROR", "CRITICAL"]:
if err_type not in log_data:
continue
logger.separator(f"{err_type.lower().capitalize()} Summary", space=False, border=False)
logger.info("")
logger.info(f"Count | Message")
logger.separator(f"{logger.separating_character * 5}|", space=False, border=False, side_space=False, left=True)
for k, v in Counter(log_data[err_type]).most_common():
logger.info(f"{v:>5} | {k}")
logger.info("")
except Failed as e:
logger.stacktrace()
logger.error(f"Report Error: {e}")
logger.separator(f"Finished {start_type}Run\n{version_line}\nFinished: {end_time.strftime('%H:%M:%S %Y-%m-%d')} Run Time: {run_time}") logger.separator(f"Finished {start_type}Run\n{version_line}\nFinished: {end_time.strftime('%H:%M:%S %Y-%m-%d')} Run Time: {run_time}")
logger.remove_main_handler() logger.remove_main_handler()

Loading…
Cancel
Save