mirror of
https://github.com/beetbox/beets.git
synced 2026-01-05 23:43:31 +01:00
Add tags configuration to acousticbrainz plugin
This commit is contained in:
parent
e2defe9bb8
commit
325ae6f0ee
2 changed files with 16 additions and 6 deletions
|
|
@ -110,6 +110,7 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
self.config.add({
|
||||
'auto': True,
|
||||
'force': False,
|
||||
'tags': []
|
||||
})
|
||||
|
||||
if self.config['auto']:
|
||||
|
|
@ -164,6 +165,7 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
def _fetch_info(self, items, write, force):
|
||||
"""Fetch additional information from AcousticBrainz for the `item`s.
|
||||
"""
|
||||
tags = self.config['tags'].get()
|
||||
for item in items:
|
||||
# If we're not forcing re-downloading for all tracks, check
|
||||
# whether the data is already present. We use one
|
||||
|
|
@ -183,11 +185,17 @@ class AcousticPlugin(plugins.BeetsPlugin):
|
|||
data = self._get_data(item.mb_trackid)
|
||||
if data:
|
||||
for attr, val in self._map_data_to_scheme(data, ABSCHEME):
|
||||
self._log.debug(u'attribute {} of {} set to {}',
|
||||
attr,
|
||||
item,
|
||||
val)
|
||||
setattr(item, attr, val)
|
||||
if not tags or attr in tags:
|
||||
self._log.debug(u'attribute {} of {} set to {}',
|
||||
attr,
|
||||
item,
|
||||
val)
|
||||
setattr(item, attr, val)
|
||||
else:
|
||||
self._log.debug(u'skipping attribute {} of {} (value {}) due to config',
|
||||
attr,
|
||||
item,
|
||||
val)
|
||||
item.store()
|
||||
if write:
|
||||
item.try_write()
|
||||
|
|
|
|||
|
|
@ -54,10 +54,12 @@ Configuration
|
|||
-------------
|
||||
|
||||
To configure the plugin, make a ``acousticbrainz:`` section in your
|
||||
configuration file. There is one option:
|
||||
configuration file. There are three options:
|
||||
|
||||
- **auto**: Enable AcousticBrainz during ``beet import``.
|
||||
Default: ``yes``.
|
||||
- **force**: Download AcousticBrainz data even for tracks that already have
|
||||
it.
|
||||
Default: ``no``.
|
||||
- **tags**: Which tags from the list above to set on your files.
|
||||
Default: [] (all)
|
||||
|
|
|
|||
Loading…
Reference in a new issue