From c66b021ecc3c9f33f6070c19e787e49aea42db19 Mon Sep 17 00:00:00 2001 From: Hellow <74311245+HeIIow2@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:08:42 +0200 Subject: [PATCH] reverted config changes --- src/music_kraken/__init__.py | 2 +- src/music_kraken/__main__.py | 2 +- src/music_kraken/_settings/default.py | 5 +++ src/music_kraken/_settings/structure.py | 4 ++ src/music_kraken/cli/main_downloader.py | 2 +- src/music_kraken/cli/options/settings.py | 2 +- .../pages/youtube_music/youtube_music.py | 2 +- src/music_kraken/utils/__init__.py | 2 +- src/music_kraken/utils/config.py | 40 ------------------- .../utils/{old_config => config}/__init__.py | 0 .../attributes/__init__,py | 0 .../attributes/attribute.py | 0 .../attributes/list_attributes.py | 0 .../attributes/single_attributes.py | 0 .../{old_config => config}/base_classes.py | 0 .../utils/{old_config => config}/config.py | 0 .../sections/__init__.py | 0 .../{old_config => config}/sections/audio.py | 0 .../sections/connection.py | 0 .../sections/logging.py | 0 .../{old_config => config}/sections/misc.py | 0 .../{old_config => config}/sections/paths.py | 0 .../utils/{old_config => config}/utils.py | 0 .../utils/path_manager/locations.py | 2 +- src/music_kraken/utils/shared.py | 2 +- 25 files changed, 17 insertions(+), 48 deletions(-) create mode 100644 src/music_kraken/_settings/default.py create mode 100644 src/music_kraken/_settings/structure.py delete mode 100644 src/music_kraken/utils/config.py rename src/music_kraken/utils/{old_config => config}/__init__.py (100%) rename src/music_kraken/utils/{old_config => config}/attributes/__init__,py (100%) rename src/music_kraken/utils/{old_config => config}/attributes/attribute.py (100%) rename src/music_kraken/utils/{old_config => config}/attributes/list_attributes.py (100%) rename src/music_kraken/utils/{old_config => config}/attributes/single_attributes.py (100%) rename src/music_kraken/utils/{old_config => config}/base_classes.py (100%) rename src/music_kraken/utils/{old_config => config}/config.py (100%) rename src/music_kraken/utils/{old_config => config}/sections/__init__.py (100%) rename src/music_kraken/utils/{old_config => config}/sections/audio.py (100%) rename src/music_kraken/utils/{old_config => config}/sections/connection.py (100%) rename src/music_kraken/utils/{old_config => config}/sections/logging.py (100%) rename src/music_kraken/utils/{old_config => config}/sections/misc.py (100%) rename src/music_kraken/utils/{old_config => config}/sections/paths.py (100%) rename src/music_kraken/utils/{old_config => config}/utils.py (100%) 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