def getM3u8(): workId = request.args.get("workId") instance = SplitFatory() (isFind, m3u8Path) = instance.get_m3u8(workId) if (isFind == False): resultData(False, "找不到任务", None) return resultData(True, "", {"m3u8": m3u8Path})
def getSplitLog(): workId = request.args.get("workId") instance = SplitFatory() (isFind, logs) = instance.get_log(workId) (isFind, status) = instance.get_status(workId) if (isFind == False): resultData(False, "找不到任务", None) return resultData(True, "", {"logs": logs, "status": status})
def startSplit(): filePath = request.args.get("filePath") tempPath = request.args.get("tempPath") (sFilePath, sFileName) = os.path.split(filePath) (shotname, extension) = os.path.splitext(sFileName) cmd = preParam.format(filePathName=filePath, fileName=shotname, tempPath=tempPath) temp_m3u8 = "{tempPath}/{fileName}.m3u8".format(fileName=shotname, tempPath=tempPath) isExists = os.path.exists(tempPath) # 判断结果 if not isExists: # 如果不存在则创建目录 # 创建目录操作函数 os.makedirs(tempPath) instance = SplitFatory() workId = instance.execShell(cmd, temp_m3u8) return resultData(True, "", workId)