You've already forked my-video-workflow
关联关系修改
This commit is contained in:
@ -2,18 +2,19 @@ import os.path
|
||||
import threading
|
||||
from datetime import datetime
|
||||
from glob import glob
|
||||
from flask import Blueprint, jsonify, request, current_app
|
||||
from typing import Optional
|
||||
|
||||
from flask import Blueprint, jsonify, request, current_app
|
||||
|
||||
from config import BILILIVE_RECORDER_DIRECTORY, VIDEO_TITLE, XIGUALIVE_RECORDER_DIRECTORY
|
||||
from exception.danmaku import DanmakuException
|
||||
from model import db
|
||||
from model.DanmakuClip import DanmakuClip
|
||||
from model.VideoClip import VideoClip
|
||||
from model.Workflow import Workflow
|
||||
from workflow.worker import do_workflow
|
||||
from workflow.danmaku import get_file_start
|
||||
from workflow.video import get_video_real_duration
|
||||
from exception.danmaku import DanmakuException
|
||||
from workflow.worker import do_workflow
|
||||
|
||||
blueprint = Blueprint("api_bilirecorder", __name__, url_prefix="/api/bilirecorder")
|
||||
|
||||
@ -25,12 +26,14 @@ def auto_submit_task():
|
||||
if bili_record_workflow_item is None:
|
||||
return
|
||||
if not bili_record_workflow_item.editing:
|
||||
if len(bili_record_workflow_item.video_clips) > 0 and len(bili_record_workflow_item.danmaku_clips) > 0:
|
||||
threading.Thread(target=do_workflow, args=(
|
||||
bili_record_workflow_item.video_clips[0].full_path,
|
||||
bili_record_workflow_item.danmaku_clips[0].full_path,
|
||||
*[clip.full_path for clip in bili_record_workflow_item.danmaku_clips[1:]]
|
||||
)).start()
|
||||
if len(bili_record_workflow_item.video_clips) > 0:
|
||||
for video_clip in bili_record_workflow_item.video_clips:
|
||||
if len(video_clip.danmaku_clips) > 0:
|
||||
threading.Thread(target=do_workflow, args=(
|
||||
video_clip.full_path,
|
||||
video_clip.danmaku_clips[0].full_path,
|
||||
*[clip.full_path for clip in video_clip.danmaku_clips[1:]]
|
||||
)).start()
|
||||
clear_item()
|
||||
|
||||
|
||||
@ -98,9 +101,9 @@ def collect_danmaku_files(workflow: Optional[Workflow]):
|
||||
danmaku.file = relpath
|
||||
danmaku.base_path = BILILIVE_RECORDER_DIRECTORY
|
||||
danmaku.offset = 0
|
||||
danmaku.workflow = workflow
|
||||
danmaku.video_clip = clip
|
||||
db.session.add(danmaku)
|
||||
workflow.danmaku_clips.append(danmaku)
|
||||
clip.danmaku_clips.append(danmaku)
|
||||
if start_time_ts is None:
|
||||
if clip.duration is None or clip.duration == 0:
|
||||
clip.duration = get_video_real_duration(clip.full_path)
|
||||
@ -123,9 +126,9 @@ def collect_danmaku_files(workflow: Optional[Workflow]):
|
||||
danmaku.file = relpath
|
||||
danmaku.base_path = XIGUALIVE_RECORDER_DIRECTORY
|
||||
danmaku.offset = bias
|
||||
danmaku.workflow = workflow
|
||||
danmaku.video_clip = clip
|
||||
db.session.add(danmaku)
|
||||
workflow.danmaku_clips.append(danmaku)
|
||||
clip.danmaku_clips.append(danmaku)
|
||||
commit_item()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user