mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 04:05:08 +03:00
🐛 Fix metadata for flac tracks (#168)
* quick fix for metadata that was not added for flac tracks * bump version
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "tiddl"
|
||||
version = "2.6.2"
|
||||
version = "2.6.3a1"
|
||||
description = "Download Tidal tracks with CLI downloader."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
@@ -228,17 +228,6 @@ def DownloadCommand(
|
||||
f.write(stream_data)
|
||||
|
||||
if isinstance(item, Track):
|
||||
if track_stream.audioQuality == "HI_RES_LOSSLESS":
|
||||
path = asyncio.run(
|
||||
convertFileExtension(
|
||||
source_file=path,
|
||||
extension=".flac",
|
||||
remove_source=True,
|
||||
is_video=False,
|
||||
copy_audio=True, # extract flac from m4a container
|
||||
)
|
||||
)
|
||||
|
||||
if not cover_data and item.album.cover:
|
||||
cover_data = Cover(item.album.cover).content
|
||||
|
||||
@@ -259,6 +248,17 @@ def DownloadCommand(
|
||||
except Exception as e:
|
||||
logging.error(f"Can not add metadata to: {path}, {e}")
|
||||
|
||||
if track_stream.audioQuality in ["HI_RES_LOSSLESS", "LOSSLESS"]:
|
||||
path = asyncio.run(
|
||||
convertFileExtension(
|
||||
source_file=path,
|
||||
extension=".flac",
|
||||
remove_source=True,
|
||||
is_video=False,
|
||||
copy_audio=True, # extract flac from m4a container
|
||||
)
|
||||
)
|
||||
|
||||
elif isinstance(item, Video):
|
||||
path = asyncio.run(
|
||||
convertFileExtension(
|
||||
@@ -486,7 +486,9 @@ def DownloadCommand(
|
||||
|
||||
path = Path(PATH) if PATH else ctx.obj.config.download.path
|
||||
|
||||
if playlist_path and (SAVE_M3U or ctx.obj.config.download.save_playlist_m3u):
|
||||
if playlist_path and (
|
||||
SAVE_M3U or ctx.obj.config.download.save_playlist_m3u
|
||||
):
|
||||
savePlaylistM3U(
|
||||
playlist_tracks=playlist_tracks,
|
||||
path=path / playlist_path,
|
||||
|
||||
+10
-8
@@ -73,14 +73,16 @@ def parseTrackStream(track_stream: TrackStream) -> tuple[list[str], str]:
|
||||
case "application/dash+xml":
|
||||
urls, codecs = parseManifestXML(decoded_manifest)
|
||||
|
||||
if codecs == "flac":
|
||||
file_extension = ".flac"
|
||||
if track_stream.audioQuality == "HI_RES_LOSSLESS":
|
||||
file_extension = ".m4a"
|
||||
elif codecs.startswith("mp4"):
|
||||
file_extension = ".m4a"
|
||||
else:
|
||||
raise ValueError(f"Unknown codecs `{codecs}` (trackId {track_stream.trackId}")
|
||||
# if codecs == "flac":
|
||||
# file_extension = ".flac"
|
||||
# if track_stream.audioQuality == "HI_RES_LOSSLESS":
|
||||
# file_extension = ".m4a"
|
||||
# elif codecs.startswith("mp4"):
|
||||
# file_extension = ".m4a"
|
||||
# else:
|
||||
# raise ValueError(f"Unknown codecs `{codecs}` (trackId {track_stream.trackId}")
|
||||
|
||||
file_extension = ".m4a"
|
||||
|
||||
return urls, file_extension
|
||||
|
||||
|
||||
Reference in New Issue
Block a user