diff --git a/.flake8 b/.flake8 index 35ef567..68a9ec7 100644 --- a/.flake8 +++ b/.flake8 @@ -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 diff --git a/README.md b/README.md index 5fbc6a7..68cd09e 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ > ℹ 欢迎为本项目补充6+版本草稿文件的解密方式 +> 🧪 本项目仍在快速更新中,欢迎⭐️此项目保持关注! + # 特性清单 > ℹ 目前仅在5.9版本上进行测试 > 标注☑️的特性**已实现**,标注⬜的特性**待实现**,标注❔的特性**暂不在计划中** -> 🧪 本项目仍在快速更新中,欢迎⭐️此项目保持关注! - ### 模板模式 - ☑️ [加载](#加载模板)(未加密的)`draft_content.json`文件作为模板 - ☑️ [替换音视频片段的素材](#根据名称替换素材) diff --git a/pyJianYingDraft/draft_folder.py b/pyJianYingDraft/draft_folder.py index 32fb6bd..a0a2e01 100644 --- a/pyJianYingDraft/draft_folder.py +++ b/pyJianYingDraft/draft_folder.py @@ -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) diff --git a/pyJianYingDraft/script_file.py b/pyJianYingDraft/script_file.py index 70e91e0..9c8af7a 100644 --- a/pyJianYingDraft/script_file.py +++ b/pyJianYingDraft/script_file.py @@ -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: diff --git a/pyJianYingDraft/segment.py b/pyJianYingDraft/segment.py index d27da2e..9811c80 100644 --- a/pyJianYingDraft/segment.py +++ b/pyJianYingDraft/segment.py @@ -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, diff --git a/pyJianYingDraft/text_segment.py b/pyJianYingDraft/text_segment.py index 20477c7..becae0f 100644 --- a/pyJianYingDraft/text_segment.py +++ b/pyJianYingDraft/text_segment.py @@ -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 diff --git a/pyJianYingDraft/video_segment.py b/pyJianYingDraft/video_segment.py index 6c01ba1..ed142cd 100644 --- a/pyJianYingDraft/video_segment.py +++ b/pyJianYingDraft/video_segment.py @@ -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