]> git.treefish.org Git - photosort.git/blobdiff - src/bunch.py
clean registry only once after migration
[photosort.git] / src / bunch.py
index 228131a9e1ec5e6b8157f86813b9fbffceb15634..1c3fe716d3cd403cfe1f6c4e3666dc8005747fb1 100644 (file)
@@ -1,4 +1,5 @@
 import logging
+import os
 import time
 import threading
 
@@ -13,17 +14,18 @@ class Bunch:
             self.migrator = migrator
             self.cleanup = cleanup
 
-    def __init__(self, idx, cfg):
+    def __init__(self, idx, cache_dir, cfg):
         self._idx = idx
         source_idx = 1
         self._sources = []
         for src_dir_cfg in cfg['src_dirs']:
+            reg_db = os.path.join(cache_dir, "reg_%d_%d.db" % (idx, source_idx))
             self._sources.append(
                 Bunch.TriggeredSource(
                     source_idx,
                     DirTrigger(src_dir_cfg['path'], src_dir_cfg['cool_time'],
                                src_dir_cfg['max_time']),
-                    Migrator(src_dir_cfg['path'], cfg['dst_dir']['path']),
+                    Migrator(src_dir_cfg['path'], cfg['dst_dir']['path'], reg_db),
                     src_dir_cfg['cleanup']
                 )
             )