Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Track Tagging with id3 #84

Merged
merged 1 commit into from
Sep 20, 2020
Merged

Add Track Tagging with id3 #84

merged 1 commit into from
Sep 20, 2020

Conversation

stephen-huan
Copy link
Contributor

Adding the TRCK header (Ffmpeg metadata tag's "track") parameter would be helpful to organize the resulting playlist, especially for playlists with a lot of songs.

For example, the TRCK tag is what determines the order in applications like cmus:
image

If I'm reading the code right, it should be as simple as this:
Assuming the songs are downloaded in order, then adding a number variable should work.
(file spotify_dl/spotify.py, lines 77-90)

    for number, item in enumerate(info):
        log.debug('Songs to download: %s', item)
        url_, track_, artist_ = item
        download_archive = download_directory + 'downloaded_songs.txt'
        outtmpl = download_directory + '%(title)s.%(ext)s'
        ydl_opts = {
            'format': format_string,
            'download_archive': download_archive,
            'outtmpl': outtmpl,
            'noplaylist': True,
            'postprocessor_args': ['-metadata', 'title=' + str(track_),
                                   '-metadata', 'artist=' + str(artist_),
                                   '-metadata', 'track=' + str(number + 1)]
        }

A bit of basic testing seems to work.

@SathyaBhat
Copy link
Owner

@stephen-huan my deepest apologies for missing this. I'll merge this and publish with the next release

@SathyaBhat SathyaBhat merged commit 449d581 into SathyaBhat:master Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants