コード例 #1
0
ファイル: ndexport.py プロジェクト: mlclemente/notredam
    
            logger.info("workspace.json")
            f = file(os.path.join(workspacedir, 'workspace.json'), 'w')
            f.write(json_enc.encode(e._workspace_get(w['id'])))
            f.close()
    
            #Backup collections
            logger.info("collections.json")
            f = file(os.path.join(workspacedir, 'collections.json'),'w')
            f.write(json_enc.encode(e._collection_get_list(w['id'])))    
            f.close()
    
            #Backup keywords
            logger.info("keywords.json")
            f = file(os.path.join(workspacedir, 'keywords.json'),'w')
            f.write(json_enc.encode(e._keyword_get_list(w['id'])))
            f.close()
            
            #Backup renditions configuration
            logger.info( "renditions.json")
            f = file(os.path.join(workspacedir, 'renditions.json'),'w')
            rendition = e._workspace_get_renditions(w['id'])
            f.write(json_enc.encode(rendition))
            f.close()

            #Backup watermarking
#            waterdir = os.path.join(workspacedir, 'watermarking')
#            os.mkdir(waterdir) 
#            for v in rendition.keys():
#                for v_type in rendition[v].keys():
#                    if rendition[v][v_type].get('preferences') and rendition[v][v_type]['preferences'].get('watermarking_url') != None: 
コード例 #2
0
ファイル: ndimport.py プロジェクト: mlclemente/notredam
                    
                except Exception, ex:
                    logger.error(ex)
                    raise
    
            keyColl_origTokeyColl_new = {}
            try:
                logger.debug("custom_listdirs(path_extract)--- %s lunghezza %s" %(custom_listdirs(path_extract), len(custom_listdirs(path_extract))))
                for workspacedir in custom_listdirs(path_extract):
                    logger.debug("workspace____ %s" %workspacedir)
                    current_workspace = path_extract + '/' + workspacedir
                    #creation and assosiation of the keywords at the item
                    try:
                        paramkeywords = custom_open_file(current_workspace, 'keywords.json')
                        #FIXME: read and after delete all. Maybe should to be avoided
                        param = e._keyword_get_list(ws_origTows_new[str(paramkeywords['keywords'][0]['workspace'])])
                        for data in param['keywords']:
                            i._keyword_delete(data['id'])
                    except Exception, ex:
                        logger.error('first step')
                        logger.error(ex)
                        

                    try:
                        logger.debug('keywords.json for %s' % workspacedir)
                        for data in paramkeywords['keywords']:
                            add_keywords(i,data, ws_origTows_new, id_orig_itemToid_new_item,keyColl_origTokeyColl_new)
                        logger.info('collections.json for %s' % workspacedir)
                    except Exception, ex:
                        logger.error('second step')
                        logger.error(ex)
コード例 #3
0
            keyColl_origTokeyColl_new = {}
            try:
                logger.debug(
                    "custom_listdirs(path_extract)--- %s lunghezza %s" %
                    (custom_listdirs(path_extract),
                     len(custom_listdirs(path_extract))))
                for workspacedir in custom_listdirs(path_extract):
                    logger.debug("workspace____ %s" % workspacedir)
                    current_workspace = path_extract + '/' + workspacedir
                    #creation and assosiation of the keywords at the item
                    try:
                        paramkeywords = custom_open_file(
                            current_workspace, 'keywords.json')
                        #FIXME: read and after delete all. Maybe should to be avoided
                        param = e._keyword_get_list(ws_origTows_new[str(
                            paramkeywords['keywords'][0]['workspace'])])
                        for data in param['keywords']:
                            i._keyword_delete(data['id'])
                    except Exception, ex:
                        logger.error('first step')
                        logger.error(ex)

                    try:
                        logger.debug('keywords.json for %s' % workspacedir)
                        for data in paramkeywords['keywords']:
                            add_keywords(i, data, ws_origTows_new,
                                         id_orig_itemToid_new_item,
                                         keyColl_origTokeyColl_new)
                        logger.info('collections.json for %s' % workspacedir)
                    except Exception, ex:
                        logger.error('second step')
コード例 #4
0
            logger.info("workspace.json")
            f = file(os.path.join(workspacedir, 'workspace.json'), 'w')
            f.write(json_enc.encode(e._workspace_get(w['id'])))
            f.close()

            #Backup collections
            logger.info("collections.json")
            f = file(os.path.join(workspacedir, 'collections.json'), 'w')
            f.write(json_enc.encode(e._collection_get_list(w['id'])))
            f.close()

            #Backup keywords
            logger.info("keywords.json")
            f = file(os.path.join(workspacedir, 'keywords.json'), 'w')
            f.write(json_enc.encode(e._keyword_get_list(w['id'])))
            f.close()

            #Backup renditions configuration
            logger.info("renditions.json")
            f = file(os.path.join(workspacedir, 'renditions.json'), 'w')
            rendition = e._workspace_get_renditions(w['id'])
            f.write(json_enc.encode(rendition))
            f.close()

            #Backup watermarking
            #            waterdir = os.path.join(workspacedir, 'watermarking')
            #            os.mkdir(waterdir)
            #            for v in rendition.keys():
            #                for v_type in rendition[v].keys():
            #                    if rendition[v][v_type].get('preferences') and rendition[v][v_type]['preferences'].get('watermarking_url') != None: