35 lines
736 B
Python
35 lines
736 B
Python
from flask import Flask, render_template as Render
|
|
from flask_rq2 import RQ as _RQ
|
|
import rq_dashboard as _RQD
|
|
from youtube_dl import YoutubeDL as YDL
|
|
from time import sleep
|
|
from .log import FeLog
|
|
from .callbacks import CbJob
|
|
|
|
BaseYDLOpts={
|
|
'no_color': True,
|
|
'call_home': False,
|
|
'logger': FeLog(),
|
|
'progress_hooks': {
|
|
'status': CbJob.status,
|
|
},
|
|
}
|
|
|
|
# Init
|
|
app=Flask(__name__)
|
|
app.config.from_object(_RQD.default_settings)
|
|
app.register_blueprint(_RQD.blueprint, url_prefix="/redis")
|
|
RQ=_RQ(app)
|
|
|
|
#Routes
|
|
@RQ.job('test', timeout=30)
|
|
def DeliberatelyTimesOut():
|
|
sleep(35)
|
|
|
|
@app.route('/')
|
|
def index(): return Render("index.html.j2")
|
|
|
|
@app.route('/add/timeouttest')
|
|
def timeouttest():
|
|
j=DeliberatelyTimesOut.queue()
|
|
return 'queued' |