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()
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()