from contextlib import contextmanager
## eyeD3 tag fettling.
-import eyeD3 as E3
+import eyed3 as E3
## Gstreamer. It picks up command-line arguments -- most notably `--help' --
## and processes them itself. Of course, its help is completely wrong. This
for q, br in me.QMAP:
if br >= me.bitrate:
break
- else:
- raise ValueError, 'no suitable quality setting found'
+ else:
+ raise ValueError, 'no suitable quality setting found'
encprops['quality'] = q/10.0
return [make_element('vorbisenc', **encprops),
make_element('oggmux')]
GStreamer produces ID3v2 tags, but not ID3v1. This seems unnecessarily
unkind to stupid players.
"""
- tag = E3.Tag()
- tag.link(path)
- tag.setTextEncoding(E3.UTF_8_ENCODING)
- try:
- tag.update(E3.ID3_V1_1)
- except (UnicodeEncodeError, E3.tag.GenreException):
- pass
+ f = E3.load(path)
+ if f is None: return
+ t = f.tag
+ if t is None: return
+ for v in [E3.id3.ID3_V2_3, E3.id3.ID3_V1]:
+ try: f.tag.save(version = v)
+ except (UnicodeEncodeError,
+ E3.id3.GenreException,
+ E3.id3.TagException):
+ pass
defformat('mp3', MP3Format)