From 761c3b4715289358f8b482a73de587861f804b48 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Fri, 31 Aug 2012 22:21:05 +0100 Subject: [PATCH] Need to wait until the album info is committed to the db before firing off the searcher thread when adding an artist with AUTOWANT_ALL selected --- headphones/importer.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/headphones/importer.py b/headphones/importer.py index f69b3a7a..d8ceb281 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -348,17 +348,19 @@ def addArtisttoDB(artistid, extrasonly=False): if headphones.AUTOWANT_ALL: newValueDict['Status'] = "Wanted" - - #start a search for the album - import searcher - searcher.searchforalbum(albumid=rg['id']) - elif album['ReleaseDate'] > helpers.today() and headphones.AUTOWANT_UPCOMING: newValueDict['Status'] = "Wanted" else: newValueDict['Status'] = "Skipped" myDB.upsert("albums", newValueDict, controlValueDict) + + #start a search for the album if it's new and autowant_all is selected: + # Should this run in a background thread? Don't know if we want to have a bunch of + # simultaneous threads running + if not rg_exists and headphones.AUTOWANT_ALL: + from headphones import searcher + searcher.searchforalbum(albumid=rg['id']) myDB.action('DELETE from tracks WHERE AlbumID=?', [rg['id']]) tracks = myDB.action('SELECT * from alltracks WHERE ReleaseID=?', [releaseid]).fetchall()