style following review

This commit is contained in:
Dorian 2021-02-06 15:07:10 +01:00
parent 93ebb9816d
commit 00b08d52d5
2 changed files with 12 additions and 11 deletions

View file

@ -260,11 +260,10 @@ def track_info(recording, index=None, medium=None, medium_index=None,
if arranger: if arranger:
info.arranger = u', '.join(arranger) info.arranger = u', '.join(arranger)
# supplementary tags provided by plugins # supplementary fields provided by plugins
extra_trackdatas = plugins.send('extracting_trackdata', info=recording) extra_trackdatas = plugins.send('mb_track_extract', data=recording)
for extra_trackdata in extra_trackdatas: for extra_trackdata in extra_trackdatas:
for key in extra_trackdata: info.update(extra_trackdata)
info[key] = extra_trackdata[key]
info.decode() info.decode()
return info return info
@ -454,11 +453,9 @@ def album_info(release):
if config['musicbrainz']['genres'] and genres: if config['musicbrainz']['genres'] and genres:
info.genre = ';'.join(g['name'] for g in genres) info.genre = ';'.join(g['name'] for g in genres)
# supplementary tags provided by plugins extra_albumdatas = plugins.send('mb_album_extract', data=release)
extra_albumdatas = plugins.send('extracting_albumdata', info=release)
for extra_albumdata in extra_albumdatas: for extra_albumdata in extra_albumdatas:
for key in extra_albumdata: info.update(extra_albumdata)
info[key] = extra_albumdata[key]
info.decode() info.decode()
return info return info

View file

@ -239,10 +239,14 @@ The events currently available are:
:ref:`appending choices to the prompt <append_prompt_choices>` by returning a :ref:`appending choices to the prompt <append_prompt_choices>` by returning a
list of ``PromptChoices``. Parameters: ``task`` and ``session``. list of ``PromptChoices``. Parameters: ``task`` and ``session``.
* `extracting_trackdata` and `extracting_albumdata`: called after the metadata * `mb_track_extract`: called after the metadata is obtained from
is obtained from MusicBrainz. The parameter is a ``dict`` containing the data MusicBrainz. The parameter is a ``dict`` containing the data
retrieved from MusicBrainz for a track or an album. retrieved from MusicBrainz for a track.
Allows to add additional tags. Allows to add additional tags.
Parameter: ``data``
* `mb_album_extract`: Like `mb_track_extract`, but for album tags.
Parameter: ``data``
The included ``mpdupdate`` plugin provides an example use case for event listeners. The included ``mpdupdate`` plugin provides an example use case for event listeners.