Skip to content

Commit 6a2e44b

Browse files
committed
fix: check file existence with audio format extension configuration.
1 parent 7fc81f2 commit 6a2e44b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

zotify/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def download_all(self, collections: list[Collection]) -> None:
270270
playable.library,
271271
playable.output_template,
272272
self.__config.replace_existing,
273+
self.__config.audio_format,
273274
)
274275
except FileExistsError:
275276
Logger.log(

zotify/playable.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def create_output(
6767
library: Path | str = Path("./"),
6868
output: str = "{title}",
6969
replace: bool = False,
70+
format: AudioFormat = AudioFormat.VORBIS,
7071
) -> Path:
7172
"""
7273
Creates save directory for the output file
@@ -85,7 +86,8 @@ def create_output(
8586
"{" + meta.name + "}", fix_filename(meta.string)
8687
)
8788
file_path = library.joinpath(output).expanduser()
88-
if file_path.exists() and not replace:
89+
file_path_for_check = file_path.with_name(file_path.name + "." + format.value.ext)
90+
if file_path_for_check.exists() and not replace:
8991
raise FileExistsError("File already downloaded")
9092
else:
9193
file_path.parent.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)