登陆延迟问题
This commit is contained in:
parent
f80a44f1ac
commit
83af0df5d4
10
Common.py
10
Common.py
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
@ -38,7 +38,7 @@ config = {
|
|||||||
"enc": "ffmpeg -i {f} -c:v copy -c:a copy -f mp4 {t} -y"
|
"enc": "ffmpeg -i {f} -c:v copy -c:a copy -f mp4 {t} -y"
|
||||||
}
|
}
|
||||||
doCleanTime = datetime.now()
|
doCleanTime = datetime.now()
|
||||||
loginTime = datetime.now()
|
loginTime = datetime.now() - timedelta(days=3)
|
||||||
_clean_flag = None
|
_clean_flag = None
|
||||||
delay = 30
|
delay = 30
|
||||||
b = Bilibili()
|
b = Bilibili()
|
||||||
@ -299,8 +299,8 @@ def appendError(obj):
|
|||||||
errors = errors[-config["elc"]:]
|
errors = errors[-config["elc"]:]
|
||||||
|
|
||||||
|
|
||||||
def loginBilibili():
|
def loginBilibili(force=False):
|
||||||
if "dlO" not in config or config["dlO"] is False or forceNotUpload is False:
|
if force or config["dlO"] is False or forceNotUpload is False:
|
||||||
global loginTime
|
global loginTime
|
||||||
if getTimeDelta(datetime.now(), loginTime) < 86400 * 3:
|
if getTimeDelta(datetime.now(), loginTime) < 86400 * 3:
|
||||||
return True
|
return True
|
||||||
@ -381,6 +381,8 @@ def uploadVideo(name):
|
|||||||
global isUpload
|
global isUpload
|
||||||
if not os.path.exists(name):
|
if not os.path.exists(name):
|
||||||
Common.appendError("Upload File Not Exist {}".format(name))
|
Common.appendError("Upload File Not Exist {}".format(name))
|
||||||
|
loginBilibili()
|
||||||
|
doClean()
|
||||||
if forceNotUpload is False:
|
if forceNotUpload is False:
|
||||||
isUpload = True
|
isUpload = True
|
||||||
b.preUpload(VideoPart(name, os.path.basename(name)))
|
b.preUpload(VideoPart(name, os.path.basename(name)))
|
||||||
|
@ -204,7 +204,7 @@ def getUploadStats():
|
|||||||
|
|
||||||
@app.route("/account/reLogin", methods=["POST"])
|
@app.route("/account/reLogin", methods=["POST"])
|
||||||
def accountRelogin():
|
def accountRelogin():
|
||||||
Common.loginBilibili()
|
Common.loginBilibili(True)
|
||||||
return jsonify({"message":"ok","code":200,"status":0,"data":{}})
|
return jsonify({"message":"ok","code":200,"status":0,"data":{}})
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,10 +57,8 @@ def encode():
|
|||||||
def upload():
|
def upload():
|
||||||
date=datetime.strftime(datetime.now(), "%Y_%m_%d")
|
date=datetime.strftime(datetime.now(), "%Y_%m_%d")
|
||||||
Common.appendUploadStatus("Upload Daemon Starting")
|
Common.appendUploadStatus("Upload Daemon Starting")
|
||||||
Common.loginBilibili()
|
|
||||||
i = Common.uploadQueue.get()
|
i = Common.uploadQueue.get()
|
||||||
while True:
|
while True:
|
||||||
Common.doClean()
|
|
||||||
if i is True:
|
if i is True:
|
||||||
Common.publishVideo(date)
|
Common.publishVideo(date)
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user