def main(): testdata = parse() testPara = testdata.parse_media_param(1000, 2000, mediabase.ALL_PLATFORM, input_name, input_srt, input_logo) #vid, task_id testJson = json.dumps(testPara) outinfo = json.loads(mediaCodec_flow.transcode(testJson)) print "" print outinfo if outinfo["error_code"]: print "transcode failed: %s" % outinfo["error_code"] else: print "transcode succeed: %s" % outinfo["error_code"] print "transcode over!" exit(0)
def _video_pic(self): ''' 调度截图工具 ''' self.encode_tmp_path = self.tmpath + "encode/" self._init_encode_tmp_dir() self._create_pic_data() try: res = transcode(json.dumps(self.pic)) res = json.loads(res) if not res['error_code']: uploader = UploadToDNS(res['data'], URI, self.rc) res['error_code'], res['data'] = uploader.upload_pic() self.rc.log(res) db.close_connection() resinfo = res['error_msg'] if res['error_code'] else res['data'] VideoPic.objects.filter(taskid=self.taskid).update(status=res['error_code'], mediainfo=resinfo) self.rc.log(connection.queries[-1]) except Exception, e: VideoPic.objects.filter(taskid=self.taskid).update(status=52, mediainfo=str(e)) traceback.print_exc()