[45] Add Branch Detection Logging (#2421)

pull/2426/head
YozoraXCII 1 week ago committed by GitHub Action
parent 8c4b483663
commit 19a4871787

@ -245,4 +245,4 @@ jobs:
username: ${{ vars.BOT_NAME }} username: ${{ vars.BOT_NAME }}
avatar_url: ${{ vars.BOT_IMAGE }} avatar_url: ${{ vars.BOT_IMAGE }}
author: ${{ vars.GIT_NAME }} author: ${{ vars.GIT_NAME }}
author_icon_url: ${{ vars.GIT_IMAGE }} author_icon_url: ${{ vars.GIT_IMAGE }}

@ -1 +1 @@
2.1.0-build44 2.1.0-build45

@ -1,4 +1,4 @@
import argparse, os, platform, re, sys, time, uuid, requests import argparse, os, platform, re, sys, time, uuid
from collections import Counter from collections import Counter
from concurrent.futures import ProcessPoolExecutor from concurrent.futures import ProcessPoolExecutor
from datetime import datetime from datetime import datetime
@ -194,38 +194,23 @@ elif run_args["config"] and not os.path.exists(run_args["config"]):
print(f"Config Error: Configuration file (config.yml) not found at {os.path.abspath(run_args['config'])}") print(f"Config Error: Configuration file (config.yml) not found at {os.path.abspath(run_args['config'])}")
sys.exit(0) sys.exit(0)
elif not os.path.exists(os.path.join(default_dir, "config.yml")): elif not os.path.exists(os.path.join(default_dir, "config.yml")):
template_path = os.path.join(default_dir, "config.yml.template") git_branch = git_branch or "master"
github_url = f"https://raw.githubusercontent.com/Kometa-Team/Kometa/{git_branch}/config/config.yml.template"
config_path = os.path.join(default_dir, "config.yml") config_path = os.path.join(default_dir, "config.yml")
try:
if os.path.exists(template_path): response = requests.get(github_url, timeout=10)
try: if response.status_code == 200:
with open(template_path, 'r') as template_file:
content = template_file.read()
with open(config_path, 'w') as config_file: with open(config_path, 'w') as config_file:
config_file.write(content) config_file.write(response.text)
print(f"Configuration file (config.yml) created at {config_path}. Please open this file and update it with your API keys and other required settings.") print(f"Configuration File ('config.yml') has been downloaded from GitHub (Branch: '{git_branch}') and saved as '{config_path}'. Please update this file with your API keys and other required settings.")
sys.exit(1)
except Exception as e:
print(f"Config Error: Unable to copy the Template file (config.yml.template) from {template_path} to {config_path}. Details: {e}")
sys.exit(1) sys.exit(1)
else: else:
github_branch = git_branch if git_branch else "master" print(f"Config Error: Unable to download the configuration file from GitHub (URL: {github_url}'). Please save it as '{config_path}' before running Kometa again.")
github_url = f"https://raw.githubusercontent.com/Kometa-Team/Kometa/{github_branch}/config/config.yml.template"
try:
response = requests.get(github_url, timeout=10)
if response.status_code == 200:
with open(template_path, 'w') as template_file:
template_file.write(response.text)
with open(config_path, 'w') as config_file:
config_file.write(response.text)
print(f"A Configuration file (config.yml) has been downloaded from GitHub and saved as {config_path}. Please update this file with your API keys and other required settings.")
sys.exit(1)
else:
print(f"Config Error: No Configuration file (config.yml) or Template file (config.yml.template) found in the config path, and the template file(config.yml.template) could not be downloaded from GitHub. Please visit the GitHub repository to manually download the config.yml.template file and place it in {template_path} prior to running Kometa again.")
sys.exit(1)
except requests.RequestException as e:
print(f"Config Error: Failed to download the configuration template file (config.yml.template) from GitHub. Details: {e}")
sys.exit(1) sys.exit(1)
except requests.RequestException as e:
print(f"Config Error: Unable to download the configuration file from GitHub (URL: {github_url}'). Please save it as '{config_path}' before running Kometa again.")
sys.exit(1)
logger = MyLogger("Kometa", default_dir, run_args["width"], run_args["divider"][0], run_args["ignore-ghost"], logger = MyLogger("Kometa", default_dir, run_args["width"], run_args["divider"][0], run_args["ignore-ghost"],

@ -152,15 +152,14 @@ class DataFile:
content_path = os.path.abspath(os.path.join(file_path, "default.yml") if translation else file_path) content_path = os.path.abspath(os.path.join(file_path, "default.yml") if translation else file_path)
dir_path = file_path dir_path = file_path
if not os.path.exists(content_path): if not os.path.exists(content_path):
if content_path.endswith(".yml") and os.path.exists(content_path[:-4] + ".yaml"): if content_path.endswith(".yml") and os.path.exists(f"{content_path[:-4]}.yaml"):
content_path = content_path[:-4] + ".yaml" content_path = f"{content_path[:-4]}.yaml"
elif content_path.endswith(".yaml") and os.path.exists(content_path[:-5] + ".yml"): elif content_path.endswith(".yaml") and os.path.exists(f"{content_path[:-5]}.yml"):
content_path = content_path[:-5] + ".yml" content_path = f"{content_path[:-5]}.yml"
elif file_type == "Default":
raise Failed(f"File Error: Default does not exist {file_path}")
else: else:
if file_type == "Default": raise Failed(f"File Error: File does not exist {content_path}")
raise Failed(f"File Error: Default does not exist {file_path}")
else:
raise Failed(f"File Error: File does not exist {content_path}")
yaml = self.config.Requests.file_yaml(content_path, check_empty=True) yaml = self.config.Requests.file_yaml(content_path, check_empty=True)
if not translation: if not translation:
logger.debug(f"File Loaded From: {content_path}") logger.debug(f"File Loaded From: {content_path}")
@ -2367,4 +2366,4 @@ class OverlayFile(DataFile):
self.external_templates(data, overlay=True) self.external_templates(data, overlay=True)
if not self.overlays: if not self.overlays:
raise Failed("YAML Error: overlays attribute is required") raise Failed("YAML Error: overlays attribute is required")
logger.info(f"Overlay File Loaded Successfully") logger.info(f"Overlay File Loaded Successfully")

@ -790,7 +790,7 @@ class Operations:
if self.library.mass_background_update: if self.library.mass_background_update:
source = self.library.mass_background_update["source"] source = self.library.mass_background_update["source"]
ignore_locked = self.library.mass_background_update["ignore_locked"] ignore_locked = self.library.mass_background_update["ignore_locked"]
ignore_overlays = self.library.mass_poster_update["ignore_overlays"] ignore_overlays = self.library.mass_background_update["ignore_overlays"]
art_locked = any(f.name == "art" and f.locked for f in item.fields) art_locked = any(f.name == "art" and f.locked for f in item.fields)
if source in ["unlock", "lock"]: if source in ["unlock", "lock"]:

Loading…
Cancel
Save