Beispiel #1
0
 def processItem(self, job, item):
     #fullPath = transform.transformDirToInternal(item["fullPath"])
     #monitoringFullPath = transform.transformDirToInternal(item["monitoringPath"])
     
     #source_dir = item["SourceDir"]
     #misc.ensureDir(source_dir)
     
     tag = item["tag"]
     
     working_dir = item["WorkingDir"]
     misc.ensureDir(transform.transformDirToInternal(working_dir))
     
     target_dir = item["TargetDir"]
     misc.ensureDir(transform.transformDirToInternal(target_dir))
     
     import wwjufsdatabase.libs.services.servicesV2 as service
     req = service.req()
     t = tagSystem.getTagSysObj(req.getDbSys())
     e = t.getObjs(unicode(tag))
     for i in e:
         print i
         source_dir = transform.transformDirToInternal(i)
         
         AutoArchiveThumb(source_dir, target_dir, working_dir)
     job.delete()
     return False
     #Return true only when the item should be kept in the tube
     return True
Beispiel #2
0
    def processItem(self, job, item):
        #fullPath = transform.transformDirToInternal(item["fullPath"])
        #monitoringFullPath = transform.transformDirToInternal(item["monitoringPath"])
        
        #source_dir = item["SourceDir"]
        #misc.ensureDir(source_dir)
        
        tag = item["tag"]
        
        task_item = item
        
        if item.has_key("output_tube_name"):
            #################################
            # Adding tag processing task
            #################################
            task_item = item
            self.processing_tag_dict[tag] = item
            import wwjufsdatabase.libs.services.servicesV2 as service
            req = service.req()
            t = tagSystem.getTagSysObj(req.getDbSys())
            tagged_item_list = t.getObjs(unicode(tag))
        else:
            #################################
            # A new tag added for existing tag processing task
            #################################
            if self.processing_tag_dict.has_key(tag):
                #Task exist, add the new tagged elment for processing
                task_item = self.processing_tag_dict[tag]
                tagged_item_list = [transform.transformDirToInternal(item["url"])]
            else:
                #Not a valid item, return
                print "not a valid item or tag not have processor yet"
                job.delete()
                return False
            
            
        output_tube_name = task_item["output_tube_name"]
        
        working_dir = task_item["working_dir"]
        misc.ensureDir(transform.transformDirToInternal(working_dir))
        
        target_dir = task_item["target_dir"]
        misc.ensureDir(transform.transformDirToInternal(target_dir))
        
        
        b = beanstalkServiceBase(output_tube_name)

        for i in tagged_item_list:
            info(i)
            source_dir = transform.transformDirToInternal(i)
            
            b.addItem({"source_dir":source_dir, "working_dir": working_dir, "target_dir":target_dir})

        job.delete()
        return False
Beispiel #3
0
 def __init__(self, trunk_data_path = gWorkingDir, package_class = EncZipFileOn7Zip, ext = ".7z", passwd = '123'):
     super(CompressedStorage, self).__init__()
     self.trunk_data_path = trunk_data_path
     misc.ensureDir(self.trunk_data_path)
     ####################
     # The following var is not expected to be used in outside of this class
     self.package_class = package_class
     self.passwd = passwd
     self.ext = ext
     self.package_file = None
     self.package_file_full_path = None
Beispiel #4
0
 def processItem(self, job, item):
     #fullPath = transform.transformDirToInternal(item["fullPath"])
     #monitoringFullPath = transform.transformDirToInternal(item["monitoringPath"])
     working_dir = item["WorkingDir"]
     misc.ensureDir(working_dir)
     
     source_dir = item["SourceDir"]
     misc.ensureDir(source_dir)
     
     target_dir = item["TargetDir"]
     misc.ensureDir(target_dir)
     
     AutoArchiveThumb(source_dir, target_dir, working_dir)
     return True
    def processItem(self, job, item):
        source_dir = item["source_dir"]
        if os.path.isdir(source_dir):
            misc.ensureDir(transform.transformDirToInternal(source_dir))
        
        working_dir = item["working_dir"]
        misc.ensureDir(transform.transformDirToInternal(working_dir))
        
        target_dir = item["target_dir"]
        misc.ensureDir(transform.transformDirToInternal(target_dir))

        AutoArchiveThumb(source_dir, target_dir, working_dir)
        
        #Must delete the job if it is no longer needed and return False so the job will not be put back to tube
        job.delete()
        return False
Beispiel #6
0
    def processItem(self, job, item):
        working_dir = item["WorkingDir"]
        misc.ensureDir(working_dir)
        
        tmp_file_path = os.path.join(working_dir, "tmp_file_path")
        misc.ensureDir(tmp_file_path)

        other_tmp_file_path = os.path.join(working_dir, "other_tmp_file_path")
        misc.ensureDir(other_tmp_file_path)        
        
        
        inputTubeName = item["InputTubeName"]
        target_dir = item["TargetDir"]
        if self.is_processing_tube(inputTubeName):
            job.delete()
            return False
        t = FolderInfoArchiveThread(inputTubeName, 
                              self.storage_class(tmp_file_path, 
                                                 passwd=self.passwd, 
                                                 sync_folder = target_dir), 
                              self.collector_list, other_tmp_file_path)
        self.add_work_thread(inputTubeName, t)
        t.start()
        return True
Beispiel #7
0
 def __init__(self, logName, logRootPath = "D:/tmp/logs", maxLogFile = 10):
     self.logName = logName.replace("\\","_").replace("/","_").replace(":","_").replace("'","").replace('"',"").replace("?","").replace("*","").replace(" ","")
     self.logFullPath = os.path.join(logRootPath, self.logName)
     self.maxLogFile = maxLogFile
     misc.ensureDir(self.logFullPath)
Beispiel #8
0
import localLibSys
import os
import sqliteListShoveWithHistory
import localLibs.utils.misc as misc

gAppPath = 'd:/tmp/fileman/'
gDbPath = os.path.join(gAppPath, 'db')

misc.ensureDir(gAppPath)
misc.ensureDir(gDbPath)

class ShoveForSession(sqliteListShoveWithHistory.Shove):
    def __init__(self, sqliteDbName, sessionInstance, dbPath = gDbPath):
        if sessionInstance is None:
            path = os.path.join(dbPath,sqliteDbName+".sqlite")
        else:
            p = sessionInstance.getDbPath(dbPath)
            path = os.path.join(p, sqliteDbName+".sqlite")
        sqliteListShoveWithHistory.Shove.__init__(self, path)
        self.sessInst = sessionInstance


class Shove(sqliteListShoveWithHistory.Shove):
    def __init__(self, sqliteDbName, dbPath = gDbPath):
        if sessionInstance is None:
            path = os.path.join(dbPath,sqliteDbName+".sqlite")
        else:
            p = sessionInstance.getDbPath(dbPath)
            path = os.path.join(p, sqliteDbName+".sqlite")
        sqliteListShoveWithHistory.Shove.__init__(self, path)
Beispiel #9
0
 def __init__(self, working_dir=gWorkingDir):
     super(ThumbCollector, self).__init__()
     self.working_dir = working_dir
     misc.ensureDir(working_dir)
     self.dbInst = objectDatabase.objectDatabase()
Beispiel #10
0
 def getDbPath(self, dbPath):
     p = os.path.join(os.path.join(dbPath, 'user'), self.username)
     misc.ensureDir(p)
     return p