mirror of
https://gitlab.com/gpvkt/twitchtts.git
synced 2025-04-21 19:22:26 +02:00
Open TTS website in browser automatically
This commit is contained in:
parent
2ed3745b7f
commit
45973580b8
1 changed files with 8 additions and 3 deletions
9
tts.py
9
tts.py
|
@ -29,6 +29,7 @@ import datetime
|
||||||
import socketserver
|
import socketserver
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from http.server import BaseHTTPRequestHandler
|
from http.server import BaseHTTPRequestHandler
|
||||||
|
@ -593,9 +594,11 @@ def main():
|
||||||
|
|
||||||
if conf['IRC_OAUTH_TOKEN'] == "Invalid":
|
if conf['IRC_OAUTH_TOKEN'] == "Invalid":
|
||||||
logging.error('No OAuth Token, skipping start of IRC bot.')
|
logging.error('No OAuth Token, skipping start of IRC bot.')
|
||||||
while True:
|
|
||||||
logging.error('Please open http://%s:%s/token to generate your OAuth-Token.', conf['HTTP_BIND'], conf['HTTP_PORT'])
|
logging.error('Please open http://%s:%s/token to generate your OAuth-Token.', conf['HTTP_BIND'], conf['HTTP_PORT'])
|
||||||
time.sleep(10)
|
url = 'http://'+str(conf['HTTP_BIND'])+':'+str(conf['HTTP_PORT'])+'/token'
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
logging.info('Please complete the OAuth process within the next 15 minutes.')
|
||||||
|
time.sleep(900)
|
||||||
else:
|
else:
|
||||||
logging.info("Starting IRC bot")
|
logging.info("Starting IRC bot")
|
||||||
irc = IRC()
|
irc = IRC()
|
||||||
|
@ -604,6 +607,8 @@ def main():
|
||||||
irc.sendmsg(conf['IRC_CHANNEL'], 'MrDestructoid', conf['MESSAGE']['READY'])
|
irc.sendmsg(conf['IRC_CHANNEL'], 'MrDestructoid', conf['MESSAGE']['READY'])
|
||||||
|
|
||||||
logging.info("Please open your browser and visit: http://%s:%s/", conf['HTTP_BIND'], conf['HTTP_PORT'])
|
logging.info("Please open your browser and visit: http://%s:%s/", conf['HTTP_BIND'], conf['HTTP_PORT'])
|
||||||
|
url = 'http://'+str(conf['HTTP_BIND'])+':'+str(conf['HTTP_PORT'])
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if conf['LOG_LEVEL'] == "DEBUG":
|
if conf['LOG_LEVEL'] == "DEBUG":
|
||||||
|
|
Loading…
Add table
Reference in a new issue