default config thingie

This commit is contained in:
Hazel 2023-09-12 13:56:40 +02:00
parent bc03568949
commit e25f788b50
3 changed files with 22 additions and 23 deletions

View File

@ -1,6 +1,7 @@
from typing import Any, Tuple, Union from typing import Any, Tuple, Union, List
from pathlib import Path from pathlib import Path
import logging import logging
from datetime import datetime
import toml import toml
@ -31,10 +32,26 @@ class ConfigDict(dict):
class Config: 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.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.loaded_settings: ConfigDict = ConfigDict(self)
self.attribute_map = {} self.attribute_map = {}

View File

@ -1,5 +1,4 @@
from typing import TypedDict, List from typing import TypedDict, List
from datetime import datetime
from urllib.parse import ParseResult from urllib.parse import ParseResult
from logging import Logger from logging import Logger
from pathlib import Path from pathlib import Path
@ -14,21 +13,6 @@ from ..attributes.special_attributes import (
) )
config = Config([ 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="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."), 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. AudioFormatAttribute(name="audio_format", default_value="mp3", description="""Music Kraken will stream the audio into this format.

View File

@ -16,8 +16,7 @@ def get_random_message() -> str:
HIGHEST_ID = 2**main_settings['id_bits'] HIGHEST_ID = 2**main_settings['id_bits']
HELP_MESSAGE = """ HELP_MESSAGE = """to search:
to search:
> s: {query or url} > s: {query or url}
> s: https://musify.club/release/some-random-release-183028492 > s: https://musify.club/release/some-random-release-183028492
> s: #a {artist} #r {release} #t {track} > s: #a {artist} #r {release} #t {track}
@ -28,5 +27,4 @@ to download:
> d: 1 > d: 1
> d: https://musify.club/release/some-random-release-183028492 > d: https://musify.club/release/some-random-release-183028492
have fun :3 have fun :3""".strip()
""".strip()