diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index 99d9f23..599ad89 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -3,7 +3,7 @@ import logging import gc import musicbrainzngs -from .utils.old_config import read_config +from .utils.config import read_config from .utils.shared import MODIFY_GC from . import cli diff --git a/src/music_kraken/__main__.py b/src/music_kraken/__main__.py index 53ecc92..0425d5d 100644 --- a/src/music_kraken/__main__.py +++ b/src/music_kraken/__main__.py @@ -87,7 +87,7 @@ def cli(): logging.getLogger().setLevel(logging.DEBUG) from . import cli - from .utils.old_config import read_config + from .utils.config import read_config from .utils import shared if arguments.r: diff --git a/src/music_kraken/_settings/default.py b/src/music_kraken/_settings/default.py new file mode 100644 index 0000000..689f9ea --- /dev/null +++ b/src/music_kraken/_settings/default.py @@ -0,0 +1,5 @@ +from .structure import SettingStructure + +settings: SettingStructure = { + "bitrate": 125 +} \ No newline at end of file diff --git a/src/music_kraken/_settings/structure.py b/src/music_kraken/_settings/structure.py new file mode 100644 index 0000000..e5e7f2b --- /dev/null +++ b/src/music_kraken/_settings/structure.py @@ -0,0 +1,4 @@ +from typing import TypedDict + +class SettingStructure(TypedDict): + bitrate: int diff --git a/src/music_kraken/cli/main_downloader.py b/src/music_kraken/cli/main_downloader.py index 6dbaff2..ba5ee5f 100644 --- a/src/music_kraken/cli/main_downloader.py +++ b/src/music_kraken/cli/main_downloader.py @@ -5,7 +5,7 @@ import re from .utils import cli_function from .options.first_config import initial_config -from ..utils.old_config import set_name_to_value, write_config +from ..utils.config import set_name_to_value, write_config from ..utils.shared import MUSIC_DIR, NOT_A_GENRE_REGEX, ENABLE_RESULT_HISTORY, HISTORY_LENGTH, HELP_MESSAGE, HASNT_YET_STARTED from ..utils.regex import URL_PATTERN from ..utils.string_processing import fit_to_file_system diff --git a/src/music_kraken/cli/options/settings.py b/src/music_kraken/cli/options/settings.py index ce113f0..3ba0ade 100644 --- a/src/music_kraken/cli/options/settings.py +++ b/src/music_kraken/cli/options/settings.py @@ -1,6 +1,6 @@ from ..utils import cli_function -from ...utils.old_config import config, write_config +from ...utils.config import config, write_config from ...utils import exception diff --git a/src/music_kraken/pages/youtube_music/youtube_music.py b/src/music_kraken/pages/youtube_music/youtube_music.py index 0edd0d6..3653d1c 100644 --- a/src/music_kraken/pages/youtube_music/youtube_music.py +++ b/src/music_kraken/pages/youtube_music/youtube_music.py @@ -8,7 +8,7 @@ import re from ...utils.exception.config import SettingValueError from ...utils.shared import PROXIES_LIST, YOUTUBE_MUSIC_LOGGER, DEBUG -from ...utils.old_config import CONNECTION_SECTION, write_config +from ...utils.config import CONNECTION_SECTION, write_config from ...utils.functions import get_current_millis if DEBUG: from ...utils.debug_utils import dump_to_file diff --git a/src/music_kraken/utils/__init__.py b/src/music_kraken/utils/__init__.py index 429f1d6..89186a6 100644 --- a/src/music_kraken/utils/__init__.py +++ b/src/music_kraken/utils/__init__.py @@ -1 +1 @@ -from .old_config import config, read_config, write_config +from .config import config, read_config, write_config diff --git a/src/music_kraken/utils/config.py b/src/music_kraken/utils/config.py deleted file mode 100644 index b0dd4a0..0000000 --- a/src/music_kraken/utils/config.py +++ /dev/null @@ -1,40 +0,0 @@ -from dynaconf import Dynaconf -from dynaconf import settings -from dynaconf.utils import object_merge - -# from .path_manager import LOCATIONS - -""" -https://www.dynaconf.com/settings_files/ - -This file is there to load the settings. -How I will structure this programm exactly is in the stars. - -The concept is that I package a config file, with this programm, and then load it. -Then I check if there is a config file at the LOCATIONS.CONFIG_FILE, and if yes they get merged -""" - -settings.happy_message = [ - "Support the artist.", - "Star Me: https://github.com/HeIIow2/music-downloader", - "🏳️‍⚧️🏳️‍⚧️ Trans rights are human rights. 🏳️‍⚧️🏳️‍⚧️", - "🏳️‍⚧️🏳️‍⚧️ Trans women are women, trans men are men, and enbies are enbies. 🏳️‍⚧️🏳️‍⚧️", - "🏴‍☠️🏴‍☠️ Unite under one flag, fck borders. 🏴‍☠️🏴‍☠️", - "Join my Matrix Space: https://matrix.to/#/#music-kraken:matrix.org", - "Gotta love the BPJM ;-;", - "🏳️‍⚧️🏳️‍⚧️ Protect trans youth. 🏳️‍⚧️🏳️‍⚧️", - "Nonstop Progressive Marxism.", - ] - - -dynacont_object = Dynaconf( - settings_files=[str(LOCATIONS.CONFIG_FILE)] -) - - - -class Settings: - def __init__(self) -> None: - - - diff --git a/src/music_kraken/utils/old_config/__init__.py b/src/music_kraken/utils/config/__init__.py similarity index 100% rename from src/music_kraken/utils/old_config/__init__.py rename to src/music_kraken/utils/config/__init__.py diff --git a/src/music_kraken/utils/old_config/attributes/__init__,py b/src/music_kraken/utils/config/attributes/__init__,py similarity index 100% rename from src/music_kraken/utils/old_config/attributes/__init__,py rename to src/music_kraken/utils/config/attributes/__init__,py diff --git a/src/music_kraken/utils/old_config/attributes/attribute.py b/src/music_kraken/utils/config/attributes/attribute.py similarity index 100% rename from src/music_kraken/utils/old_config/attributes/attribute.py rename to src/music_kraken/utils/config/attributes/attribute.py diff --git a/src/music_kraken/utils/old_config/attributes/list_attributes.py b/src/music_kraken/utils/config/attributes/list_attributes.py similarity index 100% rename from src/music_kraken/utils/old_config/attributes/list_attributes.py rename to src/music_kraken/utils/config/attributes/list_attributes.py diff --git a/src/music_kraken/utils/old_config/attributes/single_attributes.py b/src/music_kraken/utils/config/attributes/single_attributes.py similarity index 100% rename from src/music_kraken/utils/old_config/attributes/single_attributes.py rename to src/music_kraken/utils/config/attributes/single_attributes.py diff --git a/src/music_kraken/utils/old_config/base_classes.py b/src/music_kraken/utils/config/base_classes.py similarity index 100% rename from src/music_kraken/utils/old_config/base_classes.py rename to src/music_kraken/utils/config/base_classes.py diff --git a/src/music_kraken/utils/old_config/config.py b/src/music_kraken/utils/config/config.py similarity index 100% rename from src/music_kraken/utils/old_config/config.py rename to src/music_kraken/utils/config/config.py diff --git a/src/music_kraken/utils/old_config/sections/__init__.py b/src/music_kraken/utils/config/sections/__init__.py similarity index 100% rename from src/music_kraken/utils/old_config/sections/__init__.py rename to src/music_kraken/utils/config/sections/__init__.py diff --git a/src/music_kraken/utils/old_config/sections/audio.py b/src/music_kraken/utils/config/sections/audio.py similarity index 100% rename from src/music_kraken/utils/old_config/sections/audio.py rename to src/music_kraken/utils/config/sections/audio.py diff --git a/src/music_kraken/utils/old_config/sections/connection.py b/src/music_kraken/utils/config/sections/connection.py similarity index 100% rename from src/music_kraken/utils/old_config/sections/connection.py rename to src/music_kraken/utils/config/sections/connection.py diff --git a/src/music_kraken/utils/old_config/sections/logging.py b/src/music_kraken/utils/config/sections/logging.py similarity index 100% rename from src/music_kraken/utils/old_config/sections/logging.py rename to src/music_kraken/utils/config/sections/logging.py diff --git a/src/music_kraken/utils/old_config/sections/misc.py b/src/music_kraken/utils/config/sections/misc.py similarity index 100% rename from src/music_kraken/utils/old_config/sections/misc.py rename to src/music_kraken/utils/config/sections/misc.py diff --git a/src/music_kraken/utils/old_config/sections/paths.py b/src/music_kraken/utils/config/sections/paths.py similarity index 100% rename from src/music_kraken/utils/old_config/sections/paths.py rename to src/music_kraken/utils/config/sections/paths.py diff --git a/src/music_kraken/utils/old_config/utils.py b/src/music_kraken/utils/config/utils.py similarity index 100% rename from src/music_kraken/utils/old_config/utils.py rename to src/music_kraken/utils/config/utils.py diff --git a/src/music_kraken/utils/path_manager/locations.py b/src/music_kraken/utils/path_manager/locations.py index 25ab0fb..e77b531 100644 --- a/src/music_kraken/utils/path_manager/locations.py +++ b/src/music_kraken/utils/path_manager/locations.py @@ -19,7 +19,7 @@ class Locations: self.CONFIG_DIRECTORY = get_config_directory(str(application_name)) self.CONFIG_DIRECTORY.mkdir(exist_ok=True, parents=True) - self.CONFIG_FILE = Path(self.CONFIG_DIRECTORY, f"{application_name}.toml") + self.CONFIG_FILE = Path(self.CONFIG_DIRECTORY, f"{application_name}.conf") self.LEGACY_CONFIG_FILE = Path(self.CONFIG_DIRECTORY, f"{application_name}.conf") self.FFMPEG_BIN = Path(FFmpeg(enable_log=False).get_ffmpeg_bin()) diff --git a/src/music_kraken/utils/shared.py b/src/music_kraken/utils/shared.py index 936feb4..762ccb4 100644 --- a/src/music_kraken/utils/shared.py +++ b/src/music_kraken/utils/shared.py @@ -5,7 +5,7 @@ from typing import List, Tuple, Set, Dict from urllib.parse import ParseResult from .path_manager import LOCATIONS -from .old_config import LOGGING_SECTION, AUDIO_SECTION, CONNECTION_SECTION, MISC_SECTION, PATHS_SECTION +from .config import LOGGING_SECTION, AUDIO_SECTION, CONNECTION_SECTION, MISC_SECTION, PATHS_SECTION from .enums.album import AlbumType CONFIG_FILE = LOCATIONS.CONFIG_FILE