oskvr37 / tiddl

Tidal Downloader - download tracks with single Python package ✨
Apache License 2.0
17 stars 0 forks source link

Cover Embedding #29

Closed bachig26 closed 1 month ago

bachig26 commented 1 month ago

after the addition of commit for #15 and the v1.6.0, i thought the Cover has been embedded to the audio file but it still isn't here yet.

can you look into it again?

oskvr37 commented 1 month ago

I did not implement this for now as it is a bit complicated. Should cover arts be included in single tracks or albums only? For example, when we download track by id, should the cover be added from album cover?

bachig26 commented 1 month ago

I did not implement this for now as it is a bit complicated.

Okay 👍

Should cover arts be included in single tracks or albums only?

For example, when we download track by id, should the cover be added from album cover?

I think it would be nice to have in every tracks regardless of the nature of it: single track/album/playlist. Each track would be under a album anyway because that's how every music service have them regardless. It would be appropriate to have the Cover Art to be embedded like that.

oskvr37 commented 1 month ago

Please check if it is working as intended.

I figured out how to embed cover but the code is now such a mess, got to refactor it.

bachig26 commented 1 month ago

Please check if it is working as intended.

just checked, it's embedded but have some issue.

  1. I think the resolution is downloaded at highest quality at the moment, so some players like mpc-be couldn't able to show them. it works fine in MPV, VLC, Dopamine 3, Winyl. [i think the issue might related to the resolution or how the cover is pulled to display in player?]
  2. i think there might be some relevant metadata might be missing like id3 tags (i know this is only for mp3 format)? [maybe a better metadata container, that is like refactor? the metadata part; not sure since i don't know much].
  3. another thing is that the songs downloaded from tiddl doesn't play in Dopamine 3, it's really weird, i don't know why.

as you can see, i'm getting the error with playlist,

tiddl https://listen.tidal.com/playlist/744360b9-989e-4f7a-9a2d-bcc7c450ea15 -p "E:/eNT"
[ TIDDL ] playlist: Pop&B  (http://www.tidal.com/playlist/744360b9-989e-4f7a-9a2d-bcc7c450ea15)
[ download ] could not download cover. (403) https://resources.tidal.com/images/bad977f6/575f/4a63/996c/cd5e780c3092/1280x1280.jpg
[ TIDDL ] sleeping for 2.3s
bachig26 commented 1 month ago
  1. I think the resolution is downloaded at highest quality at the moment, so some players like mpc-be couldn't able to show them. it works fine in MPV, VLC, Dopamine 3, Winyl. [i think the issue might related to the resolution or how the cover is pulled to display in player?]
  2. i think there might be some relevant metadata might be missing like id3 tags (i know this is only for mp3 format)? [maybe a better metadata container, that is like refactor? the metadata part; not sure since i don't know much].

@oskvr37 i think i found the issue regarding this,

mpc-be64_xZnGee3dNw

as you can see that there is no info for Mime Type, it should be like image/jpeg. i think the cover is not displayed due to as the player can't understand the format of the cover stored in the audio file. Furthermore, when I Save as the cover to same directory, it readily shows the cover in player as it identifies them, that's how i found this problem.

https://community.mp3tag.de/t/some-music-shows-cover-art-in-windows-media-player-some-not/64487

https://superuser.com/questions/1350654/when-embedding-cover-art-as-a-tag-to-audio-files-is-the-same-image-copied-to-ea

https://stackoverflow.com/questions/38510694/how-to-add-album-art-to-mp3-file-using-python-3

oskvr37 commented 1 month ago

🐛 add mime type to cover Covers should be good now, if not then try to reduce cover size by adding size to Cover https://github.com/oskvr37/tiddl/blob/23e849739767136073aa2c175d0cec9ddeb16c81/tiddl/__init__.py#L197

🐛 add correct size for playlists cover

Usually playlists have 1080x1080 size, that's why there was an error when higher size was accessed.

another thing is that the songs downloaded from tiddl doesn't play in Dopamine 3, it's really weird, i don't know why.

Have you tested every song quality from tiddl in this program? Try to convert tracks with ffmpeg to other formats ffmpeg -i input.flac output.mp3 - can be mp3 or wav and see if the problem is still there, that is really weird issue.

Thanks for reporting!

bachig26 commented 1 month ago

🐛 add mime type to cover Covers should be good now

it works fine now for tracks and albums.

🐛 add correct size for playlists cover

Usually playlists have 1080x1080 size, that's why there was an error when higher size was accessed.

[ISSUE]: i just tried to download around 3 playlists but i found the covers aren't even downloaded.

another thing is that the songs downloaded from tiddl doesn't play in Dopamine 3, it's really weird, i don't know why.

Have you tested every song quality from tiddl in this program? Try to convert tracks with ffmpeg to other formats ffmpeg -i input.flac output.mp3 - can be mp3 or wav and see if the problem is still there, that is really weird issue.

i just removed the old downloads of tiddl and re-downloaded and tested, it works fine now with flac, i was also confused since 90% of my local tracks are in flac. I'll report you again if similar issue arise again and also will try the flac to mp3 conversion before reporting in future. thanks.

bachig26 commented 1 month ago

log for the playlist download and also the log for the issue #32

08/11/24 07:17:56 DEBUG TIDDL.main Namespace(input=['https://listen.tidal.com/playlist/f7cf4765-9955-493e-94d4-4a935646ac31'], file_template=None, download_path='E:\\eNT', quality=None, include_singles=False, save_options=False, no_skip=False, silent=False, verbose=False, no_color=False)
08/11/24 07:17:56 DEBUG Config.__init__ loaded {'download_path': 'E:\\eNT\\Music', 'track_quality': 'HI_RES_LOSSLESS', 'track_template': '{artist} - {title}', 'album_template': '{album}/{title}', 'playlist_template': '{playlist}/{title}'}
08/11/24 07:17:56 DEBUG Config.update updating
08/11/24 07:17:56 DEBUG Config._save {'download_path': 'E:\\eNT\\Music', 'track_quality': 'HI_RES_LOSSLESS', 'track_template': '{artist} - {title}', 'album_template': '{album}/{title}', 'playlist_template': '{playlist}/{title}'}
08/11/24 07:17:56 DEBUG Config.update updated
08/11/24 07:17:56 DEBUG TIDDL.main token expires in 2 days 9 hours
08/11/24 07:17:56 DEBUG TidalApi._request playlists/f7cf4765-9955-493e-94d4-4a935646ac31 {'countryCode': 'NZ'}
08/11/24 07:17:56 INFO  TIDDL.main playlist: Grown Pop (http://www.tidal.com/playlist/f7cf4765-9955-493e-94d4-4a935646ac31)
08/11/24 07:17:56 DEBUG download.__init__ ('81efbb97-d9c1-4048-a121-ea480be3463d', 'https://resources.tidal.com/images/81efbb97/d9c1/4048/a121/ea480be3463d/1080x1080.jpg')
08/11/24 07:17:57 DEBUG download.get got cover
08/11/24 07:17:57 DEBUG TidalApi._request playlists/f7cf4765-9955-493e-94d4-4a935646ac31/items {'countryCode': 'NZ', 'limit': 50, 'offset': 0}
08/11/24 07:17:57 INFO  TIDDL.downloadTrack sleeping for 2.5s
08/11/24 07:18:00 DEBUG TidalApi._request tracks/379637314/playbackinfo {'audioquality': 'HI_RES_LOSSLESS', 'playbackmode': 'STREAM', 'assetpresentation': 'FULL'}
08/11/24 07:18:00 INFO  TIDDL.downloadTrack Warm Body :: Max Quality - 24 bit 44.1 kHz
08/11/24 07:18:00 DEBUG download.downloadTrackStream mime_type: application/dash+xml
08/11/24 07:18:00 DEBUG download.downloadTrackStream codecs: flac
08/11/24 07:18:03 DEBUG download.downloadTrackStream ('E:\\eNT/Grown Pop', 'Warm Body')
08/11/24 07:18:10 DEBUG utils.convertToFlac ('E:\\eNT/Grown Pop/Warm Body.m4a', 'E:\\eNT/Grown Pop/Warm Body', '.m4a', 'E:\\eNT/Grown Pop/Warm Body.flac')
08/11/24 07:18:10 DEBUG utils.convertToFlac converting `E:\eNT/Grown Pop/Warm Body.m4a` to FLAC
08/11/24 07:18:11 INFO  TIDDL.downloadTrack track saved as E:\eNT/Grown Pop/Warm Body.flac
08/11/24 07:18:11 INFO  TIDDL.downloadTrack sleeping for 2.2s
08/11/24 07:18:13 DEBUG TidalApi._request tracks/375998095/playbackinfo {'audioquality': 'HI_RES_LOSSLESS', 'playbackmode': 'STREAM', 'assetpresentation': 'FULL'}
08/11/24 07:18:13 INFO  TIDDL.downloadTrack Sweet Caroline :: Max Quality - 24 bit 44.1 kHz
08/11/24 07:18:13 DEBUG download.downloadTrackStream mime_type: application/dash+xml
08/11/24 07:18:13 DEBUG download.downloadTrackStream codecs: flac
08/11/24 07:18:16 DEBUG download.downloadTrackStream ('E:\\eNT/Grown Pop', 'Sweet Caroline')
08/11/24 07:18:20 DEBUG utils.convertToFlac ('E:\\eNT/Grown Pop/Sweet Caroline.m4a', 'E:\\eNT/Grown Pop/Sweet Caroline', '.m4a', 'E:\\eNT/Grown Pop/Sweet Caroline.flac')
08/11/24 07:18:20 DEBUG utils.convertToFlac converting `E:\eNT/Grown Pop/Sweet Caroline.m4a` to FLAC
08/11/24 07:18:21 INFO  TIDDL.downloadTrack track saved as E:\eNT/Grown Pop/Sweet Caroline.flac
08/11/24 07:18:21 INFO  TIDDL.downloadTrack sleeping for 2.4s
08/11/24 07:18:23 DEBUG TidalApi._request tracks/376095157/playbackinfo {'audioquality': 'HI_RES_LOSSLESS', 'playbackmode': 'STREAM', 'assetpresentation': 'FULL'}
08/11/24 07:18:24 INFO  TIDDL.downloadTrack Under The Streetlight :: Max Quality - 24 bit 44.1 kHz
08/11/24 07:18:24 DEBUG download.downloadTrackStream mime_type: application/dash+xml
08/11/24 07:18:24 DEBUG download.downloadTrackStream codecs: flac
08/11/24 07:18:27 DEBUG download.downloadTrackStream ('E:\\eNT/Grown Pop', 'Under The Streetlight')
08/11/24 07:18:27 DEBUG utils.convertToFlac ('E:\\eNT/Grown Pop/Under The Streetlight.m4a', 'E:\\eNT/Grown Pop/Under The Streetlight', '.m4a', 'E:\\eNT/Grown Pop/Under The Streetlight.flac')
08/11/24 07:18:27 DEBUG utils.convertToFlac converting `E:\eNT/Grown Pop/Under The Streetlight.m4a` to FLAC
08/11/24 07:18:28 INFO  TIDDL.downloadTrack track saved as E:\eNT/Grown Pop/Under The Streetlight.flac
08/11/24 07:18:28 INFO  TIDDL.downloadTrack sleeping for 1.7s
08/11/24 07:18:30 DEBUG TidalApi._request tracks/376213116/playbackinfo {'audioquality': 'HI_RES_LOSSLESS', 'playbackmode': 'STREAM', 'assetpresentation': 'FULL'}
08/11/24 07:18:30 INFO  TIDDL.downloadTrack this feels good, huh? :: High Quality - 16 bit 44.1 kHz
08/11/24 07:18:30 DEBUG download.downloadTrackStream mime_type: application/vnd.tidal.bts
08/11/24 07:18:30 DEBUG download.downloadTrackStream codecs: flac
08/11/24 07:18:30 DEBUG download.download https://sp-pr-fa.audio.tidal.com/mediatracks/CAEaKAgDEiQ0N2VlNzc4Njk1ZDA1NmY2ZTZlOGQyMmM3NTFhNWEwNC5tcDQ/0.flac?token=1723356968~OTBhNzJiYTU0ZDI2MzkxOWUyNzc4MTdkMDFhZDk3NTgwZDI3YzY4OQ==
08/11/24 07:18:33 DEBUG download.downloadTrackStream ('E:\\eNT/Grown Pop', 'this feels good, huh?')
bachig26 commented 1 month ago

@oskvr37 also just wondering while looking at the log and also code of how the cover for tracks in playlist is associated. is it possible to embed the cover of their own tracks in the playlist instead of embedding the playlist cover?

oskvr37 commented 1 month ago

[ISSUE]: i just tried to download around 3 playlists but i found the covers aren't even downloaded.

Covers are saved after all tracks from playlist are downloaded, with current code we need to download a track to get its download path and then we can save the cover in the path. I will refactor code to first download cover and then save tracks.

Is the issue about something else?

bachig26 commented 1 month ago

Is the issue about something else?

No, I'll let you know if I find any issues later on. Thanks.