wip: native client

This commit is contained in:
wataru 2023-01-28 14:01:23 +09:00
parent 9f59f78079
commit 40f7215d0c
2 changed files with 16 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import multiprocessing as mp
import subprocess
from const import SSL_KEY_DIR
from const import NATIVE_CLIENT_FILE, SSL_KEY_DIR
from restapi.MMVC_Rest import MMVC_Rest
from sio.MMVC_SocketIOApp import MMVC_SocketIOApp
from voice_changer.VoiceChangerManager import VoiceChangerManager
@ -111,7 +111,6 @@ if __name__ == '__mp_main__':
printMessage(f"サーバプロセスを起動しています。", level=2)
if __name__ == '__main__':
if sys.platform.startswith('win'):
mp.freeze_support()
printMessage(f"Voice Changerを起動しています。", level=2)
@ -240,7 +239,13 @@ if __name__ == '__main__':
if sys.platform.startswith('win'):
process = subprocess.Popen(["voice-changer-native-client.exe", "-u", f"http://localhost:{PORT}/{path}"])
return_code = process.wait()
print("client clonsed.")
print("client closed.")
p.terminate()
elif sys.platform.startswith('darwin'):
process = subprocess.Popen([NATIVE_CLIENT_FILE, "-u", f"http://localhost:{PORT}/{path}"])
return_code = process.wait()
print("client closed.")
p.terminate()
except Exception as e:
print(e)

View File

@ -1,4 +1,5 @@
import os, sys
import os
import sys
import tempfile
frontend_path = os.path.join(sys._MEIPASS, "dist") if hasattr(sys, "_MEIPASS") else "../client/demo/dist"
@ -10,6 +11,10 @@ tmpdir = tempfile.TemporaryDirectory()
SSL_KEY_DIR = os.path.join(tmpdir.name, "keys") if hasattr(sys, "_MEIPASS") else "keys"
MODEL_DIR = os.path.join(tmpdir.name, "logs") if hasattr(sys, "_MEIPASS") else "logs"
UPLOAD_DIR = os.path.join(tmpdir.name, "upload_dir") if hasattr(sys, "_MEIPASS") else "upload_dir"
NATIVE_CLIENT_FILE = os.path.join(sys._MEIPASS, "voice-changer-native-client.app", "Contents", "MacOS",
"voice-changer-native-client") if hasattr(sys, "_MEIPASS") else "voice-changer-native-client"
# SSL_KEY_DIR = os.path.join(sys._MEIPASS, "keys") if hasattr(sys, "_MEIPASS") else "keys"
# MODEL_DIR = os.path.join(sys._MEIPASS, "logs") if hasattr(sys, "_MEIPASS") else "logs"
# UPLOAD_DIR = os.path.join(sys._MEIPASS, "upload_dir") if hasattr(sys, "_MEIPASS") else "upload_dir"