glomatico / gytmdl

A Python CLI app for downloading YouTube Music songs with tags from YouTube Music.
109 stars 13 forks source link

Store YouTube ID in a custom tag and check against it before download #15

Closed ov1d1u closed 5 months ago

ov1d1u commented 10 months ago

Hello, and thank you for your great work! I'm using this project to keep my local music in sync with a YouTube Music playlist. Unfortunately, because the script is downloading info for each song in playlist, no matter if it was or not downloaded before, it takes a bit until finishes if there isn't any new song to download.

This PR changes this by adding a custom field to the saved file where it stores the origin YouTube ID. When the script is started again, it loops through all the m4a files in the target destination, collects the YouTube IDs from the MP4 tags and then skips those entries altogether when downloading. This ensures that the YouTube servers are not contacted for each already-downloaded file and also saves some time by not retrieving the tags.

I kept the old logic to support the use case where someone used this script in the past and his M4A files does not contain the new tag in them.