Martin,

I tried porting jack from python-id3lib to python-eyed3, which is also
an ID3 library but still developed (and with utf8 support).

Would you be willing to take a quick look at the attached patch as this
is my first experience with Python and jack?  In particular, I don't
understand the genre code and didn't immediately see why the year does
not get set correctly.  I'm quite sure there will be other problems too.

If you have the time, then please let me know what you think.

In the current patch jack still uses python-id3 (the ID3v1 lib), but
this could actually be replaced by eyed3 too...

Cheers,
Chris.
33,36c33
< from eyeD3 import *
< from eyeD3.tag import *
< from eyeD3.frames import *;
< from eyeD3.utils import *;
---
> from jack_init import pyid3lib
102,109c99,102
<                         tag = eyeD3.Tag()
<                         tag.link(mp3name)
<                         tag.header.setVersion(eyeD3.ID3_V2_4)
<                         tag.setTextEncoding(UTF_8_ENCODING)
<                         tag.setAlbum(a_title.encode("utf-8"))
<                         tag.setTitle(t_name.encode("utf-8"))
<                         
tag.setTrackNum((i[NUM],len(jack_ripstuff.all_tracks_orig)))
<                         tag.setTitle(t_name.encode("utf-8"))
---
>                         v2tag = pyid3lib.tag(mp3name)
>                         v2tag.album = a_title.encode("utf-8")
>                         v2tag.track = (i[NUM], 
> len(jack_ripstuff.all_tracks_orig))
>                         v2tag.title = t_name.encode("utf-8")
111c104
<                             tag.setArtist(t_artist.encode("utf-8"))
---
>                             v2tag.artist = t_artist.encode("utf-8")
113,115c106,113
<                             tag.setArtist(a_artist.encode("utf-8"))
<                         if cf['_id3_genre'] != -1:
<                                                                               
                                tag.setGenre("(%d)" % (cf['_id3_genre']))
---
>                             v2tag.artist = a_artist.encode("utf-8")
>                         if cf['_id3_genre'] == 255:
>                             try:
>                                 del v2tag.contenttype
>                             except AttributeError:
>                                 pass
>                         elif cf['_id3_genre'] != -1:
>                             v2tag.contenttype = "(%d)" % (cf['_id3_genre'])
117,119c115,117
<                             tag.setDate(cf['_id3_year'])
<                         tag.setPlayCount(int(i[LEN] * 1000.0 / 75 + 0.5))
<                         tag.update()
---
>                             v2tag.year = `cf['_id3_year']`
>                         v2tag.songlen = `int(i[LEN] * 1000.0 / 75 + 0.5)`
>                         v2tag.update()

Reply via email to