class Omnisync(): def __init__(self, progress_callback): self.file_queue = FileQueue() self.watchers = [] for watch_config in config.data['watches']: if not watch_config.get('disabled'): self.watchers.append( FileWatcher(self.file_queue, watch_config)) self.sync_manager = SyncManager( self.file_queue, progress_callback=progress_callback) def stop(self): [w.stop() for w in self.watchers] self.sync_manager.stop()
def syncer(request): syncer = SyncManager.get_syncer_instances( filter=lambda syncer: syncer == request.param)[request.param] syncer.init() syncer.rm(REMOTE_ROOT, trash=False) def clean(): print('removing remote') syncer.rm(REMOTE_ROOT, trash=False) request.addfinalizer(clean) return syncer