Exemplo n.º 1
0
 def on_ok_button_clicked(self, widget, data=None):
     import wwjufsdatabase.libs.services.servicesV2 as service
     req = service.req()
     #gtk.main_quit()
     entry = self.builder.get_object("entry1")
     tag = entry.get_text()
     print tag
     tag_list_raw = tag.split(",")
     tag_list = []
     for i in tag_list_raw:
         if i == "":
             continue
         tag_list.append(unicode(i))
     t = tagSystem.getTagSysObj(req.getDbSys())
     for i in self.liststore:
         #print i[0], i[1]
         if i[0]:
             url = i[1]
             url = url.replace("file:///", "")
             url = unicode(url)
             full_path = transform.transformDirToInternal(url)
             #print "full_path is:", full_path
             t.tag(full_path, tag_list)
             from localLibs.services.beanstalkdServices.TagProcessServiceV2 import TagProcessService
             p = TagProcessService()
             for cur_tag in tag_list:
                 p.addItem({"url":full_path, "tag":cur_tag})
     self.window1.hide()
Exemplo n.º 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"]
     
     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
Exemplo n.º 3
0
 def __init__ ( self, tubeName, rootFolder, blackList = []):
     self.blackList = blackList
     self.rootFolder = transform.transformDirToInternal(rootFolder)
     super(FolderEnumeratingThread, self).__init__ (tubeName)
     self.quit_flag = False
     import wwjufsdatabase.libs.services.servicesV2 as service
     self.req = service.req()
     self.obj_db = self.req.getObjDbSys()
Exemplo n.º 4
0
 def __init__ ( self, tubeName, rootFolder, state_collection_id, blackList = []):
     self.blackList = blackList
     self.rootFolder = transform.transformDirToInternal(rootFolder)
     super(UpdateCheckingThread, self).__init__ (tubeName)
     self.quit_flag = False
     import wwjufsdatabase.libs.services.servicesV2 as service
     self.req = service.req()
     self.obj_db = self.req.getObjDbSys()
     self.collection = self.obj_db.getCollection(state_collection_id)
Exemplo n.º 5
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
Exemplo n.º 6
0
def getThumb(path, targetDir = gWorkingDir, mime_type = None, req = None):
    if req is None:
        import wwjufsdatabase.libs.services.servicesV2 as service
        req = service.req()
    #We can have a database from the req. So save the thumb info.
    t = ThumbServiceBase(req.getDbSys())
    if isUfsFs(path):
        full_path = getPathForUfsUrl(path)
    else:
        full_path = path
    #cl(path)
    full_path = transformDirToInternal(full_path)
    return t.get_thumb(full_path, targetDir, mime_type)
        
Exemplo n.º 7
0
 def __init__ ( self, input_tube_name, storage):
     '''
     Constructor
     '''
     super(FileListProcessorThreadBase, self).__init__(input_tube_name)
     self.storage = storage
     self.curStorageSize = 0
     self.monitoring_list = []
     #self.dbInst = objectDatabase.objectDatabase()
     self.info_dict = {}
     self.collectionId = storage.get_storage_id()
     req = service.req()
     self.dbInst = req.getObjDbSys()
     self.collection = self.dbInst.getCollection(self.collectionId)
Exemplo n.º 8
0
 def finalize_one_trunk(self):
     trunk_path = super(SyncedCompressedStorage, self).finalize_one_trunk()
     root, ext = os.path.splitext(trunk_path)
     target_path = misc.get_date_based_path(self.sync_folder, ext)
     req = service.req()
     cache_db = req.getDbSys().getDb("cache_db")
     obj_db = req.getObjDbSys()
     obj = obj_db.getFsObjFromFullPath(trunk_path)
     obj_uuid = obj.get_uuid()
     cache_db.append(obj_uuid, target_path)
     try:
         win32file.CreateSymbolicLink(trunk_path, target_path, 1)
     except:
         traceback.print_exc()
         shutil.copyfile(trunk_path, target_path)
Exemplo n.º 9
0
 def __init__ ( self, input_tube_name, storage, collector_list, working_dir):
     '''
     Constructor
     '''
     super(FileArchiveThread, self).__init__(input_tube_name)
     self.storage = storage
     self.curStorageSize = 0
     self.monitoring_list = []
     #self.dbInst = objectDatabase.objectDatabase()
     self.info_dict = {}
     self.collector_list = collector_list
     self.working_dir = working_dir
     self.collectionId = storage.get_storage_id()
     req = service.req()
     self.dbInst = req.getObjDbSys()
     self.collection = self.dbInst.getCollection(self.collectionId)
     
     #File Archive specific operations
     self.file_archive_collection = self.dbInst.getCollection(g_file_archive_storage_collection_id)
     collection_virtual_obj_uuid = self.dbInst.addVirtualObj({"storage_collection_id":self.collectionId})
     self.file_archive_collection.addObj(self.collectionId, collection_virtual_obj_uuid)
     #The following dictionary is used to update collection.
     self.saving_items = {}
Exemplo n.º 10
0
'''
Created on 2012-4-19

@author: Richard
'''

import wwjufsdatabase.libs.tag.tagSystemInterfaceV2 as tagSystem
if __name__ == '__main__':
    import wwjufsdatabase.libs.services.servicesV2 as service
    req = service.req()
    t = tagSystem.getTagSysObj(req.getDbSys())
    e = t.getObjs(u"download")
    for i in e:
        print i
Exemplo n.º 11
0
 def __init__(self):
     self.existingIconRelativePath = 'wwjufsdatabase\\webapproot\\static\\icons\\'
     self.prodRootPath = getProdRoot()
     self.req = service.req()