From 84c0f909b679f2bd407e88382ef7583f587f8aa7 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 15 Sep 2014 10:25:57 -0700 Subject: [PATCH] replaygain: Check for bad mp3gain output (#961) --- beetsplug/replaygain.py | 3 +++ docs/changelog.rst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index 2bea72d96..4857566d9 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -198,6 +198,9 @@ class CommandBackend(Backend): out = [] for line in text.split('\n')[1:num_lines + 1]: parts = line.split('\t') + if len(parts) != 6 or parts[0] == 'File': + log.debug(u'replaygain: bad tool output: {0}'.format(text)) + raise ReplayGainError('mp3gain failed') d = { 'file': parts[0], 'mp3gain': int(parts[1]), diff --git a/docs/changelog.rst b/docs/changelog.rst index a517c6374..4c28a2f84 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -62,6 +62,9 @@ Fixes: whitelist. Thanks to gwern. * :doc:`/plugins/importfeeds`: A new ``echo`` output mode prints files' paths to standard error. Thanks to robotanarchy. +* :doc:`/plugins/replaygain`: Restore some error handling when ``mp3gain`` + output cannot be parsed. The verbose log now contains the bad tool output in + this case. .. _discogs_client: https://github.com/discogs/discogs_client