Library update
I no longer reset the library before scanning. This allows me to do a basic form of updating. Unfortunately, I have to manually select the same directory to update it. Eventually I should find a way of automating library updates.
This commit is contained in:
parent
c35f210369
commit
5cf837aee2
|
@ -31,7 +31,6 @@ def new_source(path, bg=True):
|
||||||
path = expand(path)
|
path = expand(path)
|
||||||
if not exists(path):
|
if not exists(path):
|
||||||
return 0
|
return 0
|
||||||
library.reset()
|
|
||||||
return call("NEWSOURCE", library.scan, path)
|
return call("NEWSOURCE", library.scan, path)
|
||||||
|
|
||||||
def walk_library():
|
def walk_library():
|
||||||
|
|
|
@ -31,7 +31,6 @@ class Library(collection.Collection):
|
||||||
def scan(self, path):
|
def scan(self, path):
|
||||||
print "Library scanning %s" % path
|
print "Library scanning %s" % path
|
||||||
set_badfiles()
|
set_badfiles()
|
||||||
self.reset()
|
|
||||||
self.update(path)
|
self.update(path)
|
||||||
self.save()
|
self.save()
|
||||||
save(badfiles, "badfiles", "")
|
save(badfiles, "badfiles", "")
|
||||||
|
@ -50,6 +49,7 @@ class Library(collection.Collection):
|
||||||
def update(self, path):
|
def update(self, path):
|
||||||
global badfiles
|
global badfiles
|
||||||
FileRef = libsaria.collection.FileRef
|
FileRef = libsaria.collection.FileRef
|
||||||
|
find_id = self.find_id
|
||||||
|
|
||||||
for root,dirs,files in walk(path):
|
for root,dirs,files in walk(path):
|
||||||
stripped_root = root.strip(sep)
|
stripped_root = root.strip(sep)
|
||||||
|
@ -59,6 +59,8 @@ class Library(collection.Collection):
|
||||||
if ext in badfiles:
|
if ext in badfiles:
|
||||||
continue
|
continue
|
||||||
path = join(root, file)
|
path = join(root, file)
|
||||||
|
if find_id(path) != None:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
ref = FileRef(path)
|
ref = FileRef(path)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue