proc_video.py 794 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import rpyc
  2. import random
  3. import time
  4. import codecs
  5. import sys
  6. import os
  7. from gtts import gTTS
  8. fr=codecs.open('/tmp/script.txt','r','utf-8')
  9. lines=fr.readlines()
  10. fr.close()
  11. txt=lines[0].strip()
  12. tts = gTTS(txt, lang='zh-tw')
  13. tts.save('/tmp/ok2.mp3')
  14. val=random.randint(1000000,9999999)
  15. os.chdir('/home/jared/Wav2Lip-master')
  16. os.system('./proc.sh '+str(val)+' &')
  17. while True:
  18. print('waiting...')
  19. if os.path.exists('/tmp/results/'+str(val)):
  20. break
  21. time.sleep(5)
  22. print('waiting...')
  23. os.system('cp /home/jared/Wav2Lip-master/results/result_voice.mp4 /tmp')
  24. os.chdir('/home/jared/tests/libopenshot')
  25. os.system('python3 jaredtest.py')
  26. os.system('cp /tmp/out.mp4 /var/www/html/out.mp4')
  27. os.system('telegram-send "video is ready, http://139.162.121.30:54321/out.mp4"')