|
|
@@ -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") |
|
|
|
|