Skip to content

Commit 90e3119

Browse files
authored
textover编辑&字段整理 (#52)
* textover&code clean * update 默认值
1 parent b5e6b54 commit 90e3119

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

client/py/yidong/model.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from enum import Enum, StrEnum
2-
from typing import Annotated, Generic, Literal, TypeVar, Union
2+
from typing import Annotated, Generic, Literal, List, TypeVar, Union
33

44
from pydantic import BaseModel, Field
55

@@ -183,7 +183,7 @@ class VideoScriptTaskResult(BaseModel):
183183

184184
class BgmConfig(BaseModel):
185185
resource_id: str = ""
186-
volume: float = 0.0
186+
volume: float = 1
187187

188188

189189
class GlobalEditorConfig(BaseModel):
@@ -196,52 +196,53 @@ class AudioEditorConfig(BaseModel):
196196
resource_id: str = ""
197197
start: float = 0.0
198198
speed: float = 1.0
199-
volume: float = 25
199+
volume: float = 1
200200

201201

202-
class VoiceoverEditorConfig(BaseModel):
202+
class EffectBase(BaseModel):
203+
style: str = ""
204+
duration: float = 0.5
205+
206+
207+
class FontBase(BaseModel):
203208
text: str = ""
204209
font: str = ""
205210
font_size: int = 0
206211
font_color: str = ""
207212
font_weight: str = ""
208-
lang: str = ""
209-
position_x: float | None = None
210-
position_y: float | None = None
211-
style: str = "0"
212-
highlight_color: str = ""
213+
214+
215+
class VoiceoverEditorConfig(FontBase):
216+
display: bool = True
217+
position_x: float = 0
218+
position_y: float = 1
213219
stroke_color: str = ""
214220
mask_type: str = "roll_mask"
215221
mask_color: str = "#800080"
216222

217223

218-
class TextoverEditorConfig(BaseModel):
219-
text: str = ""
220-
font: str = ""
221-
font_size: int = 0
222-
font_color: str = ""
223-
font_weight: str = ""
224-
lang: str = ""
225-
position: str = "bottom"
226-
style: str = "0"
227-
max_lines: int = 3
228-
highlight_color: str = ""
224+
class TextoverEditorConfig(FontBase):
225+
rotate: float = 0.0
226+
position_x: float = 0
227+
position_y: float = -1
229228
stroke_color: str = ""
230-
mask_color: str = ""
231-
effect_in: str = ""
232-
effect_out: str = ""
233-
effect_bubble: str = ""
229+
style: str = "no_effect"
230+
style_value: str = ""
231+
in_effect: EffectBase = EffectBase()
232+
on_effect: EffectBase = EffectBase()
233+
out_effect: EffectBase = EffectBase()
234234

235235

236236
class ImageEditorConfig(BaseModel):
237237
resource_id: str = ""
238238
start: float = 0.0
239239
stop: float = 0.0
240240
scale: float = 1.0
241-
position_x: float = 1.0
242-
position_y: float = 1.0
241+
position_x: float = 0
242+
position_y: float = -1
243243
rotate: float = 0.0
244-
animation: str = ""
244+
in_effect: EffectBase = EffectBase()
245+
out_effect: EffectBase = EffectBase()
245246

246247

247248
class VideoEditorConfig(BaseModel):
@@ -262,8 +263,8 @@ class ChapterEditorConfig(BaseModel):
262263
key: str = ""
263264
audio: AudioEditorConfig = AudioEditorConfig()
264265
voiceover: VoiceoverEditorConfig = VoiceoverEditorConfig()
265-
textover: TextoverEditorConfig = TextoverEditorConfig()
266-
image: ImageEditorConfig = ImageEditorConfig()
266+
textovers: List[TextoverEditorConfig] = []
267+
images: List[ImageEditorConfig] = []
267268
video: VideoEditorConfig = VideoEditorConfig()
268269
transition: TransitionEditorConfig = TransitionEditorConfig()
269270

0 commit comments

Comments
 (0)