let ctrl-c work

This commit is contained in:
rany
2021-05-11 01:29:09 +03:00
parent d801716dc4
commit 1b450ebb76

View File

@@ -2,6 +2,7 @@
import sys
import json
import uuid
import signal
import argparse
import urllib.request
import websocket # pip install websocket-client
@@ -16,6 +17,11 @@ trustedClientToken = '6A5AA1D4EAFF4E9FB37E23D68491D6F4'
voiceList = 'https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=' + trustedClientToken
wsUrl = 'wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=' + trustedClientToken
def terminator(signo, stack_frame):
sys.exit()
signal.signal(signal.SIGINT, terminator)
signal.signal(signal.SIGTERM, terminator)
def connectId():
return str(uuid.uuid4()).replace("-", "")