replaygain: silenced errors during import. Fixes #732

This commit is contained in:
Yevgeny Bezman 2014-06-27 19:50:41 +03:00
parent 16f6a3daa7
commit b019e6a5c0

View file

@ -25,7 +25,7 @@ from beets.plugins import BeetsPlugin
from beets.util import syspath, command_output, displayable_path
from beets import config
log = logging.getLogger('beets')
log = logging.getLogger('beets.replaygain')
# Utilities.
@ -289,6 +289,7 @@ class GStreamerBackend(object):
self.Gst = Gst
def compute(self, files, album):
self._error = None
self._files = list(files)
if len(self._files) == 0:
@ -301,6 +302,9 @@ class GStreamerBackend(object):
if self._set_first_file():
self._main_loop.run()
if self._error is not None:
raise self._error
def compute_track_gain(self, items):
self.compute(items, False)
@ -345,7 +349,7 @@ class GStreamerBackend(object):
self._main_loop.quit()
err, debug = message.parse_error()
# A GStreamer error, either an unsupported format or a bug.
raise ReplayGainError("Error %s - %s on file %s" %
self._error = ReplayGainError("Error %s - %s on file %s" %
(err, debug, self._src.get_property("location")))
def _on_tag(self, bus, message):
@ -557,7 +561,7 @@ class ReplayGainPlugin(BeetsPlugin):
if write:
item.try_write()
except ReplayGainError as e:
log.warn(u"ReplayGain error: {0}".format(e))
log.info(u"ReplayGain error: {0}".format(e))
except FatalReplayGainError as e:
raise ui.UserError(
u"Fatal replay gain error: {0}".format(e)
@ -591,7 +595,7 @@ class ReplayGainPlugin(BeetsPlugin):
if write:
item.try_write()
except ReplayGainError as e:
log.warn(u"ReplayGain error: {0}".format(e))
log.info(u"ReplayGain error: {0}".format(e))
except FatalReplayGainError as e:
raise ui.UserError(
u"Fatal replay gain error: {0}".format(e)
@ -603,6 +607,8 @@ class ReplayGainPlugin(BeetsPlugin):
if not self.automatic:
return
log.setLevel(logging.WARN)
if task.is_album:
self.handle_album(task.album, False)
else:
@ -612,6 +618,8 @@ class ReplayGainPlugin(BeetsPlugin):
"""Return the "replaygain" ui subcommand.
"""
def func(lib, opts, args):
log.setLevel(logging.INFO)
write = config['import']['write'].get(bool)
if opts.album: