示例#1
0
文件: backend.py 项目: ctz/flashover
def process_one(job):
    job = uuid(job)
    print 'We have job', job
    status, location = get_job_status(job)

    if status != 'awaiting':
        print 'rejected: already processed'
        return dict()

    outdir = path.join(config.outputdir, str(job))
    try:
        meta = swfback.process_file(path.join(location, config.inputfn), location)
    except Exception, e:
        emit_meta(location, dict(error = 'Failed to process swf'))
        emit_exception(location)
        meta = dict()
示例#2
0
文件: swftest.py 项目: ctz/flashover
import swfback
import glob
import os, sys, shutil
import pprint
import json
path = os.path

def mustdir(d):
    if path.isdir(d):
        shutil.rmtree(d)
    if not path.isdir(d):
        os.makedirs(d)

if __name__ == '__main__':
    mustdir('testout')
    #sys.stdout = o
    for f in glob.glob('../corpus/*.swf'):
        print 'file', f
        out = path.join('testout', path.basename(f))
        mustdir(out)
        meta = swfback.process_file(f, out)
        
        o = open(path.join(out, 'meta.json'), 'w')
        json.dump(meta, o)
        o.close()
示例#3
0
文件: swftest.py 项目: ctz/flashover
import swfback
import glob
import os, sys, shutil
import pprint
import json
path = os.path


def mustdir(d):
    if path.isdir(d):
        shutil.rmtree(d)
    if not path.isdir(d):
        os.makedirs(d)


if __name__ == '__main__':
    mustdir('testout')
    #sys.stdout = o
    for f in glob.glob('../corpus/*.swf'):
        print 'file', f
        out = path.join('testout', path.basename(f))
        mustdir(out)
        meta = swfback.process_file(f, out)

        o = open(path.join(out, 'meta.json'), 'w')
        json.dump(meta, o)
        o.close()