db

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VIDEO_COLLECTION = "video"
	TASK_COLLECTION  = "task"
)

Variables

This section is empty.

Functions

func CheckTaskComplete

func CheckTaskComplete(videoKey string) bool

CheckTaskComplete checks if a task has completed

func CheckTaskExist

func CheckTaskExist(videoKey string) bool

CheckTaskExist checks if a task exists in the database

func CheckTaskStart

func CheckTaskStart(videoKey string) bool

CheckTaskStart checks if a task has started

func CheckVideoExist

func CheckVideoExist(info VideoClipInfo) bool

CheckVideoExist 检查视频记录是否存在

func DeleteTask

func DeleteTask(videoKey string) error

DeleteTask deletes a task from the database

func DeleteVideoClips

func DeleteVideoClips(videoKey string) error

DeleteVideoClips 删除所有视频切片

func InsertTask

func InsertTask(videoKey string) error

InsertTask inserts a new uncompleted task into the database

func InsertVideo

func InsertVideo(info VideoClipInfo) error

InsertVideo 插入视频信息

func UnsetTaskEncodeKey

func UnsetTaskEncodeKey(videoKey string) error

UnsetTaskEncodeKey 清除任务的 EncodeKey

func UnsetVideoClipEncodeKey

func UnsetVideoClipEncodeKey(info VideoClipInfo) error

UnsetVideoClipEncodeKey 清除视频切片的编码键

func UpdateTask

func UpdateTask(filter Task, update Task) error

UpdateTask updates an uncompleted task in the database

func UpdateVideoClip

func UpdateVideoClip(filter VideoClipInfo, update VideoClipInfo) error

UpdateVideoClip 更新视频信息

Types

type Task

type Task struct {
	Key         string    `bson:"key,omitempty"`
	EncodeKey   string    `bson:"encode_key,omitempty"`
	EncodeParam string    `bson:"encode_param,omitempty"`
	Script      string    `bson:"script,omitempty"`
	CreatedAt   time.Time `bson:"created_at,omitempty"`
}

func GetTask

func GetTask(videoKey string) (Task, error)

GetTask gets a completed Task from the database

func ListTask

func ListTask() ([]Task, error)

ListTask list all tasks in the database

type VideoClipInfo

type VideoClipInfo struct {
	Key       string `bson:"key,omitempty"`
	Index     int    `bson:"index,omitempty"`
	Total     int    `bson:"total,omitempty"`
	ClipKey   string `bson:"clip_key,omitempty"`
	EncodeKey string `bson:"encode_key,omitempty"`
	TaskID    string `bson:"task_id,omitempty"`
}

func GetVideoClip

func GetVideoClip(info VideoClipInfo) (VideoClipInfo, error)

GetVideoClip 获取视频切片信息

func GetVideoClips

func GetVideoClips(videoKey string) ([]VideoClipInfo, error)

GetVideoClips 获取所有视频切片信息,按照索引排序

type VideoProgressITEM

type VideoProgressITEM struct {
	Completed bool   `json:"completed"`
	Index     int    `json:"index"`
	ClipKey   string `json:"clip_key"`
	ClipURL   string `json:"clip_url"`
	EncodeKey string `json:"encode_key"`
	EncodeURL string `json:"encode_url"`
}

func GetVideoProgress

func GetVideoProgress(videoKey string) ([]VideoProgressITEM, error)

GetVideoProgress 获取视频处理进度和每个切片的状态

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL