X-Git-Url: http://git.treefish.org/~alex/photosort.git/blobdiff_plain/797a8228d05a1080d6928721d96a53f8fc91ec06..7027dd05f6a97b7d0537cb393e58080b16a71ec5:/src/locator.py diff --git a/src/locator.py b/src/locator.py index 7a57e09..3b866f8 100644 --- a/src/locator.py +++ b/src/locator.py @@ -10,10 +10,10 @@ class Locator: self._base_dir = base_dir self._exclude_dir = exclude_dir if not os.path.isfile(db_file): - self._conn = sqlite3.connect(db_file) + self._conn = sqlite3.connect(db_file, check_same_thread=False) self._create_db() else: - self._conn = sqlite3.connect(db_file) + self._conn = sqlite3.connect(db_file, check_same_thread=False) logging.info("Opened locator for %s.", self._base_dir) def locate_file(self, name, size, meta_time): @@ -30,7 +30,8 @@ class Locator: else: self._remove_from_cache(name, size, meta_time) else: - file_dir = misc.find_file(name, size, meta_time) + file_dir = misc.find_file(self._base_dir, name, size, meta_time, + self._exclude_dir) if file_dir: self._clean_cache() self._add_to_cache(name, size, meta_time, file_dir) @@ -61,7 +62,7 @@ class Locator: def _clean_cache(self): c = self._conn.cursor() - c.execute("DELETE FROM cache WHERE access_time