From 16c68e5ceb898837443dc3070f65cafafd9f7044 Mon Sep 17 00:00:00 2001 From: JerryYan <792602257@qq.com> Date: Sun, 7 Apr 2019 19:12:03 +0800 Subject: [PATCH] wc --- WebMain.py | 37 +++++++++++++++++++++++++------------ bilibili.py | 2 +- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/WebMain.py b/WebMain.py index bd2e5da..283acc6 100644 --- a/WebMain.py +++ b/WebMain.py @@ -1,14 +1,21 @@ from time import sleep - -from flask import Flask, jsonify, request +from flask_cors import CORS +from flask import Flask, jsonify, request, redirect, url_for import Common import threading from liveDownloader import run as RUN app = Flask("liveStatus") app.config['JSON_AS_ASCII'] = False +CORS(app, supports_credentials=True) +url_for('static', filename='index.html') +url_for('static', filename='index.js') +@app.route("/") +def index(): + return redirect("/static/index.html") + @app.route("/config", methods=["GET"]) def readConfig(): config = Common.config.copy() @@ -74,13 +81,19 @@ def getUploadStats(): }}) -t = threading.Thread(target=RUN, args=(Common.config['l_u'],)) -t.setDaemon(True) -t.start() -while True: - if t.is_alive(): - sleep(240) - else: - t = threading.Thread(target=RUN, args=(Common.config['l_u'],)) - t.setDaemon(True) - t.start() +def SubThread(): + t = threading.Thread(target=RUN, args=(Common.config['l_u'],)) + t.setDaemon(True) + t.start() + while True: + if t.is_alive(): + sleep(240) + else: + t = threading.Thread(target=RUN, args=(Common.config['l_u'],)) + t.setDaemon(True) + t.start() + + +p = threading.Thread(target = SubThread) +p.setDaemon(True) +p.start() diff --git a/bilibili.py b/bilibili.py index a7ffa03..6290f8a 100644 --- a/bilibili.py +++ b/bilibili.py @@ -188,7 +188,7 @@ class Bilibili: """ self.preUpload(parts) self.finishUpload(title, tid, tag, desc, source, cover, no_reprint) - self.clean() + self.clear() def preUpload(self, parts): """