From e25f788b50c77ba702050c943de0b0bad73e5a85 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Tue, 12 Sep 2023 13:56:40 +0200 Subject: [PATCH] default config thingie --- src/music_kraken/utils/config/config.py | 23 ++++++++++++++++--- .../utils/config/config_files/main_config.py | 16 ------------- src/music_kraken/utils/shared.py | 6 ++--- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/music_kraken/utils/config/config.py b/src/music_kraken/utils/config/config.py index d140ec9..7f5c4b9 100644 --- a/src/music_kraken/utils/config/config.py +++ b/src/music_kraken/utils/config/config.py @@ -1,6 +1,7 @@ -from typing import Any, Tuple, Union +from typing import Any, Tuple, Union, List from pathlib import Path import logging +from datetime import datetime import toml @@ -31,10 +32,26 @@ class ConfigDict(dict): class Config: - def __init__(self, componet_list: Tuple[Union[Attribute, Description, EmptyLine]], config_file: Path) -> None: + def __init__(self, component_list: Tuple[Union[Attribute, Description, EmptyLine]], config_file: Path) -> None: self.config_file: Path = config_file - self.component_list: Tuple[Union[Attribute, Description, EmptyLine]] = componet_list + self.component_list: List[Union[Attribute, Description, EmptyLine]] = [ + Description(f"""IMPORTANT: If you modify this file, the changes for the actual setting, will be kept as is. +The changes you make to the comments, will be discarded, next time you run music-kraken. Have fun! + +Latest reset: {datetime.now()} + + _____ + / ____| + | | __ __ _ _ _ + | | |_ | / _` || | | | + | |__| || (_| || |_| | + \_____| \__,_| \__, | + __/ | + |___/ +""")] + + self.component_list.extend(component_list) self.loaded_settings: ConfigDict = ConfigDict(self) self.attribute_map = {} diff --git a/src/music_kraken/utils/config/config_files/main_config.py b/src/music_kraken/utils/config/config_files/main_config.py index 164a08a..ba6ef91 100644 --- a/src/music_kraken/utils/config/config_files/main_config.py +++ b/src/music_kraken/utils/config/config_files/main_config.py @@ -1,5 +1,4 @@ from typing import TypedDict, List -from datetime import datetime from urllib.parse import ParseResult from logging import Logger from pathlib import Path @@ -14,21 +13,6 @@ from ..attributes.special_attributes import ( ) config = Config([ - Description(f"""IMPORTANT: If you modify this file, the changes for the actual setting, will be kept as is. -The changes you make to the comments, will be discarded, next time you run music-kraken. Have fun! - -Latest reset: {datetime.now()} - - _____ - / ____| - | | __ __ _ _ _ - | | |_ | / _` || | | | - | |__| || (_| || |_| | - \_____| \__,_| \__, | - __/ | - |___/ -"""), - Attribute(name="hasnt_yet_started", default_value=False, description="This will be set automatically, to look if it needs to run the scripts that run on start."), Attribute(name="bitrate", default_value=125, description="Streams the audio with given bitrate [kB/s]. Can't stream with a higher Bitrate, than the audio source provides."), AudioFormatAttribute(name="audio_format", default_value="mp3", description="""Music Kraken will stream the audio into this format. diff --git a/src/music_kraken/utils/shared.py b/src/music_kraken/utils/shared.py index 20726f1..749b975 100644 --- a/src/music_kraken/utils/shared.py +++ b/src/music_kraken/utils/shared.py @@ -16,8 +16,7 @@ def get_random_message() -> str: HIGHEST_ID = 2**main_settings['id_bits'] -HELP_MESSAGE = """ -to search: +HELP_MESSAGE = """to search: > s: {query or url} > s: https://musify.club/release/some-random-release-183028492 > s: #a {artist} #r {release} #t {track} @@ -28,5 +27,4 @@ to download: > d: 1 > d: https://musify.club/release/some-random-release-183028492 -have fun :3 -""".strip() +have fun :3""".strip()