IsWaterMark = xmlroot.find("wmark").text if IsWaterMark == "True": WaterMarkPath = xmlroot.find("wmarkpath").text wmarkposition = str(xmlroot.find("wmarkposition").text) LeftPixels = xmlroot.find("lpixels").text UpPixels = xmlroot.find("upixels").text IsWaterMark = True else: IsWaterMark = False WaterMarkPath,LeftPixels,UpPixels = None,None,None IsOverWrite = xmlroot.find("overwrite").text MysqlObj = baseclass.interWithMysql(logger,VideoFileNameAlias) if IsOverWrite == "True": IsOverWrite = True #预览图状态,1表示用默认图片,2表示用户有上传自定义的预览图 pstat = MysqlObj.getPicStatus() else: IsOverWrite = False logger.info("video info : \n \ VideoFileNameAlias : %s \n \ VideoFilePath : %s \n \ OriginVideoFormat : %s \n \ IsWaterMark : %s \n \
# --/ # Initialization stage # --/ try: logger.info("Start reducer.....") #视频元数据 info_dict = pickle.load(open('video.info','r')) #hadoop信息 hadoopinfo_dict = pickle.load(open('hadoop.info','r')) #初始化mysql对象 MysqlObj = baseclass.interWithMysql(logger,info_dict['name']) except Exception,e: logger.error("reducer init exception: %s"%e) MysqlObj.writeStatus("fail",info_dict['iswatermark'],info_dict['isoverwrite'],info="reducer init exception: %s"%e) sys.exit() #重新初始化日志对象和mysql对象 logger = baseclass.getlog(info_dict['name'],loglevel=info_dict['loglevel']) MysqlObj = baseclass.interWithMysql(logger,info_dict['name']) #初始化redis对象 RedisObj = baseclass.interWithRedis(logger,info_dict['name']) # --/ # Execute commands stage
IsWaterMark = xmlroot.find("wmark").text if IsWaterMark == "True": WaterMarkPath = xmlroot.find("wmarkpath").text wmarkposition = str(xmlroot.find("wmarkposition").text) LeftPixels = xmlroot.find("lpixels").text UpPixels = xmlroot.find("upixels").text IsWaterMark = True else: IsWaterMark = False WaterMarkPath, LeftPixels, UpPixels = None, None, None IsOverWrite = xmlroot.find("overwrite").text MysqlObj = baseclass.interWithMysql(logger, VideoFileNameAlias) if IsOverWrite == "True": IsOverWrite = True #预览图状态,1表示用默认图片,2表示用户有上传自定义的预览图 pstat = MysqlObj.getPicStatus() else: IsOverWrite = False logger.info("video info : \n \ VideoFileNameAlias : %s \n \ VideoFilePath : %s \n \ OriginVideoFormat : %s \n \ IsWaterMark : %s \n \
# --/ # Initialization stage # --/ try: logger.info("Start reducer.....") #视频元数据 info_dict = pickle.load(open('video.info', 'r')) #hadoop信息 hadoopinfo_dict = pickle.load(open('hadoop.info', 'r')) #初始化mysql对象 MysqlObj = baseclass.interWithMysql(logger, info_dict['name']) except Exception, e: logger.error("reducer init exception: %s" % e) MysqlObj.writeStatus("fail", info_dict['iswatermark'], info_dict['isoverwrite'], info="reducer init exception: %s" % e) sys.exit() #重新初始化日志对象和mysql对象 logger = baseclass.getlog(info_dict['name'], loglevel=info_dict['loglevel']) MysqlObj = baseclass.interWithMysql(logger, info_dict['name']) #初始化redis对象