mirror of
https://github.com/beetbox/beets.git
synced 2025-12-26 18:43:38 +01:00
ftintitle: Clarify control flow
Assigning to this variable made it hard to tell what the function was actually returning.
This commit is contained in:
parent
78f19db511
commit
9d42728f7f
1 changed files with 4 additions and 5 deletions
|
|
@ -49,13 +49,11 @@ def find_feat_part(artist, albumartist):
|
|||
"""Attempt to find featured artists in the item's artist fields and
|
||||
return the results. Returns None if no featured artist found.
|
||||
"""
|
||||
feat_part = None
|
||||
|
||||
# Look for the album artist in the artist field. If it's not
|
||||
# present, give up.
|
||||
albumartist_split = artist.split(albumartist, 1)
|
||||
if len(albumartist_split) <= 1:
|
||||
return feat_part
|
||||
return None
|
||||
|
||||
# If the last element of the split (the right-hand side of the
|
||||
# album artist) is nonempty, then it probably contains the
|
||||
|
|
@ -63,15 +61,16 @@ def find_feat_part(artist, albumartist):
|
|||
elif albumartist_split[-1] != '':
|
||||
# Extract the featured artist from the right-hand side.
|
||||
_, feat_part = split_on_feat(albumartist_split[-1])
|
||||
return feat_part
|
||||
|
||||
# Otherwise, if there's nothing on the right-hand side, look for a
|
||||
# featuring artist on the left-hand side.
|
||||
else:
|
||||
lhs, rhs = split_on_feat(albumartist_split[0])
|
||||
if lhs:
|
||||
feat_part = lhs
|
||||
return lhs
|
||||
|
||||
return feat_part
|
||||
return None
|
||||
|
||||
|
||||
class FtInTitlePlugin(plugins.BeetsPlugin):
|
||||
|
|
|
|||
Loading…
Reference in a new issue