import pyttsx3 import rpyc import random import time #conn = rpyc.classic.connect("192.168.1.110",18812) conn = rpyc.classic.connect("192.168.192.134",18812) ros = conn.modules.os rsys = conn.modules.sys engine = pyttsx3.init() #engine.say("I will speak this text") #engine.save_to_file("中文測試,我會講中文", 'test.mp3') engine.setProperty('rate',175) #engine.save_to_file("你好,我是,集仕多股份有限公司,開發的,人工智慧主播。", 'test.mp3') engine.save_to_file("我們和幸福空間合作,全自動的方式,產生人工智慧影片。集仕多股份有限公司團隊製作。", 'test.mp3') engine.runAndWait() fr=open('test.mp3','rb') fw=conn.builtins.open('/tmp/ok2.mp3','wb') while True: b=fr.read(1024) if b: fw.write(b) else: break fr.close() fw.close() val=random.randint(1000000,9999999) ros.chdir('/home/jared/Wav2Lip-master') ros.system('./proc.sh '+str(val)+' &') while True: print('waiting...') if ros.path.exists('/tmp/results/'+str(val)): break time.sleep(5) print('waiting...') ros.system('cp /home/jared/Wav2Lip-master/results/result_voice.mp4 /tmp') ros.chdir('/home/jared/tests/libopenshot') ros.system('python3 jaredtest.py') ros.system('cp /tmp/out.mp4 /var/www/html/out.mp4') ros.system('telegram-send "video is ready, http://139.162.121.30:54321/out.mp4"') #fr=conn.builtins.open('/home/jared/Wav2Lip-master/results/result_voice.mp4','rb') fr=conn.builtins.open('/tmp/out.mp4','rb') fw=open('result.mp4','wb') while True: b=fr.read(1024) if b: fw.write(b) else: break fr.close() fw.close()