From 50af43b89568882df40df14717f85c5517cfc46e Mon Sep 17 00:00:00 2001 From: Kim Wittenburg <5wittenb@informatik.uni-hamburg.de> Date: Tue, 4 Sep 2018 13:23:18 +0200 Subject: [PATCH] Functionify --- beetsplug/itunes.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/beetsplug/itunes.py b/beetsplug/itunes.py index 9f7c08d..3a0f402 100644 --- a/beetsplug/itunes.py +++ b/beetsplug/itunes.py @@ -344,10 +344,7 @@ class iTunesPlugin(BeetsPlugin): if self.method in ['lookup', 'lookup (search fallback)']: choices += [PromptChoice('c', 'searCh iTunes', self.prompt_search)] - no_itunes_matches = 0 - for match in task.candidates: - if match.info.data_source == 'iTunes': - no_itunes_matches += 1 + no_itunes_matches = len(list(filter(lambda match: match.info.data_source == 'iTunes', task.candidates))) if no_itunes_matches == 1 and task.candidates[0].info.data_source == 'iTunes': print_(colorize('text_highlight', 'This is the only iTunes Match'))