Need help setting tags for MP3 files using mutagen

4 views
Skip to first unread message

Robert Schweikert

unread,
Dec 10, 2025, 4:45:59 PM (6 days ago) Dec 10
to Quod Libet Development
Hi,

Looked through the documentation and found example code. Based on those I came up with a script that should have worked for me. However, when I run my resulting code I end up with no metadata, which ultimately results in cmus not sorting my songs in the right place :(.

As such I could use some extra eyes to tell me where I am going astray.


""""
from mutagen.easyid3 import EasyID3

# A bunch of code that figures out track number artist, song and album based on my own naming convention

                    mp3 = EasyID3(f)
                    mp3['album'] = album
                    mp3['albumartist'] = artist
                    mp3['artist'] = artist
                    mp3['title'] = title
                    mp3['tracknumber'] = track
                    mp3.save()
""""
But then when I run id3v2 on a file modified with the code above I end up with:

No ID3 tag

I inserted some debug print statements into the code and the output below shows that I have values I expect:

Working for: t61_All_Guns_Blazing.mp3
album: Metalogy
artist: Judas Priest
title: All Guns Blazing
track: 61

meaning
 f='t61_All_Guns_Blazing.mp3'
album='Metalogy'
artist='Judas Priest'
title='All Guns Blazing'
track=61

So everything I am setting into the dictionary is what I expect. But

-> id3v2 -l Judas_Priest/Metalogy/t61_All_Guns_Blazing.mp3
Judas_Priest/Metalogy/t61_All_Guns_Blazing.mp3: No ID3 tag

In order for cmus to work I need to have Title, Album, Artist and the track as in the following example:

-> id3v2 -l Judas_Priest/t01_Never_Satisfied.mp3
id3v1 tag info for Judas_Priest/t01_Never_Satisfied.mp3:
Title  : Never Satisfied                 Artist: Judas Priest                  
Album  : Metalogy                        Year:     , Genre: Unknown (255)
Comment:                                 Track: 1
Judas_Priest/t01_Never_Satisfied.mp3: No ID3v2 tag

I tried the EasyTag UI but it generates the extended tags and cmus does not like those.

Help getting the simple tags into the metadata is much appreciated.

Thanks,
Robert

Robert Schweikert

unread,
Dec 10, 2025, 5:14:46 PM (6 days ago) Dec 10
to Quod Libet Development
And let me amend the information. When I re-load the file, i.e.

""""
>>> f='t61_All_Guns_Blazing.mp3'
>>> mp3 = EasyID3(f)
>>> mp3
 {'album': ['Metalogy'], 'title': ['All Guns Blazing'], 'artist': ['Judas Priest'], 'albumartist': ['Judas Priest'], 'tracknumber': ['61']}
"""

So my code does add the data it's just not in a format that makes cmus or id3v2 understand it.

Later,
Robert 

Paul Eipper

unread,
Dec 11, 2025, 10:14:15 AM (5 days ago) Dec 11
to quod-libet-...@googlegroups.com
Hi,

You probably want to save the tags in v2.3 format instead of v2.4 (the default).

mp3.save(v2_version=3)

more info:

att,
--
Paul Eipper


--

---
You received this message because you are subscribed to the Google Groups "Quod Libet Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quod-libet-develo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/quod-libet-development/15562a3f-2747-420e-adf5-3b7ff1e5a35cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages