From f3be5f30140b5604460e06f09abd2405771cf682 Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Wed, 13 Nov 2024 10:58:52 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Fixed=20ffmpeg=20output?= =?UTF-8?q?=20file=20to=20`str`.=20Fixed=20segment=20parsing=20for=20video?= =?UTF-8?q?s=20while=20downloading=20segments.=20Lowered=20time=20delay=20?= =?UTF-8?q?span.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tidal_dl_ng/download.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index 2329381..26d6f84 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -208,7 +208,7 @@ class Download: result: bool = False path_segment: pathlib.Path = path_base / url_to_filename(url) # Calculate the segment ID based on the file name within the URL. - id_segment: int = int(path_segment.stem) + id_segment: int = int(str(path_segment.stem).split("_")[-1]) error: HTTPError | None = None try: @@ -386,7 +386,7 @@ class Download: # Whether a file was downloaded or skipped and the download delay is enabled, wait until the next download. # Only use this, if you have a list of several Track items. if download_delay and not skip_file: - time_sleep: float = round(random.SystemRandom().uniform(2, 5), 1) + time_sleep: float = round(random.SystemRandom().uniform(1.5, 4), 1) self.fn_logger.debug(f"Next download will start in {time_sleep} seconds.") time.sleep(time_sleep) @@ -608,7 +608,7 @@ class Download: path_file_out: pathlib.Path = path_file.with_suffix(AudioExtensions.MP4) result, _ = ( ffmpeg.input(path_file) - .output(path_file_out, map=0, c="copy", loglevel="quiet") + .output(str(path_file_out), map=0, c="copy", loglevel="quiet") .run(cmd=self.settings.data.path_binary_ffmpeg) ) @@ -619,7 +619,12 @@ class Download: result, _ = ( ffmpeg.input(path_media_src) .output( - path_media_out, map=0, movflags="use_metadata_tags", acodec="copy", map_metadata="0:g", loglevel="quiet" + str(path_media_out), + map=0, + movflags="use_metadata_tags", + acodec="copy", + map_metadata="0:g", + loglevel="quiet", ) .run(cmd=self.settings.data.path_binary_ffmpeg) )