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

Metadata entries disc-count and tracks-count is not saved to metadata for opus files #2135

Closed
ZenKyma opened this issue Jul 9, 2024 · 6 comments · Fixed by #2141
Closed
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@ZenKyma
Copy link

ZenKyma commented Jul 9, 2024

System OS

Linux

Python Version

3.11 (CPython)

Install Source

pip / PyPi

Install version / commit hash

v4.2.5

Expected Behavior vs Actual Behavior

Actual behaviour

When downloading opus files with spotdl --bitrate disable --format opus [url], the disc-count and track-count metadata tags are not written to the file, while for mp3's they are.
Furthermore, track-number entries for opus files are prefixed by a '0', while for mp3's they are not.
The download link is written in a Comment field for opus, while it is written in a Comment[XXX] field for mp3s.

Expected behaviour

Metadata is supposed to be consistent for all formats. Opus files are expected to receive all the metadata that mp3 get, including disc-count and track-count. track-number tags are expected to be plain without prefixed '0' (contrary to when writing them to filenames where it indeed makes sense). The download link is expected to be written to Comment field for both opus and mp3.

Steps to reproduce - Ensure to include actual links!

  1. Choose a track of an album, for example "Hands Held Hight" from "Minutes to Midnight" by Linkin Park
  2. Copy the spotify link into the following two commands:
  3. spotdl --bitrate disable --format opus https://open.spotify.com/track/0m7mTaFGMiKI3rBJpYknip?si=be48a256aacf4d23
  4. spotdl --format mp3 https://open.spotify.com/track/0m7mTaFGMiKI3rBJpYknip?si=be48a256aacf4d23
  5. Verify that while the mp3 file's disc-count and tracks-count tags are filled, but not for the opus file

Traceback

(base) astral@weon:~/Music/__assets/_downloads.enc$ spotdl --format mp3 https://open.spotify.com/track/0m7mTaFGMiKI3rBJpYknip?si=be48a256aacf4d23
Processing query: https://open.spotify.com/track/0m7mTaFGMiKI3rBJpYknip?si=be48a256aacf4d23               
Downloaded "Linkin Park - Hands Held High": https://music.youtube.com/watch?v=2c8Rlke_k4g                 

(base) astral@weon:~/Music/__assets/_downloads.enc$ spotdl --bitrate disable --format opus https://open.spotify.com/track/0m7mTaFGMiKI3rBJpYknip?si=be48a256aacf4d23
Processing query: https://open.spotify.com/track/0m7mTaFGMiKI3rBJpYknip?si=be48a256aacf4d23               
Downloaded "Linkin Park - Hands Held High": https://music.youtube.com/watch?v=2c8Rlke_k4g

Other details

image
image
Difference in tags between opus and mp3 from the same source.

@ZenKyma ZenKyma added the Bug Unexpected problem or unintended behavior that needs to be fixed label Jul 9, 2024
@xnetcat xnetcat linked a pull request Jul 21, 2024 that will close this issue
@xnetcat
Copy link
Member

xnetcat commented Jul 21, 2024

fixed everything you mentioned aside for

The download link is written in a Comment field for opus, while it is written in a Comment[XXX] field for mp3s.

User comment frames have a description, like TXXX, and also a three letter ISO language code in the ‘lang’ attribute.
This feature is only supported by ID3, but we don't make use of it anyways so we default to XXX

@xnetcat xnetcat closed this as completed Jul 21, 2024
@ZenKyma
Copy link
Author

ZenKyma commented Jul 22, 2024

User comment frames have a description, like TXXX, and also a three letter ISO language code in the ‘lang’ attribute. This feature is only supported by ID3, but we don't make use of it anyways so we default to XXX

Wouldn't it be more appropriate to store the youtube link in woaf tag as per https://mutagen-specs.readthedocs.io/en/latest/id3/id3v2.3.0.html rather then in Comment[XXX]? And spotify link in woas makes sense as well.

I am also not sure how multiple artists are handled currently in #2141 , last time I checked artist tag got filled with multiple artist fields, while artists was left empty. artist should be only one artist (the main one), while artists should contain all artists. I'll check the pr and get back to you there.

@xnetcat
Copy link
Member

xnetcat commented Jul 22, 2024

Wouldn't it be more appropriate to store the youtube link in woaf tag as per mutagen-specs.readthedocs.io/en/latest/id3/id3v2.3.0.html rather then in Comment[XXX]? And spotify link in woas makes sense as well.

I've decided to use Comment tag so that users would have easier access to the link used for downloading to check whether the correct song was downloaded. WOAS is already used for the Spotify link.

I am also not sure how multiple artists are handled currently in #2141 , last time I checked artist tag got filled with multiple artist fields, while artists was left empty. artist should be only one artist (the main one), while artists should contain all artists. I'll check the pr and get back to you there.

TPE1
The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is used for the main artist(s). They are seperated with the "/" character.

There's not really an artists tag, each audio format has different structure. Artist tag stores them all / separated as per the official spec.

@ZenKyma
Copy link
Author

ZenKyma commented Jul 22, 2024

Oh didn't know that, I am using Picard to tag my library and that's they use artist for main artists and artists for all artists.

@xnetcat
Copy link
Member

xnetcat commented Jul 22, 2024

image


image

It all depends on how the application reads the metadata. In above example I've used both artist and artists tags to save all the artists and the resulting file is the same

@ZenKyma
Copy link
Author

ZenKyma commented Jul 22, 2024

I actually already improvised a python script that puts artist to artists and the first of artists back to artist so I'm settled:

with open(genrespath) as f: genre = f.read()

    mp3tags = EasyID3(mp3path)
    opustags = OggOpus(opuspath)

    artists = opustags['artist']
    opustags['artist'] = artists[0]
    mp3tags['artist'] = artists[0]
    opustags['artists'] = artists
    if artists[1:]:
        opustags['title'] = opustags['title'][0] + ' [feat. {}]'.format(" & ".join(artists[1:]))
        mp3tags['title'] = opustags['title']

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants