Add artist split ignore file configuration and create empty file on setup

- Introduced `_artist_split_ignore_file_name` in `UserConfig` for better configuration management.
- Updated `create_config_dir` to create an empty `artist_split_ignore.txt` file if it doesn't exist.
- Added "Belle & Sebastian" to the existing artist split ignore list.
This commit is contained in:
cwilvx
2025-06-09 18:28:27 +03:00
parent 4b600e1c0c
commit 54f3fa67b7
3 changed files with 17 additions and 4 deletions
+1
View File
@@ -41,6 +41,7 @@ def load_user_artist_ignore_list() -> set[str]:
@dataclass
class UserConfig:
_config_path: str = ""
_artist_split_ignore_file_name: str = "artist_split_ignore.txt"
# NOTE: only auth stuff are used (the others are still reading/writing to db)
# TODO: Move the rest of the settings to the config file
+2 -1
View File
@@ -5,4 +5,5 @@ Smith & Thell
Peter, Paul & Mary
Simon & Garfunkel
Judy & Mary
Florence & The Machine
Florence & The Machine
Belle & Sebastian
+14 -3
View File
@@ -4,9 +4,11 @@ create the config directory and copy the assets to the app directory.
"""
import os
from pathlib import Path
import shutil
from swingmusic import settings
from swingmusic.config import UserConfig
from swingmusic.utils.filesystem import get_home_res_path
@@ -62,7 +64,6 @@ def create_config_dir() -> None:
playlist_img_path = os.path.join("images", "playlists")
mixes_img_path = settings.Paths.get_mixes_img_path()
og_mixes_img_path = settings.Paths.get_og_mixes_img_path()
md_mixes_img_path = settings.Paths.get_md_mixes_img_path()
@@ -85,8 +86,8 @@ def create_config_dir() -> None:
sm_mixes_img_path,
]
for _dir in dirs:
path = os.path.join(settings.Paths.get_app_dir(), _dir)
for dir in dirs:
path = os.path.join(settings.Paths.get_app_dir(), dir)
exists = os.path.exists(path)
if not exists:
@@ -94,5 +95,15 @@ def create_config_dir() -> None:
os.makedirs(path, exist_ok=True)
os.chmod(path, 0o755)
# Empty files to create
empty_files = [
# artist split ignore list
Path(settings.Paths.get_app_dir()) / UserConfig._artist_split_ignore_file_name,
]
for file in empty_files:
if not file.exists():
file.touch()
# copy assets to the app directory
CopyFiles()