Encode Before upload
This commit is contained in:
parent
9a74b2b6e5
commit
9a3d3bd048
@ -11,7 +11,7 @@ q = queue.Queue()
|
|||||||
base_uri = ""
|
base_uri = ""
|
||||||
isUpload = False
|
isUpload = False
|
||||||
uq = queue.Queue()
|
uq = queue.Queue()
|
||||||
|
eq = queue.Queue()
|
||||||
|
|
||||||
class downloader(XiGuaLiveApi):
|
class downloader(XiGuaLiveApi):
|
||||||
files = []
|
files = []
|
||||||
@ -92,9 +92,16 @@ def download(url):
|
|||||||
if os.path.getsize(path) == 0:
|
if os.path.getsize(path) == 0:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
return False
|
return False
|
||||||
uq.put(path)
|
eq.put(path)
|
||||||
download(url)
|
download(url)
|
||||||
|
|
||||||
|
def encode():
|
||||||
|
i = eq.get()
|
||||||
|
while True:
|
||||||
|
if(os.path.exists(i)):
|
||||||
|
os.system("ffmpeg -i {} -c:v copy -c:a copy -f mp4 {}".format(i,i[:13]+".mp4"))
|
||||||
|
uq.put(i[:13]+".mp4")
|
||||||
|
|
||||||
|
|
||||||
def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):
|
def upload(date=datetime.strftime(datetime.now(), "%Y_%m_%d")):
|
||||||
print("{} : Upload Daemon Starting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M")))
|
print("{} : Upload Daemon Starting".format(datetime.strftime(datetime.now(), "%y%m%d %H%M")))
|
||||||
@ -142,6 +149,9 @@ if __name__ == "__main__":
|
|||||||
d = datetime.strftime(datetime.now(), "%Y_%m_%d")
|
d = datetime.strftime(datetime.now(), "%Y_%m_%d")
|
||||||
t = threading.Thread(target=download)
|
t = threading.Thread(target=download)
|
||||||
ut = threading.Thread(target=upload, args=(d,))
|
ut = threading.Thread(target=upload, args=(d,))
|
||||||
|
et = threading.Thread(target=encode, args=())
|
||||||
|
et.setDaemon(True)
|
||||||
|
et.start()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if api.isLive:
|
if api.isLive:
|
||||||
|
Reference in New Issue
Block a user