]> git.treefish.org Git - photosort.git/commitdiff
do not re-check cached files locator
authorAlexander Schmidt <alex@treefish.org>
Mon, 26 Oct 2020 23:18:04 +0000 (00:18 +0100)
committerAlexander Schmidt <alex@treefish.org>
Mon, 26 Oct 2020 23:18:04 +0000 (00:18 +0100)
src/locator.py

index d283085d8be4d9b0a5407a57a23140207650e20d..da74d18432175b6bdb3ec14f8cef6694603c89d0 100644 (file)
@@ -20,25 +20,16 @@ class Locator:
         c = self._conn.cursor()
         c.execute("SELECT file_dir FROM cache WHERE name=? AND size=? AND meta_time=?",
                   (name, size, meta_time))
-
         cached = c.fetchone()
         if cached:
-            # if os.path.isfile(cached[0]) and \
-            #    os.path.getsize(cached[0]) == size and \
-            #    misc.extract_meta_time(cached[0]) == meta_time:
-            if os.path.isfile(cached[0]) and \
-               os.path.getsize(cached[0]) == size:
-                self._update_cache_access_time(name, size, meta_time)
-                return cached[0]
-            else:
-                self._remove_from_cache(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)
-        return file_dir
+            return cached[0]
+        else:
+            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)
+            return file_dir
 
     def close(self):
         logging.info("Closing locator for %s...", self._base_dir)