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)
|
||||
if not exists(path):
|
||||
return 0
|
||||
library.reset()
|
||||
return call("NEWSOURCE", library.scan, path)
|
||||
|
||||
def walk_library():
|
||||
|
|
|
@ -31,7 +31,6 @@ class Library(collection.Collection):
|
|||
def scan(self, path):
|
||||
print "Library scanning %s" % path
|
||||
set_badfiles()
|
||||
self.reset()
|
||||
self.update(path)
|
||||
self.save()
|
||||
save(badfiles, "badfiles", "")
|
||||
|
@ -50,6 +49,7 @@ class Library(collection.Collection):
|
|||
def update(self, path):
|
||||
global badfiles
|
||||
FileRef = libsaria.collection.FileRef
|
||||
find_id = self.find_id
|
||||
|
||||
for root,dirs,files in walk(path):
|
||||
stripped_root = root.strip(sep)
|
||||
|
@ -59,6 +59,8 @@ class Library(collection.Collection):
|
|||
if ext in badfiles:
|
||||
continue
|
||||
path = join(root, file)
|
||||
if find_id(path) != None:
|
||||
continue
|
||||
try:
|
||||
ref = FileRef(path)
|
||||
except:
|
||||
|
|
Loading…
Reference in New Issue