From 5cf837aee20d141b22b8ad1e0dd13e68e0b3514a Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Mon, 25 Oct 2010 21:58:18 -0400 Subject: [PATCH] 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. --- libsaria/collection/__init__.py | 1 - libsaria/collection/lens.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libsaria/collection/__init__.py b/libsaria/collection/__init__.py index 011dea5b..7c7c8578 100644 --- a/libsaria/collection/__init__.py +++ b/libsaria/collection/__init__.py @@ -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(): diff --git a/libsaria/collection/lens.py b/libsaria/collection/lens.py index 27a89c40..e8977ccd 100644 --- a/libsaria/collection/lens.py +++ b/libsaria/collection/lens.py @@ -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: