glomatico / gamdl

A Python CLI app for downloading Apple Music songs/music videos/posts.
MIT License
755 stars 85 forks source link

'purd' tag can be added for enhancement #6

Closed mosaicbrokenhearts closed 1 year ago

mosaicbrokenhearts commented 1 year ago

Hi, there's an issue I've encoutered when syncing the songs downloaded to my phone, where the album release time aren't displayed in the Music app. By checking tags using Mp3tag, I found that by adding a tag called iTunesPurchaseDate to each song, which uses the Greenwich Mean Time, the release date can be displayed properly. Here's the code I've added into gamdl.py.

Add to import:

import time

Add to tags in get_tags_song:

'purd': [(time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(time.time())))],

Also, if there's a need to get a higher-resolution cover art, simply change the line of covr in tags into

'covr': [MP4Cover(requests.get(artwork_url.replace('600x600bb.jpg', '3000x3000bb.jpg')).content, MP4Cover.FORMAT_JPEG)],

Pulled from the video tags part and altered the original resolution to fit.

btw, I just found that line 246 & 250 of tag playlistName seems to be repetitive.

Happy New Year! x

glomatico commented 1 year ago

That's a good idea, but the time format you put in is wrong, it must be in ISO 8601 to follow the iTunes conventions. Also the artwork must stay in 600x600 to follow iTunes conventions.

mosaicbrokenhearts commented 1 year ago

The time format for release date follows ISO 8601, but the purchase date doesn't though. I've used the files I've purchased before to check and this is actually the right format. Already downloaded a few songs to examine.

You can check the screenshot down below from a song purchased in iTunes, in normal GMT format.

WeChat Screenshot_20230104101622