|
|
@@ -0,0 +1,28 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+
|
|
|
+import os
|
|
|
+from db import db
|
|
|
+from subprocess import Popen,PIPE
|
|
|
+from constants import RAW_PATH,INCOMING_PATH
|
|
|
+
|
|
|
+d=db()
|
|
|
+for fname in os.listdir(INCOMING_PATH):
|
|
|
+ if fname.endswith("flv"):
|
|
|
+ out_fname=os.path.join(RAW_PATH, os.path.basename(fname).replace('flv','mp4'))
|
|
|
+ in_fname=os.path.join(INCOMING_PATH, fname)
|
|
|
+ if os.path.isfile(out_fname):
|
|
|
+ print("%s exists" % out_fname)
|
|
|
+ #exists
|
|
|
+ continue
|
|
|
+ process=[ 'ffmpeg',
|
|
|
+ '-loglevel', 'error',
|
|
|
+ '-i', in_fname,
|
|
|
+ '-c', 'copy',
|
|
|
+ '-movflags', '+faststart',
|
|
|
+ '-f','mp4',
|
|
|
+ out_fname
|
|
|
+ ]
|
|
|
+
|
|
|
+ print(" ".join(process))
|
|
|
+ proc=Popen(process, universal_newlines=True)
|
|
|
+d.insert_raw_list()
|