Re: writing TXXX tags from mid3v2

1,902 views
Skip to first unread message

knilsson

unread,
Sep 17, 2010, 1:31:01 PM9/17/10
to Quod Libet Development
Hi all again,

I finally got around to trying to patch the mid3v2 script myself,
adding TXXX editing capabilities, and I think I did it right.

I don't how to submit a patch, though, so maybe some maintainer (Joe
Wreschnig?) could do this, or else hint me how to.

Anyway, what I did was the following:

I opened the file /usr/bin/mid3v2 for editing (as root).

Lines 9 and 17, in my version, are:

# $Id: mid3v2 4002 2007-04-15 18:49:32Z piman $
VERSION = (1, 1)

Between these 2 lines:

for frame, value in edits:
if frame == "COMM":


(92 and 93 in my version)

I entered this:

if frame == "TXXX":
values = value.split(":")
if len(values) == 1:
value, desc = values[0], ""
elif len(values) == 2:
desc, value = values[0], values[1]
else:
value = ":".join(values[1:-1])
desc = values[0], values[-1]
frame = mutagen.id3.TXXX(
encoding=3, text=value, desc=desc)

and before:

"-c", "--comment",
metavar='"DESCRIPTION":"COMMENT":"LANGUAGE"',

I entered this:

parser.add_option(
"-x", "--textframe", metavar='"DESCRIPTION":"TEXT"',
action="callback", help="Set a text frame", type="string",
callback=lambda *args: args[3].edits.append(("--TXXX",
args[2])))


Basically, these are edits of the COMM parts. And it works as
expected.

Maybe some maintainer would be kind enough to revise this and then add
it to the repositories. That would be great.

My version of mid3v2 is the one that is in the Ubuntu Lucid
repositories.

Thanks,

Karl Nilsson
On 26 Apr, 08:59, knilsson <g...@heimskringla.com> wrote:
> > Hi all,
> >
> > I need to write TXXX:desc:text tags to mp3's from a bash script, and
> > it seems that the only program that does that is eyeD3. That app is
> > horribly broken though, and will corrupt the whole tag, especially if
> > the tag already contains an APIC (picture) frame, and often otherwise
> > too.
> >
> > mid3v2 is excellent in many ways but it doesn't write those TXXX tags.
> > So I wondered if there is a possibility to include this functionality
> > in the mid3v2 cli app.
> >
> > I think it would be great to have this function integrated into
> > mid3v2. Using the general syntax of mid3v2, of course.
> >
> > Cheers,
> > Karl Nilsson
> >

Michaël Ball

unread,
Sep 17, 2010, 2:22:36 PM9/17/10
to quod-libet-...@googlegroups.com
On Fri, 2010-09-17 at 10:31 -0700, knilsson wrote:
> Hi all again,
>
> I finally got around to trying to patch the mid3v2 script myself,
> adding TXXX editing capabilities, and I think I did it right.
>
> I don't how to submit a patch, though, so maybe some maintainer (Joe
> Wreschnig?) could do this, or else hint me how to.

To create a patch just run

diff -u oldfile.py newfile.py > changes.patch

Regards,

--
Michaël Ball <michae...@gmail.com>

Joe Wreschnig

unread,
Sep 17, 2010, 2:32:27 PM9/17/10
to quod-libet-...@googlegroups.com
On Fri, Sep 17, 2010 at 8:22 PM, Michaël Ball <michae...@gmail.com> wrote:
> On Fri, 2010-09-17 at 10:31 -0700, knilsson wrote:
>> Hi all again,
>>
>> I finally got around to trying to patch the mid3v2 script myself,
>> adding TXXX editing capabilities, and I think I did it right.
>>
>> I don't how to submit a patch, though, so maybe some maintainer (Joe
>> Wreschnig?) could do this, or else hint me how to.
>
> To create a patch just run
>
> diff -u oldfile.py newfile.py > changes.patch

Or, if you have checked Mutagen out of Subversion,

$ svn diff > changes.patch

knilsson

unread,
Sep 17, 2010, 3:47:30 PM9/17/10
to Quod Libet Development
Great!

That wasn't so hard, using svn diff! I just uploaded mid3v2-
changes.patch to the files. And that's from Mutagen out of Subversion,
that I just checked out. Hope you can have a look at it soon.

Thanks for the advice.

Cheers,

Karl

On 17 Sep, 20:32, Joe Wreschnig <joe.wresch...@gmail.com> wrote:

knilsson

unread,
Sep 17, 2010, 4:05:13 PM9/17/10
to Quod Libet Development
And the man file for mid3v2 would have to updated too, I suppose.
That's now in man-mid3v2.1.patch

Karl

knilsson

unread,
Sep 17, 2010, 4:52:56 PM9/17/10
to Quod Libet Development
I realized that the TXXX frame is not called just "text frame" but
rather "user-defined text data frame" so I re-uploaded the patch files
to reflect that. (Or maybe the word "frame" should not be included in
the description?)

Karl

knilsson

unread,
Sep 18, 2010, 9:36:46 AM9/18/10
to Quod Libet Development
Patch-file is now in the corresponding issue 62 report:

http://code.google.com/p/mutagen/issues/detail?id=62

Karl

T

unread,
Sep 20, 2010, 11:44:34 AM9/20/10
to Quod Libet Development
I've applied this and all I get is this:

Traceback (most recent call last):
File "./mid3v2", line 277, in <module>
main(sys.argv)
File "./mid3v2", line 262, in main
write_files(parser.edits, args)
File "./mid3v2", line 143, in write_files
elif issubclass(mutagen.id3.Frames[frame], mutagen.id3.UrlFrame):
File "/var/lib/python-support/python2.5/mutagen/id3.py", line 1085,
in __hash__
raise TypeError("Frame objects are unhashable")
TypeError: Frame objects are unhashable

Any clues? (I'm on Debian stable and it's showing it's age so I may
need to update some other python libraries.)

knilsson

unread,
Sep 21, 2010, 5:23:22 AM9/21/10
to Quod Libet Development
Can't say what the problems here. I made the patch file from svn, but
the version I'm using is the one that comes with Ubuntu Lucid. There
are small differences. Because python is indentation sensitive, it
might be necessary to edit the script, depending on version.

I'll post my version here, which works perfectly on my system.

And it works excellently with mixramp-tag, too!

Karl

knilsson

unread,
Sep 21, 2010, 4:10:48 PM9/21/10
to Quod Libet Development
Look for a solution (sort of) here:

http://code.google.com/p/mutagen/issues/detail?id=62

Karl
Reply all
Reply to author
Forward
0 new messages