Can add artists to the library
This commit is contained in:
parent
5dc8dc52e9
commit
b391dedc85
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue