diff --git a/src/core/ct/update.py b/src/core/ct/update.py index acbd9aa8..2cc4a18a 100644 --- a/src/core/ct/update.py +++ b/src/core/ct/update.py @@ -33,9 +33,20 @@ def addtrk(path): scanned += 1 try: f = tagpy.FileRef(path) + t = f.tag() added += 1 except: - pass + return + + artist = t.artist + if artist == "": + artist = "Unknown Artist" + sel = sql.Select("id","artist","name='"+artist.replace("\'","\'\'")+"'") + result = sel.execute().fetchall() + write(result) + if result == []: + ins = sql.Insert("artist",[None,artist]) + ins.execute() def scan((dir,func)): @@ -67,14 +78,10 @@ def go(name): totthr = needle.Needle(scan,(path,incr)) totthr.start() + # Start a thread to actually add tracks to the db scthr = needle.Needle(scan,(path,addtrk)) scthr.start() - #scan(path, incr) - #write(path) - #totthr.join() - #write(str(total) + " Files to scan") - def prcnt(): global total