[40] [WIP] [Config] Detect/Copy/Download config.yml from `config.yml.template` (#2378)

pull/2417/head
YozoraXCII 1 week ago committed by GitHub Action
parent 34696c71df
commit 606e34bbd1

@ -17,6 +17,7 @@ Added the `character` search option to the `imdb_search` builder
Added ability to use Show-level ratings at the season and episode level for Overlays if the original source does not provide ratings at the season or episode level. This is accomplished using (Special Text Variables)[https://kometa.wiki/en/latest/files/overlays/#special-text-variables] but is not yet available for the `Ratings` Defaults file.
Add `show_unfiltered` setting to display items which make it through a filter
Allow `sync_to_trakt_list` on episode-level collections
Logic added to Kometa to create `config.yml` if it does not exist from the `config.yml.template` file. If the template file cannot be found, Kometa will attempt to download it from GitHub.
When using `mass_poster_update`, added `ignore_locked` and `ignore_overlays` attributes which will prevent Kometa from resetting the image if the poster field is locked (i.e. a previous mass poster update) or if the item has an Overlay. This can effectively act as a differential update system.
When using `mass_background_update`, added `ignore_locked` attribute which will prevent Kometa from resetting the image if the poster field is locked (i.e. a previous mass poster update). This can effectively act as a differential update system.
Add `date` option for schedules
@ -53,4 +54,3 @@ Fixes #2354 by updating version of tmdbapi dependency
Added Start Time, Finished and Run Time to Summary of run.
Fixed an issue where custom repositories would not work correctly if the URL did not end in a trailing `/` character.
Kometa will now check for `.yaml` extension in filenames if `.yml` is not found and vice-versa

@ -1 +1 @@
2.1.0-build39
2.1.0-build40

@ -5,9 +5,11 @@ connection details needed to connect to Plex Media Server, Radarr, Sonarr, and o
By default, and unless otherwise stated, Kometa looks for the configuration file at `/config/config.yml`.
A template Configuration File can be found in the
A template Configuration Template File can be found in the
[GitHub Repo](https://github.com/Kometa-Team/Kometa/blob/master/config/config.yml.template).
If Kometa cannot find the `config.yml` at the default location, it will attempt to rename `config.yml.template` for the user. If the template file cannot be found, Kometa will attempt to download a copy from the GitHub repository in line with the user's current branch. If this also fails, the user will have to download the Configuration Template File from the above link and manually rename it to `config.yml`
This table outlines the third-party services that Kometa can make use of. Each service has specific
requirements for setup that can be found by clicking the links within the table or in the sidebar.
@ -31,9 +33,10 @@ requirements for setup that can be found by clicking the links within the table
| [`trakt`](trakt.md) | :fontawesome-solid-circle-xmark:{ .red } |
| [`mal`](myanimelist.md) | :fontawesome-solid-circle-xmark:{ .red } |
## Configuration File Example
## Configuration Template File Example
This example outlines what a "standard" config.yml file might look like when in use.
The below in an extract of the `config.yml.template` and is the initial values that are set if you follow any of the
installation guides.
~~~yaml
{%

@ -1,4 +1,4 @@
import argparse, os, platform, re, sys, time, uuid
import argparse, os, platform, re, sys, time, uuid, requests
from collections import Counter
from concurrent.futures import ProcessPoolExecutor
from datetime import datetime
@ -191,11 +191,42 @@ if run_args["width"] < 90 or run_args["width"] > 300:
if run_args["config"] and os.path.exists(run_args["config"]):
default_dir = os.path.join(os.path.dirname(os.path.abspath(run_args["config"])))
elif run_args["config"] and not os.path.exists(run_args["config"]):
print(f"Config Error: config 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)
elif not os.path.exists(os.path.join(default_dir, "config.yml")):
print(f"Config Error: config not found at {os.path.abspath(default_dir)}")
sys.exit(0)
template_path = os.path.join(default_dir, "config.yml.template")
config_path = os.path.join(default_dir, "config.yml")
if os.path.exists(template_path):
try:
with open(template_path, 'r') as template_file:
content = template_file.read()
with open(config_path, 'w') as config_file:
config_file.write(content)
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.")
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)
else:
github_branch = git_branch if git_branch else "master"
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)
logger = MyLogger("Kometa", default_dir, run_args["width"], run_args["divider"][0], run_args["ignore-ghost"],
run_args["tests"] or run_args["debug"], run_args["trace"], run_args["log-requests"])

Loading…
Cancel
Save