wip: native client2

This commit is contained in:
wataru 2023-01-28 14:09:00 +09:00
parent 40f7215d0c
commit 9cc7dc5eb7
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import multiprocessing as mp
import subprocess
from const import NATIVE_CLIENT_FILE, SSL_KEY_DIR
from const import NATIVE_CLIENT_FILE_MAC, NATIVE_CLIENT_FILE_WIN, SSL_KEY_DIR
from restapi.MMVC_Rest import MMVC_Rest
from sio.MMVC_SocketIOApp import MMVC_SocketIOApp
from voice_changer.VoiceChangerManager import VoiceChangerManager
@ -237,12 +237,13 @@ if __name__ == '__main__':
p.start()
try:
if sys.platform.startswith('win'):
process = subprocess.Popen(["voice-changer-native-client.exe", "-u", f"http://localhost:{PORT}/{path}"])
# process = subprocess.Popen(["voice-changer-native-client.exe", "-u", f"http://localhost:{PORT}/{path}"])
process = subprocess.Popen([NATIVE_CLIENT_FILE_WIN, "-u", f"http://localhost:{PORT}/{path}"])
return_code = process.wait()
print("client closed.")
p.terminate()
elif sys.platform.startswith('darwin'):
process = subprocess.Popen([NATIVE_CLIENT_FILE, "-u", f"http://localhost:{PORT}/{path}"])
process = subprocess.Popen([NATIVE_CLIENT_FILE_MAC, "-u", f"http://localhost:{PORT}/{path}"])
return_code = process.wait()
print("client closed.")
p.terminate()

View File

@ -11,8 +11,9 @@ 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"
NATIVE_CLIENT_FILE_WIN = os.path.join(sys._MEIPASS, "voice-changer-native-client.exe") if hasattr(sys, "_MEIPASS") else "voice-changer-native-client"
NATIVE_CLIENT_FILE_MAC = 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"