Skip to content

Commit

Permalink
Fix #1592: unhandled exception in PyAudioTools
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Sep 7, 2015
1 parent 9a76a1e commit 2140bb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion beetsplug/replaygain.py
Expand Up @@ -711,7 +711,13 @@ def _compute_track_gain(self, item):
# 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)
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Expand Up @@ -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)
Expand Down

0 comments on commit 2140bb2

Please sign in to comment.