| @@ -16,21 +16,24 @@ codec = "h265" | |||||
| if(len(sys.argv)>1): | if(len(sys.argv)>1): | ||||
| codec=sys.argv[1] | codec=sys.argv[1] | ||||
| # timeout=sys.argv[2] | # timeout=sys.argv[2] | ||||
| print("codec:: %s" %codec) | |||||
| print("codec:: {0}".format(codec)) | |||||
| current_time=time.strftime(time.strftime("%Y-%m-%d-%H"),time.localtime()) | current_time=time.strftime(time.strftime("%Y-%m-%d-%H"),time.localtime()) | ||||
| file_list = os.listdir(DAT_FOLDER) | file_list = os.listdir(DAT_FOLDER) | ||||
| if file_list: | if file_list: | ||||
| for dat in file_list: | for dat in file_list: | ||||
| if current_time+".dat" == dat: | if current_time+".dat" == dat: | ||||
| print("%s ignore" %dat) | |||||
| print("{0} ignore".format(dat)) | |||||
| continue | continue | ||||
| status, output = subprocess.getstatusoutput("ffmpeg -i " + os.path.join(DAT_FOLDER,dat) + " -c copy " + os.path.join(TARGET_FOLDER, codec, dat.split(".")[0], TARGET_SUFFIX)) | |||||
| cmd = "ffmpeg -i " + os.path.join(DAT_FOLDER,dat) + " -c copy " + os.path.join(TARGET_FOLDER, codec, dat.split(".")[0], TARGET_SUFFIX) | |||||
| print("cmd:: {0}".format(cmd)) | |||||
| status, output = subprocess.getstatusoutput(cmd) | |||||
| print("status:: {0}, output {1}".format(status,output)) | |||||
| if status==0: | if status==0: | ||||
| print("%s convert sucessfull" %dat) | |||||
| os.remove(os.path.join(DAT_FOLDER,dat)) | |||||
| print("{0} convert sucessfull, origin dat will remove!".format(dat)) | |||||
| os.remove(os.path.join(DAT_FOLDER, dat)) | |||||
| else: | else: | ||||
| print("%s convert fail" %dat) | |||||
| print("{0} convert fail".format(dat)) | |||||
| else: | else: | ||||
| print("folder is empty") | print("folder is empty") | ||||