🐛 Fixed scan_path didnt update with download_path

This commit is contained in:
Oskar Dudziński
2025-11-12 22:33:23 +01:00
parent 46ddd8e4e1
commit eb0ae38df8
+8 -6
View File
@@ -7,6 +7,7 @@ from typing import Literal
from tiddl.cli.const import APP_PATH
CONFIG_FILENAME = "config.toml"
DEFAULT_DOWNLOAD_PATH = Path.home() / "Music" / "tiddl"
TRACK_QUALITY_LITERAL = Literal["low", "normal", "high", "max"]
VIDEO_QUALITY_LITERAL = Literal["sd", "hd", "fhd"]
@@ -48,21 +49,22 @@ class Config(BaseModel):
video_quality: VIDEO_QUALITY_LITERAL = "fhd"
skip_existing: bool = True
threads_count: int = 4
download_path: Path = Path.home() / "Music" / "tiddl"
scan_path: Path = download_path
download_path: Path = DEFAULT_DOWNLOAD_PATH
scan_path: Path = DEFAULT_DOWNLOAD_PATH
singles_filter: ARTIST_SINGLES_FILTER_LITERAL = "none"
videos_filter: VIDEOS_FILTER_LITERAL = "none"
update_mtime: bool = False
rewrite_metadata: bool = False
def model_post_init(self, __context):
# convert to absolute, expand ~, normalize
self.download_path = self.download_path.expanduser().resolve()
self.scan_path = self.scan_path.expanduser().resolve()
# set scan path to download path when download path is non default
if self.scan_path == DEFAULT_DOWNLOAD_PATH and self.download_path != DEFAULT_DOWNLOAD_PATH:
self.scan_path = self.download_path
@field_validator("download_path", "scan_path", mode="before")
def str_to_path(cls, v):
return Path(v) if isinstance(v, str) else v
# convert to absolute, expand ~, normalize
return Path(v).expanduser().resolve() if isinstance(v, str) else v
download: DownloadConfig = DownloadConfig()