Minor adjustments

This commit is contained in:
gary318 2024-09-28 21:53:25 +08:00
parent 4c9ba304ce
commit 85061f9586
No known key found for this signature in database
GPG Key ID: C13F9DB85F47961A
7 changed files with 12 additions and 19 deletions

View File

@ -9,4 +9,4 @@ exclude =
pyJianYingDraft/metadata/filter_meta.py,
pyJianYingDraft/metadata/video_effect_meta.py,
pyJianYingDraft/metadata/transition_meta.py
max-line-length = 150
max-line-length = 140

View File

@ -4,13 +4,13 @@
> 欢迎为本项目补充6+版本草稿文件的解密方式
> 🧪 本项目仍在快速更新中,欢迎⭐️此项目保持关注!
# 特性清单
> 目前仅在5.9版本上进行测试
> 标注☑️的特性**已实现**,标注⬜的特性**待实现**,标注❔的特性**暂不在计划中**
> 🧪 本项目仍在快速更新中,欢迎⭐️此项目保持关注!
### 模板模式
- ☑️ [加载](#加载模板)(未加密的)`draft_content.json`文件作为模板
- ☑️ [替换音视频片段的素材](#根据名称替换素材)

View File

@ -63,7 +63,7 @@ class Draft_folder:
if not os.path.exists(template_path):
raise FileNotFoundError(f"模板草稿 {template_name} 不存在")
if os.path.exists(new_draft_path) and not allow_replace:
raise FileExistsError(f"新草稿 {new_draft_name} 已存在")
raise FileExistsError(f"新草稿 {new_draft_name} 已存在且不允许覆盖")
# 复制草稿文件夹
shutil.copytree(template_path, new_draft_path, dirs_exist_ok=allow_replace)

View File

@ -502,9 +502,11 @@ class Script_file:
ret.append(track)
if len(ret) == 0:
raise exceptions.TrackNotFound("No track satisfies the conditions: track_type=%s, name=%s, index=%s" % (track_type, name, index))
raise exceptions.TrackNotFound(
"No track satisfies the conditions: track_type=%s, name=%s, index=%s" % (track_type, name, index))
if len(ret) > 1:
raise exceptions.AmbiguousTrack("Multiple tracks satisfy the conditions: track_type=%s, name=%s, index=%s" % (track_type, name, index))
raise exceptions.AmbiguousTrack(
"Multiple tracks satisfy the conditions: track_type=%s, name=%s, index=%s" % (track_type, name, index))
return ret[0]
@ -525,7 +527,7 @@ class Script_file:
"""
# 查找素材
target_json_obj: Optional[Dict[str, Any]] = None
target_material_list = self.imported_materials["videos"] if isinstance(material, Video_material) else self.imported_materials["audios"]
target_material_list = self.imported_materials["videos" if isinstance(material, Video_material) else "audios"]
for mat in target_material_list:
if mat["material_name"] == material_name:
if target_json_obj is not None:

View File

@ -55,8 +55,6 @@ class Base_segment:
def export_json(self) -> Dict[str, Any]:
"""返回通用于各种片段的属性"""
return {
"caption_info": None,
"cartoon": False,
"enable_adjust": True,
"enable_color_correct_adjust": False,
"enable_color_curves": True,
@ -64,15 +62,8 @@ class Base_segment:
"enable_color_wheels": True,
"enable_lut": True,
"enable_smart_color_adjust": False,
"group_id": "",
"intensifies_audio": False,
"is_placeholder": False,
"is_tone_modify": False,
"last_nonzero_volume": 1.0,
"responsive_layout": {"enable": False, "horizontal_pos_layout": 0, "size_layout": 0, "vertical_pos_layout": 0, "target_follow": ""},
"reverse": False,
"template_id": "",
"template_scene": "default",
"track_attribute": 0,
"track_render_index": 0,
"visible": True,

View File

@ -310,6 +310,6 @@ class Text_segment(Base_segment):
"source_timerange": None,
"speed": 1.0,
"volume": 1.0,
"extra_material_refs": [self.extra_material_refs],
"extra_material_refs": self.extra_material_refs,
})
return ret

View File

@ -542,9 +542,9 @@ class Video_segment(Media_segment):
if round_corner is None:
round_corner = 0
width = rect_width or size * self.material_size[1] * mask_type.value.default_aspect_ratio / self.material_size[0]
self.mask = Mask(mask_type.value, center_x, center_y,
w=rect_width if rect_width else size * self.material_size[1] * mask_type.value.default_aspect_ratio / self.material_size[0],
h=size, ratio=mask_type.value.default_aspect_ratio,
w=width, h=size, ratio=mask_type.value.default_aspect_ratio,
rot=rotation, inv=invert, feather=feather/100, round_corner=round_corner/100)
self.extra_material_refs.append(self.mask.global_id)
return self