Skip to content

Commit

Permalink
textover编辑&字段整理 (#52)
Browse files Browse the repository at this point in the history
* textover&code clean

* update 默认值
  • Loading branch information
niehongxu116 authored Jan 8, 2025
1 parent b5e6b54 commit 90e3119
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions client/py/yidong/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum, StrEnum
from typing import Annotated, Generic, Literal, TypeVar, Union
from typing import Annotated, Generic, Literal, List, TypeVar, Union

from pydantic import BaseModel, Field

Expand Down Expand Up @@ -183,7 +183,7 @@ class VideoScriptTaskResult(BaseModel):

class BgmConfig(BaseModel):
resource_id: str = ""
volume: float = 0.0
volume: float = 1


class GlobalEditorConfig(BaseModel):
Expand All @@ -196,52 +196,53 @@ class AudioEditorConfig(BaseModel):
resource_id: str = ""
start: float = 0.0
speed: float = 1.0
volume: float = 25
volume: float = 1


class VoiceoverEditorConfig(BaseModel):
class EffectBase(BaseModel):
style: str = ""
duration: float = 0.5


class FontBase(BaseModel):
text: str = ""
font: str = ""
font_size: int = 0
font_color: str = ""
font_weight: str = ""
lang: str = ""
position_x: float | None = None
position_y: float | None = None
style: str = "0"
highlight_color: str = ""


class VoiceoverEditorConfig(FontBase):
display: bool = True
position_x: float = 0
position_y: float = 1
stroke_color: str = ""
mask_type: str = "roll_mask"
mask_color: str = "#800080"


class TextoverEditorConfig(BaseModel):
text: str = ""
font: str = ""
font_size: int = 0
font_color: str = ""
font_weight: str = ""
lang: str = ""
position: str = "bottom"
style: str = "0"
max_lines: int = 3
highlight_color: str = ""
class TextoverEditorConfig(FontBase):
rotate: float = 0.0
position_x: float = 0
position_y: float = -1
stroke_color: str = ""
mask_color: str = ""
effect_in: str = ""
effect_out: str = ""
effect_bubble: str = ""
style: str = "no_effect"
style_value: str = ""
in_effect: EffectBase = EffectBase()
on_effect: EffectBase = EffectBase()
out_effect: EffectBase = EffectBase()


class ImageEditorConfig(BaseModel):
resource_id: str = ""
start: float = 0.0
stop: float = 0.0
scale: float = 1.0
position_x: float = 1.0
position_y: float = 1.0
position_x: float = 0
position_y: float = -1
rotate: float = 0.0
animation: str = ""
in_effect: EffectBase = EffectBase()
out_effect: EffectBase = EffectBase()


class VideoEditorConfig(BaseModel):
Expand All @@ -262,8 +263,8 @@ class ChapterEditorConfig(BaseModel):
key: str = ""
audio: AudioEditorConfig = AudioEditorConfig()
voiceover: VoiceoverEditorConfig = VoiceoverEditorConfig()
textover: TextoverEditorConfig = TextoverEditorConfig()
image: ImageEditorConfig = ImageEditorConfig()
textovers: List[TextoverEditorConfig] = []
images: List[ImageEditorConfig] = []
video: VideoEditorConfig = VideoEditorConfig()
transition: TransitionEditorConfig = TransitionEditorConfig()

Expand Down

0 comments on commit 90e3119

Please sign in to comment.