Your Name 4 роки тому
батько
коміт
1c76c5458b
3 змінених файлів з 42 додано та 10 видалено
  1. 25 0
      apis/zhtest.py
  2. 9 2
      tests/fonttest.py
  3. 8 8
      tests/openshottest.py

+ 25 - 0
apis/zhtest.py

@@ -10,6 +10,31 @@ from celery import Celery
 app = Celery('tasks', broker='redis://db.ptt.cx/0')
 
 
+
+
+
+@app.task
+def full_task(datadict):
+    content=datadict['content']
+    title=datadict['title']
+    bg1=datadict['bg1']
+    import zhtts
+    tts = zhtts.TTS() 
+    #tts = zhtts.TTS(text2mel_name="TACOTRON") # use fastspeech2 by default
+    tts.text2wav(content, "/var/wav/full.wav")
+    os.chdir('/root/src/CMM_API/tests')
+    os.system('python3 fonttest.py '+title)
+    os.system('curl -o /var/txt/tmp.jpg '+bg1)
+    os.system('convert /var/txt/tmp.jpg -resize 1050x1050 > /var/txt/bg1.jpg')
+    os.chdir('/home/jared/to_video')
+    os.system('export CUDA_VISIBLE_DEVICES=0 ; python3.7 save_mel.py --face nina-no-ges.mp4 --audio /var/wav/full.wav --outfile /var/video/full.mp4 --checkpoint_path gan.pth')
+    #text2mel_name="TACOTRON"
+    os.chdir('/root/src/CMM_API/tests')
+    os.chdir('python3 openshottest.py')
+    return "ok"
+
+
+
 @app.task
 def to_video(fname):
     os.chdir('/home/jared/to_video')

+ 9 - 2
tests/fonttest.py

@@ -1,6 +1,13 @@
 from PIL import Image,ImageDraw,ImageFont
+import sys
 
-unicode_text = "這是一段中文測試"
+if len(sys.argv)<=1:
+    print('not enough arguments')
+    sys.exit()
+
+unicode_text= sys.argv[1]
+
+#unicode_text = "這是一段中文測試"
 #font = ImageFont.truetype("c:/portable/fonts/華康綜藝體.ttf", 40,encoding='big5')
 #font = ImageFont.truetype("c:/portable/fonts/華康綜藝體.ttf", 40,encoding='big5')
 
@@ -29,4 +36,4 @@ draw.text((5,5), text, (255, 255, 255), font)
 
 # save the blank canvas to a file
 canvas.save("/var/txt/title.png", "PNG")
-canvas.show()
+#canvas.show()

+ 8 - 8
tests/openshottest.py

@@ -43,14 +43,14 @@ w.SetVideoOptions(True, "libx264", openshot.Fraction(30000, 1000), 1280, 720,
                   openshot.Fraction(1, 1), False, False, 3000000)
 
 
-w.info.metadata["title"] = "testtest"
-w.info.metadata["artist"] = "aaa"
-w.info.metadata["album"] = "bbb"
-w.info.metadata["year"] = "2015"
-w.info.metadata["description"] = "ddd"
-w.info.metadata["comment"] = "eee"
-w.info.metadata["comment"] = "comment"
-w.info.metadata["copyright"] = "copyright OpenShot!"
+w.info.metadata["title"] = "ChoozMo"
+w.info.metadata["artist"] = "ChoozMo"
+w.info.metadata["album"] = "ChoozMo"
+w.info.metadata["year"] = "2021"
+w.info.metadata["description"] = "ChoozMo"
+w.info.metadata["comment"] = "ChoozMo"
+w.info.metadata["comment"] = "ChoozMo"
+w.info.metadata["copyright"] = "copyright ChoozMo!"
 
 # Open the Writer
 w.Open()