mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -6,3 +6,4 @@ Peter, Paul & Mary
|
||||
Simon & Garfunkel
|
||||
Judy & Mary
|
||||
Florence & The Machine
|
||||
Belle & Sebastian
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user