replaygain: don't nest functions when there's no need to
@@ -1333,10 +1333,7 @@ class ReplayGainPlugin(BeetsPlugin):
self.config['overwrite'].get(bool)
)
- def commands(self):
- """Return the "replaygain" ui subcommand.
- """
- def func(lib, opts, args):
+ def command_func(self, lib, opts, args):
try:
write = ui.should_write(opts.write)
force = opts.force
@@ -1368,6 +1365,9 @@ class ReplayGainPlugin(BeetsPlugin):
# Silence interrupt exceptions
pass
+ def commands(self):
+ """Return the "replaygain" ui subcommand.
+ """
cmd = ui.Subcommand('replaygain', help=u'analyze for ReplayGain')
cmd.parser.add_album_option()
cmd.parser.add_option(
@@ -1385,5 +1385,5 @@ class ReplayGainPlugin(BeetsPlugin):
cmd.parser.add_option(
"-W", "--nowrite", dest="write", action="store_false",
help=u"don't write metadata (opposite of -w)")
- cmd.func = func
+ cmd.func = self.command_func
return [cmd]
