mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 12:32:33 +01:00
Slight code formatting tweaks for #2349
This commit is contained in:
parent
9db79835d6
commit
c27879edbc
1 changed files with 15 additions and 8 deletions
|
|
@ -107,7 +107,10 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
def __init__(self):
|
||||
super(AcousticPlugin, self).__init__()
|
||||
|
||||
self.config.add({'auto': True, 'force': False})
|
||||
self.config.add({
|
||||
'auto': True,
|
||||
'force': False,
|
||||
})
|
||||
|
||||
if self.config['auto']:
|
||||
self.register_listener('import_task_files',
|
||||
|
|
@ -116,17 +119,17 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
def commands(self):
|
||||
cmd = ui.Subcommand('acousticbrainz',
|
||||
help=u"fetch metadata from AcousticBrainz")
|
||||
|
||||
def func(lib, opts, args):
|
||||
items = lib.items(ui.decargs(args))
|
||||
self._fetch_info(items, ui.should_write(),
|
||||
opts.force_refetch or self.config['force'])
|
||||
cmd.parser.add_option(
|
||||
u'-f', u'--force', dest='force_refetch',
|
||||
action='store_true', default=False,
|
||||
help=u're-download data when already present'
|
||||
)
|
||||
|
||||
def func(lib, opts, args):
|
||||
items = lib.items(ui.decargs(args))
|
||||
self._fetch_info(items, ui.should_write(),
|
||||
opts.force_refetch or self.config['force'])
|
||||
|
||||
cmd.func = func
|
||||
return [cmd]
|
||||
|
||||
|
|
@ -162,13 +165,17 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
"""Fetch additional information from AcousticBrainz for the `item`s.
|
||||
"""
|
||||
for item in items:
|
||||
# If we're not forcing re-downloading for all tracks, check
|
||||
# whether the data is already present. We use one
|
||||
# representative field name to check for previously fetched
|
||||
# data.
|
||||
if not force:
|
||||
mood_str = item.get('mood_acoustic', u'')
|
||||
if mood_str:
|
||||
self._log.info(u'Already set acoustic\
|
||||
brainz tags for {} ', item)
|
||||
self._log.info(u'data already present for: {}', item)
|
||||
continue
|
||||
|
||||
# We can only fetch data for tracks with MBIDs.
|
||||
if not item.mb_trackid:
|
||||
continue
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue