Fix #1592: unhandled exception in PyAudioTools

This commit is contained in:
Adrian Sampson 2015-09-07 14:15:46 -07:00
parent 9a76a1e7eb
commit 2140bb27a3
2 changed files with 9 additions and 1 deletions

View file

@ -711,7 +711,13 @@ class AudioToolsBackend(Backend):
# of the track.
# Note that the method needs an audiotools.PCMReader instance that can
# be obtained from an audiofile instance.
rg_track_gain, rg_track_peak = rg.title_gain(audiofile.to_pcm())
try:
rg_track_gain, rg_track_peak = rg.title_gain(audiofile.to_pcm())
except ValueError as exc:
# `audiotools.replaygain` can raise a `ValueError` if the sample
# rate is incorrect.
self._log.debug('error in rg.title_gain() call: {}', exc)
raise ReplayGainError('audiotools audio data error')
self._log.debug(u'ReplayGain for track {0} - {1}: {2:.2f}, {3:.2f}',
item.artist, item.title, rg_track_gain, rg_track_peak)

View file

@ -39,6 +39,8 @@ Fixes:
* Date fields are now written in the correct order (year-month-day), which
eliminates an intermittent bug where the latter two fields would not get
written to files. Thanks to :user:`jdetrey`. :bug:`1303` :bug:`1589`
* :doc:`/plugins/replaygain`: Avoid a crash when the PyAudioTools backend
encounters an error. :bug:`1592`
1.3.14 (August 2, 2015)