尝试大改,可读性有点差的版本,基本做到能实时处理弹幕

This commit is contained in:
2022-06-03 23:08:43 +08:00
parent 3f95b07009
commit 74a15849ab
16 changed files with 181 additions and 204 deletions

19
main.py
View File

@ -1,18 +1,27 @@
import sys
import threading
import subprocess
from urllib.parse import urlparse
from scripts import watcher, webdriver
from config.helper import config
from handler.http_server import app
from handler.utils import loop_queue
from scripts import webdriver
if __name__ == '__main__':
if len(sys.argv) == 1 or not urlparse(sys.argv[1]).scheme:
print('Invalid url provided, please check...')
sys.exit(1)
t = threading.Thread(target=webdriver.go, args=(sys.argv[1],))
api_thread = threading.Thread(target=app.run, args=(config()["http"]["host"], config()["http"]["port"],))
api_thread.start()
mitmproxy_process = subprocess.Popen([
config()["mitm"]["bin"], "-s", "./scripts/mitmproxy.py", "-q",
"--listen-host", config()["mitm"]["host"], "--listen-port", str(config()["mitm"]["port"])
])
t = threading.Thread(target=webdriver.go)
t.start()
queue_thread = threading.Thread(target=loop_queue)
queue_thread.start()
queue_thread.join()
w = watcher.Watcher(directory=config()['watchdog']['dir'])
w.run()