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
|
@dataclass
|
||||||
class UserConfig:
|
class UserConfig:
|
||||||
_config_path: str = ""
|
_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)
|
# 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
|
# TODO: Move the rest of the settings to the config file
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ Smith & Thell
|
|||||||
Peter, Paul & Mary
|
Peter, Paul & Mary
|
||||||
Simon & Garfunkel
|
Simon & Garfunkel
|
||||||
Judy & Mary
|
Judy & Mary
|
||||||
Florence & The Machine
|
Florence & The Machine
|
||||||
|
Belle & Sebastian
|
||||||
@@ -4,9 +4,11 @@ create the config directory and copy the assets to the app directory.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from swingmusic import settings
|
from swingmusic import settings
|
||||||
|
from swingmusic.config import UserConfig
|
||||||
from swingmusic.utils.filesystem import get_home_res_path
|
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")
|
playlist_img_path = os.path.join("images", "playlists")
|
||||||
|
|
||||||
|
|
||||||
mixes_img_path = settings.Paths.get_mixes_img_path()
|
mixes_img_path = settings.Paths.get_mixes_img_path()
|
||||||
og_mixes_img_path = settings.Paths.get_og_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()
|
md_mixes_img_path = settings.Paths.get_md_mixes_img_path()
|
||||||
@@ -85,8 +86,8 @@ def create_config_dir() -> None:
|
|||||||
sm_mixes_img_path,
|
sm_mixes_img_path,
|
||||||
]
|
]
|
||||||
|
|
||||||
for _dir in dirs:
|
for dir in dirs:
|
||||||
path = os.path.join(settings.Paths.get_app_dir(), _dir)
|
path = os.path.join(settings.Paths.get_app_dir(), dir)
|
||||||
exists = os.path.exists(path)
|
exists = os.path.exists(path)
|
||||||
|
|
||||||
if not exists:
|
if not exists:
|
||||||
@@ -94,5 +95,15 @@ def create_config_dir() -> None:
|
|||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
os.chmod(path, 0o755)
|
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
|
# copy assets to the app directory
|
||||||
CopyFiles()
|
CopyFiles()
|
||||||
|
|||||||
Reference in New Issue
Block a user