From e2a8bdb23d0d377590104475e6e762058461d612 Mon Sep 17 00:00:00 2001 From: Ben Ockmore Date: Mon, 4 Jan 2016 17:33:03 +0000 Subject: [PATCH] Changed initial value of song variable to None, which is clearer --- beetsplug/lastimport.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/beetsplug/lastimport.py b/beetsplug/lastimport.py index 2b4ac5035..a85a1a30d 100644 --- a/beetsplug/lastimport.py +++ b/beetsplug/lastimport.py @@ -194,7 +194,7 @@ def process_tracks(lib, tracks, log): log.info('Received {0} tracks in this page, processing...', total) for num in xrange(0, total): - song = '' + song = None trackid = tracks[num]['mbid'].strip() artist = tracks[num]['artist'].get('name', '').strip() title = tracks[num]['name'].strip() @@ -211,7 +211,7 @@ def process_tracks(lib, tracks, log): ).get() # Otherwise try artist/title/album - if not song: + if song is None: log.debug(u'no match for mb_trackid {0}, trying by ' u'artist/title/album', trackid) query = dbcore.AndQuery([ @@ -222,7 +222,7 @@ def process_tracks(lib, tracks, log): song = lib.items(query).get() # If not, try just artist/title - if not song: + if song is None: log.debug(u'no album match, trying by artist/title') query = dbcore.AndQuery([ dbcore.query.SubstringQuery('artist', artist), @@ -231,7 +231,7 @@ def process_tracks(lib, tracks, log): song = lib.items(query).get() # Last resort, try just replacing to utf-8 quote - if not song: + if song is None: title = title.replace("'", u'\u2019') log.debug(u'no title match, trying utf-8 single quote') query = dbcore.AndQuery([ @@ -240,7 +240,7 @@ def process_tracks(lib, tracks, log): ]) song = lib.items(query).get() - if song: + if song is not None: count = int(song.get('play_count', 0)) new_count = int(tracks[num]['playcount']) log.debug(u'match: {0} - {1} ({2}) '