mirror of
https://github.com/beetbox/beets.git
synced 2026-02-08 08:25:23 +01:00
Fix formating
This commit is contained in:
parent
074a278316
commit
05fa515867
1 changed files with 15 additions and 6 deletions
|
|
@ -144,14 +144,19 @@ def assign_items(
|
|||
}
|
||||
|
||||
# allow plugins to modify the mapping
|
||||
new_assign_list = plugins.send("assign_items", mapping=mapping, org_items=items, org_tracks=tracks)
|
||||
|
||||
new_assign_list = plugins.send(
|
||||
"assign_items", mapping=mapping, org_items=items, org_tracks=tracks
|
||||
)
|
||||
|
||||
# get the first plugin provided mapping that is a dict and not empty
|
||||
new_mapping = next((item for item in new_assign_list if isinstance(item, dict) and item), None)
|
||||
new_mapping = next(
|
||||
(item for item in new_assign_list if isinstance(item, dict) and item),
|
||||
None,
|
||||
)
|
||||
if new_mapping:
|
||||
# if a plugin provided a mapping, use that instead of the default one
|
||||
mapping = new_mapping
|
||||
|
||||
|
||||
extra_items = list(set(items) - mapping.keys())
|
||||
extra_items.sort(key=lambda i: (i.disc, i.track, i.title))
|
||||
extra_tracks = list(set(tracks) - set(mapping.values()))
|
||||
|
|
@ -401,9 +406,13 @@ def _recommendation(
|
|||
else:
|
||||
# No conclusion. Return immediately. Can't be downgraded any further.
|
||||
# but allow plugins to modify the recommendation
|
||||
new_rec_list = plugins.send("recommendation", results=results, org_rec=Recommendation.none)
|
||||
new_rec_list = plugins.send(
|
||||
"recommendation", results=results, org_rec=Recommendation.none
|
||||
)
|
||||
# take the first recommendation from a plugin
|
||||
if len(new_rec_list) > 0 and isinstance(new_rec_list[0], Recommendation):
|
||||
if len(new_rec_list) > 0 and isinstance(
|
||||
new_rec_list[0], Recommendation
|
||||
):
|
||||
return new_rec_list[0]
|
||||
return Recommendation.none
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue