summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/download.py
diff options
context:
space:
mode:
authorWarry <FunWarry@users.noreply.github.com>2025-12-03 09:35:42 +0100
committerWarry <FunWarry@users.noreply.github.com>2025-12-03 09:35:42 +0100
commitc077e2b4977ea3219bce9a0f7c4518e0838baf87 (patch)
treef4de9246f6e98109917f8ce6626179e2f87162c2 /tidal_dl_ng/download.py
parent8905ac7e75029a772d92dc2898976ebb0e79acd3 (diff)
parent45977986dfa7dde065233099b4c86c74cc9ea163 (diff)
downloadtidal-dl-ng-c077e2b4977ea3219bce9a0f7c4518e0838baf87.tar.gz
Merge remote-tracking branch 'warry-github/master' into feature/informations-window
# Conflicts: # CONTRIBUTING.md # README.md
Diffstat (limited to 'tidal_dl_ng/download.py')
-rw-r--r--tidal_dl_ng/download.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py
index 84b6c9b..a121f95 100644
--- a/tidal_dl_ng/download.py
+++ b/tidal_dl_ng/download.py
@@ -411,7 +411,7 @@ class Download:
with path_file.open("wb") as f_target:
for dl_segment_result in dl_segment_results:
with dl_segment_result.path_segment.open("rb") as f_segment:
- # Read and write junks, which gives better HDD write performance
+ # Read and write chunks, which gives better HDD write performance
while segment := f_segment.read(CHUNK_SIZE):
f_target.write(segment)
@@ -1249,7 +1249,7 @@ class Download:
response: requests.Response = requests.get(url, timeout=REQUESTS_TIMEOUT_SEC)
result = response.content
except Exception as e:
- # TODO: Implement propper logging.
+ # TODO: Implement proper logging.
print(e)
finally:
response.close()
@@ -1258,7 +1258,7 @@ class Download:
with open(path_file, "rb") as f:
result = f.read()
except OSError as e:
- # TODO: Implement propper logging.
+ # TODO: Implement proper logging.
print(e)
return result
@@ -1750,15 +1750,22 @@ class Download:
pathlib.Path: Path to the converted MP4 file.
"""
path_file_out: pathlib.Path = path_file.with_suffix(AudioExtensions.MP4)
+
+ self.fn_logger.debug(f"Converting video: {path_file.name} -> {path_file_out.name}")
+
ffmpeg = (
FFmpeg(executable=self.settings.data.path_binary_ffmpeg)
.option("y")
+ .option("hide_banner")
+ .option("nostdin")
.input(url=path_file)
.output(url=path_file_out, codec="copy", map=0, loglevel="quiet")
)
ffmpeg.execute()
+ self.fn_logger.debug(f"Video conversion complete: {path_file_out.name}")
+
return path_file_out
def _extract_flac(self, path_media_src: pathlib.Path) -> pathlib.Path:
@@ -1771,8 +1778,13 @@ class Download:
pathlib.Path: Path to the extracted FLAC file.
"""
path_media_out = path_media_src.with_suffix(AudioExtensions.FLAC)
+
+ self.fn_logger.debug(f"Extracting FLAC: {path_media_src.name} -> {path_media_out.name}")
+
ffmpeg = (
FFmpeg(executable=self.settings.data.path_binary_ffmpeg)
+ .option("hide_banner")
+ .option("nostdin")
.input(url=path_media_src)
.output(
url=path_media_out,
@@ -1786,6 +1798,8 @@ class Download:
ffmpeg.execute()
+ self.fn_logger.debug(f"FLAC extraction complete: {path_media_out.name}")
+
return path_media_out
def _extract_video_stream(self, m3u8_variant: m3u8.M3U8, quality: int) -> tuple[m3u8.M3U8 | bool, str]: