From eb962f7008660a6ce5e70927bf4486454519444d Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Tue, 17 Feb 2015 18:59:45 +0000 Subject: Better artist handling again --- models/track.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'models') diff --git a/models/track.py b/models/track.py index 896a29a..4d06872 100644 --- a/models/track.py +++ b/models/track.py @@ -364,11 +364,15 @@ class Track: musicbrainz_artistid = ?""", (musicbrainz_artistid,)) row = rows.fetchone() + if not row: + rows = c.execute("""SELECT * FROM artist WHERE + name = ? AND musicbrainz_artistid IS NULL""", + (artist_name,)) + row = rows.fetchone() if not row: rows = c.execute("""SELECT * FROM artist WHERE - name = ? AND musicbrainz_artistid IS NULL""", - (artist_name,)) + name = ?""", (artist_name,)) row = rows.fetchone() if row: @@ -376,7 +380,7 @@ class Track: sortname=row[2], musicbrainz_artistid=row[3]) - if (musicbrainz_artistid and + if (musicbrainz_artistid and (not hasattr(artist, "musicbrainz_artistid") or not artist.musicbrainz_artistid)): c.execute("""UPDATE artist SET -- cgit v1.2.3