def loadExistingFiles(): #Transfers directory = completedTransfersDirectory if not os.path.isdir(directory): os.makedirs(directory) for item in os.listdir(directory): if item == ".svn": continue path = os.path.join(directory, item) if os.path.isdir(path): path = path + "/" unit = unitTransfer(path) addWatchForTransfer(path, unit) #SIPS directory = sipCreationDirectory if not os.path.isdir(directory): os.makedirs(directory) for item in os.listdir(directory): if item == ".svn": continue path = os.path.join(directory, item) if os.path.isdir(path): path = path + "/" UUID = archivematicaMCP.findOrCreateSipInDB(path) unit = unitSIP(path, UUID) addWatchForSIP(path, unit)
def process_IN_MOVED_TO(self, event): #time.sleep(archivematicaMCP.dbWaitSleep) #let db be updated by the microservice that moved it. #print event #print "process_IN_MOVED_TO SIPCreationWatch" path = os.path.join(event.path, event.name) if not os.path.isdir(path): print >>sys.stderr, "Bad path for watching - not a directory: ", path return if os.path.abspath(event.path) == os.path.abspath(completedTransfersDirectory): path = path + "/" unit = unitTransfer(path) addWatchForTransfer(path, unit) elif os.path.abspath(event.path) == os.path.abspath(sipCreationDirectory): path = path + "/" UUID = archivematicaMCP.findOrCreateSipInDB(path, waitSleep=0) unit = unitSIP(path.replace(archivematicaMCP.config.get('MCPServer', "sharedDirectory"), "%sharedPath%", 1), UUID) notifier = addWatchForSIP(path, unit) self.sips[path[:-1]] = notifier else: print >>sys.stderr, "Bad path for watching: ", event.path