Package: jack
Version: 3.1.1+cvs20050801-6
Attached is a patch to jack_init.py and jack_tag.py to make them use
Mutagen rather than pyflac. It doesn't touch the stuff in
debian/patches, however. Mutagen exposes the stream info as
f.info.{sample_rate,total_samples}, similar to pyflac.
--
Joe Wreschnig <[EMAIL PROTECTED]>
--- jack_init.py.old 2006-03-13 17:06:34.000000000 -0600
+++ jack_init.py 2006-03-13 16:53:54.000000000 -0600
@@ -62,7 +62,7 @@
ogg = dummy_ogg()
try:
- import flac.metadata
+ import mutagen.flac as flac
except ImportError:
flac = None
--- jack_tag.py.old 2006-03-13 16:53:35.000000000 -0600
+++ jack_tag.py 2006-03-13 17:21:36.000000000 -0600
@@ -153,34 +153,22 @@
mp3file.close()
elif jack_helpers.helpers[cf['_encoder']]['target'] == "flac":
if flac:
- chain = flac.metadata.Chain()
- chain.read(mp3name)
- it = flac.metadata.Iterator()
- it.init(chain)
- while 1:
- if it.get_block_type() == flac.metadata.VORBIS_COMMENT:
- block = it.get_block()
- vc = flac.metadata.VorbisComment(block)
- break
- if not it.next():
- break
- if vc:
- vc.comments['ALBUM'] = a_title.encode("utf-8")
- vc.comments['TRACKNUMBER'] = `i[NUM]`
- vc.comments['TITLE'] = t_name.encode("utf-8")
- if t_artist:
- vc.comments['ARTIST'] = t_artist.encode("utf-8")
- else:
- vc.comments['ARTIST'] = a_artist.encode("utf-8")
- if cf['_id3_genre'] != -1:
- vc.comments['GENRE'] = id3genres[cf['_id3_genre']]
- if cf['_id3_year'] != -1:
- vc.comments['DATE'] = `cf['_id3_year']`
- chain.write(True, True)
+ f = flac.FLAC(mp3name)
+ if f.vc is None: f.add_vorbiscomment()
+ f.vc['ALBUM'] = a_title
+ f.vc['TRACKNUMBER'] = str(i[NUM])
+ f.vc['TITLE'] = t_name
+ if t_artist: f.vc['ARTIST'] = t_artist
+ else: f.vc['ARTIST'] = a_artist
+ if cf['_id3_genre'] != -1:
+ f.vc['GENRE'] = id3genres[cf['_id3_genre']]
+ if cf['_id3_year'] != -1:
+ f.vc['DATE'] = str(cf['_id3_year'])
+ f.save()
else:
print
- print "Please install the pyflac module available at"
- print "http://www.sacredchao.net/quodlibet/wiki/Download"
+ print "Please install the Mutagen module available at"
+ print "http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen"
print "Without it, you'll not be able to tag FLAC tracks."
elif jack_helpers.helpers[cf['_encoder']]['target'] == "ogg":
vf = ogg.vorbis.VorbisFile(mp3name)
signature.asc
Description: This is a digitally signed message part

