From c72cfacec93bb9532725555205acd1a906e24907 Mon Sep 17 00:00:00 2001 From: Gitea Date: Fri, 10 Jan 2020 12:54:16 +0800 Subject: [PATCH] adjust --- viddeo.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/viddeo.py b/viddeo.py index 5238e64..bab913e 100644 --- a/viddeo.py +++ b/viddeo.py @@ -16,21 +16,24 @@ codec = "h265" if(len(sys.argv)>1): codec=sys.argv[1] # 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()) file_list = os.listdir(DAT_FOLDER) if file_list: for dat in file_list: if current_time+".dat" == dat: - print("%s ignore" %dat) + print("{0} ignore".format(dat)) 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: - 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: - print("%s convert fail" %dat) + print("{0} convert fail".format(dat)) else: print("folder is empty")