Skip to content

Tagging help #697

@rjschwei

Description

@rjschwei

Looked through the documentation and found some example code to follow. 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 an unexpected result.

The problem I am trying to solve is to set tags that make cmus sort my files properly.

What works with cmus looks as follows:

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

I created a script that based on path will generate artist name, album name, song title and track number. Once I have that information it is used as follows:

from mutagen.easyid3 import EasyID3

                    mp3 = EasyID3(f)
                    mp3['album'] = album
                    mp3['albumartist'] = artist
                    mp3['artist'] = artist
                    mp3['title'] = title
                    mp3['tracknumber'] = track
                    mp3.save()

With appropriate debug output I get the following information

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

Which is what I expect and as such that should be set as the tags. But

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

When I read the tags back in Python

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

It shows that my original code does add tags. They are just not in the format that makes cmus behave the way I want it to.

The question is, how do I get the data into a format such that it looks like the example shown first and that works with cmus.
Help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions