python-rgain (replaygain) fails when no ID3 tag is present

Bug #1552185 reported by joergsorge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rgain (Ubuntu)
New
Undecided
Unassigned

Bug Description

lsb_release -rd
Description: Ubuntu 14.04.4 LTS
Release: 14.04

apt-cache policy python-rgain
python-rgain:
  Installiert: 1.2-1
  Installationskandidat: 1.2-1

Hi,

a [replaygain --show file] by files without id3-Tag reports the Error, that is no ID3-Tag is present:
replaygain --show test.mp3
test.mp3
  <Error reading Replay Gain: ID3NoHeaderError(u"'test.mp3' doesn't start with an ID3 tag",)>

By trying to write a replay gain value, the full python stack trace is shown:
$ replaygain -f --no-album test.mp3
Calculating Replay Gain information ...
  test.mp3: -3.85 dB
Writing Replay Gain information to files ...
  test.mp3:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/rgain/script/replaygain.py", line 130, in do_gain
    formats_map.write_gain(filename, trackdata, albumdata)
  File "/usr/lib/python2.7/dist-packages/rgain/rgio.py", line 345, in write_gain
    accessor[1](filename, trackgain, albumgain)
  File "/usr/lib/python2.7/dist-packages/rgain/rgio.py", line 284, in mp3_default_write_gain
    mp3_legacy_write_gain(filename, trackdata, albumdata)
  File "/usr/lib/python2.7/dist-packages/rgain/rgio.py", line 159, in mp3_legacy_write_gain
    tags = ID3(filename)
  File "/usr/lib/python2.7/dist-packages/mutagen/id3.py", line 73, in __init__
    super(ID3, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mutagen/_util.py", line 120, in __init__
    super(DictProxy, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mutagen/__init__.py", line 42, in __init__
    self.load(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mutagen/id3.py", line 121, in load
    self.__load_header()
  File "/usr/lib/python2.7/dist-packages/mutagen/id3.py", line 239, in __load_header
    raise ID3NoHeaderError("'%s' doesn't start with an ID3 tag" % fn)
ID3NoHeaderError: 'test.mp3' doesn't start with an ID3 tag

I think, it there be good, if in such a case python-rgain writes the id3-Tag before storing the replay gain value, or give a defined error.

This bug is also reported here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798137

It may be an alternative to take mp3gain in the repos until this bug is fixed?

It affects ubuntu 14.4/16.4
Version of rgain in 14.4 is replaygain 1.2

Regards

Tags: audio gain id3 mp3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.