初始版本

This commit is contained in:
2022-04-15 14:33:01 +08:00
parent 09b2956573
commit e72eeb1f0e
6 changed files with 124 additions and 7 deletions

View File

@ -1,3 +1,5 @@
import os
from . import db
@ -5,16 +7,18 @@ class DanmakuClip(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
base_path = db.Column(db.String(255))
file = db.Column(db.String(255))
subtitle_file = db.Column(db.String(255))
offset = db.Column(db.Float, nullable=False, default=0)
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'))
workflow = db.relationship("Workflow", backref=db.backref("danmaku_clips", lazy="dynamic"))
@property
def full_path(self):
return os.path.abspath(os.path.join(self.base_path, self.file))
def to_json(self):
return {
"id": self.id,
"base_path": self.base_path,
"file": self.file,
"subtitle_file": self.subtitle_file,
"offset": self.offset,
}