Try Encoding Before Upload

This commit is contained in:
Jerry Yan 2019-03-10 10:54:31 +08:00 committed by JerryYan
parent bfbbe06cd2
commit 1e039fb1c9

View File

@ -12,7 +12,7 @@ q = queue.Queue()
base_uri = ""
isUpload = False
uq = queue.Queue()
eq = queue.Queue()
class downloader(XiGuaLiveApi):
files = []
@ -116,10 +116,22 @@ def download(path=datetime.strftime(datetime.now(), "%Y%m%d_%H%M.ts")):
f.close()
if n:
isUpload = True
uq.put(path)
eq.put(path)
print("{} : Download Daemon Quiting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M")))
def encode():
i = eq.get()
while True:
os.system("ffmpeg -i {} -c:a copy -c:v copy -f mp4 {}".format(i,i[:-3] + ".mp4"))
if config["mv"]:
shutil.move(i, config["mtd"])
elif config["del"]:
os.remove(i)
uq.put(i[:-3] + ".mp4")
i = eq.get()
def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):
print("{} : Upload Daemon Starting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M")))
i = uq.get()
@ -138,11 +150,7 @@ def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):
b.preUpload(VideoPart(i, os.path.basename(i)))
except:
continue
if config["mv"]:
shutil.move(i, config["mtd"])
elif config["del"]:
os.remove(i)
os.remove(i)
i = uq.get()
print("{} : Upload Daemon Quiting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M")))