关联关系
This commit is contained in:
parent
e72eeb1f0e
commit
900b1bd614
4
app.py
4
app.py
@ -1,5 +1,5 @@
|
|||||||
from flask import Flask
|
from flask import Flask
|
||||||
from config import load_config, WEB_HOST, WEB_PORT
|
from config import load_config
|
||||||
from controller.view.main_blueprint import blueprint as view_main_blueprint
|
from controller.view.main_blueprint import blueprint as view_main_blueprint
|
||||||
from controller.api.config_blueprint import blueprint as api_config_blueprint
|
from controller.api.config_blueprint import blueprint as api_config_blueprint
|
||||||
from controller.api.collector_blueprint import blueprint as api_collector_blueprint
|
from controller.api.collector_blueprint import blueprint as api_collector_blueprint
|
||||||
@ -27,4 +27,4 @@ with app.app_context():
|
|||||||
db.create_all(app=app)
|
db.create_all(app=app)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(WEB_HOST, WEB_PORT)
|
app.run()
|
||||||
|
15
config.py
15
config.py
@ -30,12 +30,6 @@ VIDEO_CLIP_OVERFLOW_SEC = 5
|
|||||||
BILILIVE_RECORDER_DIRECTORY = "./"
|
BILILIVE_RECORDER_DIRECTORY = "./"
|
||||||
# xigua_dir
|
# xigua_dir
|
||||||
XIGUALIVE_RECORDER_DIRECTORY = "./"
|
XIGUALIVE_RECORDER_DIRECTORY = "./"
|
||||||
# [web]
|
|
||||||
# host
|
|
||||||
WEB_HOST = "0.0.0.0"
|
|
||||||
# port
|
|
||||||
WEB_PORT = 5000
|
|
||||||
|
|
||||||
|
|
||||||
def load_config():
|
def load_config():
|
||||||
if not os.path.exists("config.ini"):
|
if not os.path.exists("config.ini"):
|
||||||
@ -69,11 +63,6 @@ def load_config():
|
|||||||
section = config['recorder']
|
section = config['recorder']
|
||||||
BILILIVE_RECORDER_DIRECTORY = section.get('bili_dir', BILILIVE_RECORDER_DIRECTORY)
|
BILILIVE_RECORDER_DIRECTORY = section.get('bili_dir', BILILIVE_RECORDER_DIRECTORY)
|
||||||
XIGUALIVE_RECORDER_DIRECTORY = section.get('xigua_dir', XIGUALIVE_RECORDER_DIRECTORY)
|
XIGUALIVE_RECORDER_DIRECTORY = section.get('xigua_dir', XIGUALIVE_RECORDER_DIRECTORY)
|
||||||
if config.has_section("web"):
|
|
||||||
global WEB_HOST, WEB_PORT
|
|
||||||
section = config['web']
|
|
||||||
WEB_HOST = section.get('host', WEB_HOST)
|
|
||||||
WEB_PORT = section.getint('port', WEB_PORT)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -101,10 +90,6 @@ def get_config():
|
|||||||
'bili_dir': BILILIVE_RECORDER_DIRECTORY,
|
'bili_dir': BILILIVE_RECORDER_DIRECTORY,
|
||||||
'xigua_dir': XIGUALIVE_RECORDER_DIRECTORY,
|
'xigua_dir': XIGUALIVE_RECORDER_DIRECTORY,
|
||||||
},
|
},
|
||||||
'web': {
|
|
||||||
'host': WEB_HOST,
|
|
||||||
'port': WEB_PORT,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .Workflow import Workflow
|
||||||
|
|
||||||
|
|
||||||
class DanmakuClip(db.Model):
|
class DanmakuClip(db.Model):
|
||||||
@ -9,7 +12,7 @@ class DanmakuClip(db.Model):
|
|||||||
file = db.Column(db.String(255))
|
file = db.Column(db.String(255))
|
||||||
offset = db.Column(db.Float, nullable=False, default=0)
|
offset = db.Column(db.Float, nullable=False, default=0)
|
||||||
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'))
|
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'))
|
||||||
workflow = db.relationship("Workflow", backref=db.backref("danmaku_clips", lazy="dynamic"))
|
workflow: "Workflow" = db.relationship("Workflow", uselist=False, backref=db.backref("danmaku_clips"))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_path(self):
|
def full_path(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user