From 41cb84957e376c3ce3c87f8d4b0aa72af8df93e9 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Sun, 6 Apr 2014 18:03:37 +0200 Subject: [PATCH] Return empty list instead of None. It's not necessary to only subset the list if there are items --- headphones/searcher.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/headphones/searcher.py b/headphones/searcher.py index ed225dce..7c247fca 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -552,13 +552,7 @@ def searchNZB(album, new=False, losslessOnly=False): # # Also will filter flac & remix albums if not specifically looking for it # This code also checks the ignored words and required words - - if len(resultlist): - resultlist[:] = [result for result in resultlist if verifyresult(result[0], artistterm, term, losslessOnly)] - - if len(resultlist): - return resultlist - + return [result for result in resultlist if verifyresult(result[0], artistterm, term, losslessOnly)] def send_to_downloader(data, bestqual, album): @@ -1286,11 +1280,7 @@ def searchTorrent(album, new=False, losslessOnly=False): #attempt to verify that this isn't a substring result #when looking for "Foo - Foo" we don't want "Foobar" #this should be less of an issue when it isn't a self-titled album so we'll only check vs artist - if len(resultlist): - resultlist[:] = [result for result in resultlist if verifyresult(result[0], artistterm, term, losslessOnly)] - if len(resultlist): - return resultlist - + return [result for result in resultlist if verifyresult(result[0], artistterm, term, losslessOnly)] # THIS IS KIND OF A MESS AND PROBABLY NEEDS TO BE CLEANED UP def preprocess(resultlist):