From 9c750fbb4b8ef7e2f8e4fc008dc2893b21ec6452 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Fri, 11 Sep 2020 22:36:50 -0700 Subject: [PATCH] updates --- saisoku.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/saisoku.py b/saisoku.py index 270c33e..85d3a8b 100644 --- a/saisoku.py +++ b/saisoku.py @@ -27,7 +27,7 @@ from Queue import Queue from threading import Thread, Lock from shutil import copyfile, move, rmtree, Error -from scandir import scandir +from scandir import scandir, walk from tqdm import tqdm from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler @@ -445,17 +445,15 @@ def on_modified(self, event): logger.info(f"{event.src_path} has been modified") if not event.is_directory: os.system(f'rsync -uv "{event.src_path}" "{os.path.join(self.dst, event.src_path.replace(self.src, self.dst))}"') - else: - os.system(f'rsync -av "{event.src_path}/" "{os.path.join(self.dst, event.src_path.replace(self.src, self.dst))}"') - + def on_moved(self, event): logger.info(f"{event.src_path} moved to {event.dest_path}") if event.is_directory: - for dirpath, subdirs, files in os.walk(self.dst): + for dirpath, subdirs, files in walk(self.dst): if dirpath == event.src_path.replace(self.src, self.dst): move(dirpath, event.dest_path.replace(self.src, self.dst)) else: - for dirpath, subdirs, files in os.walk(self.dst): + for dirpath, subdirs, files in walk(self.dst): for file in files: filepath = os.path.join(dirpath, file) if filepath == event.src_path.replace(self.src, self.dst):