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

Multiple genres are written to files joined #5491

Open
snejus opened this issue Oct 30, 2024 · 0 comments
Open

Multiple genres are written to files joined #5491

snejus opened this issue Oct 30, 2024 · 0 comments
Labels
bug bugs that are confirmed and actionable

Comments

@snejus
Copy link
Member

snejus commented Oct 30, 2024

Problem

Most of my music files have multiple genres, for example

$ filepath=/run/media/sarunas/music/Music/mokum/mok208_fkinghardcore12worldresistance/13_djdano_ooooohshitshitebrooklynmix.flac                                   ~ β”‚ 🐍 3.8 🐢
$ beet info path:$filepath | grep -i genre
               genre: early hardcore, gabber, hardcore techno, psycore
              genres: early hardcore, gabber, hardcore techno, psycore

I noticed that these get written to FLAC files as a single comma-separated GENRE field:

$ metaflac --block-type VORBIS_COMMENT --list $filepath | grep -i genre                                                                                           ~ β”‚ 🐍 3.8 🐢
    comment[37]: GENRE=early hardcore, gabber, hardcore techno, psycore

Even though I expected to see something like this instead

    comment[37]: GENRE=early hardcore
    comment[38]: GENRE=gabber
    comment[39]: GENRE=hardcore techno
    comment[40]: GENRE=psycore

Set GENRE correctly using mediafile

If I use mediafile to inspect the metadata, I see that genres return a list with
a single genre, where I see all my genres together:

>>> from mediafile import MediaFile

>>> m = MediaFile("/run/media/sarunas/music/Music/mokum/mok208_fkinghardcore12worldresistance/13_djdano_ooooohshitshitebrooklynmix.flac")

>>> m.genres
Out[4]: ['early hardcore, gabber, hardcore techno, psycore']

Let's try to correct this using the same mediafile and save the file:

>>> m.genres = m.genres[0].split(", ")

>>> m.genres
Out[6]: ['early hardcore', 'gabber', 'hardcore techno', 'psycore']

>>> m.save()
$ metaflac --block-type VORBIS_COMMENT --list $filepath | grep -i genre                                                                                           ~ β”‚ 🐍 3.8 🐢
    comment[60]: GENRE=early hardcore
    comment[61]: GENRE=gabber
    comment[62]: GENRE=hardcore techno
    comment[63]: GENRE=psycore

And now I'm seeing what I expected to have here.

Update beets library

Let's try to update beets library:

$ beet update path:$filepath                                                                                                                                      ~ β”‚ 🐍 3.8 🐢
29276 | 2020 / F**king Hardcore #12 - World Resistance: DJ Dano - Oooooh Shit (Shit'E' Brooklyn Mix)
  genre: early hardcore, gabber, hardcore techno, psycore -> early hardcore

$ beet info path:$filepath | grep -i genre                                                                                                                        ~ β”‚ 🐍 3.8 🐢
               genre: early hardcore
              genres: early hardcore; gabber; hardcore techno; psycore

It seems like it's turned into a list separated by a semicolon now.

And now let's try to write this file without making any changes:

$ beet write path:$filepath                                                                                                                                       ~ β”‚ 🐍 3.8 🐢
 | 2020 / F**king Hardcore #12 - World Resistance: DJ Dano - Oooooh Shit (Shit'E' Brooklyn Mix)
  genre: early hardcore -> early hardcore, gabber, hardcore techno, psycore

This was unexpected given that I did not adjust the metadata. Let's inspect the file and the library:

$ metaflac --block-type VORBIS_COMMENT --list $filepath | grep -i genre                                                                                           ~ β”‚ 🐍 3.8 🐢
    comment[37]: GENRE=early hardcore, gabber, hardcore techno, psycore

$ beet info path:$filepath | grep -i genre                                                                                                                        ~ β”‚ 🐍 3.8 🐢
               genre: early hardcore, gabber, hardcore techno, psycore
              genres: early hardcore, gabber, hardcore techno, psycore

Multiple GENRE tags have been overwritten, and we're back where we started.

@snejus snejus added the bug bugs that are confirmed and actionable label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs that are confirmed and actionable
Projects
None yet
Development

No branches or pull requests

1 participant