From 9d42728f7fdb05a00c59df561d3eb67a2dc2cf06 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 19 Apr 2017 19:07:29 -0400 Subject: [PATCH] ftintitle: Clarify control flow Assigning to this variable made it hard to tell what the function was actually returning. --- beetsplug/ftintitle.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/beetsplug/ftintitle.py b/beetsplug/ftintitle.py index db450d9c8..3b1caffe6 100644 --- a/beetsplug/ftintitle.py +++ b/beetsplug/ftintitle.py @@ -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):