From 94382446121458e8b4dd46ebc7133e902f5f2b32 Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Thu, 14 Nov 2024 13:11:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Workaround=20for=20wron?= =?UTF-8?q?g=20extension=20detection=20of=20`tidalapi`.=20Fixes=20#232?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tidal_dl_ng/download.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index 29ca284..46c0beb 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -336,9 +336,16 @@ def item( return False, "" - file_extension = media_stream.get_stream_manifest().file_extension - # Use M4A extension for MP4 audio tracks, because it looks better and is completely interchangeable. - file_extension = AudioExtensions.M4A if file_extension == AudioExtensions.MP4 else file_extension + # TODO: HOTFIX! Go back to + # file_extension = media_stream.get_stream_manifest().file_extension + # After tidalapi has fixed #304 + stream_manifest: StreamManifest = media_stream.get_stream_manifest() + if stream_manifest.file_extension is VideoExtensions.TS: + file_extension = stream_manifest.file_extension + elif AudioExtensions.FLAC in stream_manifest.dash_info.first_url: + file_extension = AudioExtensions.FLAC + else: + file_extension = AudioExtensions.M4A if self.settings.data.extract_flac and ( media_stream.get_stream_manifest().codecs.upper() == Codec.FLAC