mirror of
https://github.com/sun-guannan/CapCutAPI.git
synced 2025-11-25 03:15:00 +08:00
add 001-words
This commit is contained in:
@@ -246,6 +246,9 @@ mcp_client.call_tool("add_text", {
|
|||||||
|
|
||||||
调用 `save_draft` 会在`capcut_server.py`当前目录下生成一个 `dfd_` 开头的文件夹,将其复制到剪映/CapCut 草稿目录,即可在应用中看到生成的草稿。
|
调用 `save_draft` 会在`capcut_server.py`当前目录下生成一个 `dfd_` 开头的文件夹,将其复制到剪映/CapCut 草稿目录,即可在应用中看到生成的草稿。
|
||||||
|
|
||||||
|
## 模版
|
||||||
|
我们汇总了一些模版,放在`pattern`文件夹下。
|
||||||
|
|
||||||
## 社区与支持
|
## 社区与支持
|
||||||
|
|
||||||
我们欢迎各种形式的贡献!我们的迭代规则:
|
我们欢迎各种形式的贡献!我们的迭代规则:
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ response = requests.post("http://localhost:9001/add_text", json={
|
|||||||
"text": "Welcome to CapCutAPI",
|
"text": "Welcome to CapCutAPI",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"end": 5,
|
"end": 5,
|
||||||
"font": "Source Han Sans",
|
"font": "Source Han Sans",read
|
||||||
"font_color": "#FFD700",
|
"font_color": "#FFD700",
|
||||||
"font_size": 48,
|
"font_size": 48,
|
||||||
"shadow_enabled": True,
|
"shadow_enabled": True,
|
||||||
@@ -243,6 +243,10 @@ mcp_client.call_tool("add_text", {
|
|||||||
|
|
||||||
Calling `save_draft` will generate a folder starting with `dfd_` in the current directory of `capcut_server.py`. Copy this to the CapCut/Jianying drafts directory to see the generated draft in the application.
|
Calling `save_draft` will generate a folder starting with `dfd_` in the current directory of `capcut_server.py`. Copy this to the CapCut/Jianying drafts directory to see the generated draft in the application.
|
||||||
|
|
||||||
|
## Pattern
|
||||||
|
|
||||||
|
You can find a lot of pattern in the `pattern` directory.
|
||||||
|
|
||||||
## Community & Support
|
## Community & Support
|
||||||
|
|
||||||
We welcome contributions of all forms\! Our iteration rules are:
|
We welcome contributions of all forms\! Our iteration rules are:
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ def add_text_impl(text, start, end, font, font_color, font_size, track_name, dra
|
|||||||
|
|
||||||
return make_request("add_text", data)
|
return make_request("add_text", data)
|
||||||
|
|
||||||
def add_image_impl(image_url, width, height, start, end, track_name, draft_id=None,
|
def add_image_impl(image_url, start, end, width=None, height=None, track_name="image_main", draft_id=None,
|
||||||
transform_x=0, transform_y=0, scale_x=1.0, scale_y=1.0, transition=None, transition_duration=None,
|
transform_x=0, transform_y=0, scale_x=1.0, scale_y=1.0, transition=None, transition_duration=None,
|
||||||
mask_type=None, mask_center_x=0.0, mask_center_y=0.0, mask_size=0.5,
|
mask_type=None, mask_center_x=0.0, mask_center_y=0.0, mask_size=0.5,
|
||||||
mask_rotation=0.0, mask_feather=0.0, mask_invert=False,
|
mask_rotation=0.0, mask_feather=0.0, mask_invert=False,
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
sys.path.append('/Users/sunguannan/capcutapi')
|
||||||
|
from example import add_image_impl
|
||||||
|
|
||||||
PORT=9001 #端口
|
PORT=9001 #端口
|
||||||
BASE_URL = f"http://localhost:{PORT}"
|
BASE_URL = f"http://localhost:{PORT}"
|
||||||
draft_folder = "/Users/sunguannan/Movies/JianyingPro/User Data/Projects/com.lveditor.draft"
|
draft_folder = "/Users/sunguannan/Movies/JianyingPro/User Data/Projects/com.lveditor.draft"
|
||||||
@@ -440,73 +443,73 @@ def build_segments_by_mode(
|
|||||||
return segments
|
return segments
|
||||||
|
|
||||||
corrected_srt = [{
|
corrected_srt = [{
|
||||||
"word": "你",
|
"word": "Hello",
|
||||||
"start": 0.0,
|
"start": 0.0,
|
||||||
"end": 0.64,
|
"end": 0.64,
|
||||||
"confidence": 0.93917525
|
"confidence": 0.93917525
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "好",
|
"word": "I'm",
|
||||||
"start": 0.64,
|
"start": 0.64,
|
||||||
"end": 0.79999995,
|
"end": 0.79999995,
|
||||||
"confidence": 0.9976464
|
"confidence": 0.9976464
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "我",
|
"word": "PAWA",
|
||||||
"start": 0.79999995,
|
"start": 0.79999995,
|
||||||
"end": 1.36,
|
"end": 1.36,
|
||||||
"confidence": 0.6848311
|
"confidence": 0.6848311
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "是",
|
"word": "Nice",
|
||||||
"start": 1.36,
|
"start": 1.36,
|
||||||
"end": 1.52,
|
"end": 1.52,
|
||||||
"confidence": 0.9850389
|
"confidence": 0.9850389
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "PAWA",
|
"word": "To",
|
||||||
"start": 1.52,
|
"start": 1.52,
|
||||||
"end": 1.68,
|
"end": 1.68,
|
||||||
"confidence": 0.9926886
|
"confidence": 0.9926886
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "很",
|
"word": "Meet",
|
||||||
"start": 1.68,
|
"start": 1.68,
|
||||||
"end": 2.08,
|
"end": 2.08,
|
||||||
"confidence": 0.9972697
|
"confidence": 0.9972697
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "高",
|
"word": "You",
|
||||||
"start": 2.08,
|
"start": 2.08,
|
||||||
"end": 2.72,
|
"end": 2.72,
|
||||||
"confidence": 0.9845563
|
"confidence": 0.9845563
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "兴",
|
"word": "Enjoy",
|
||||||
"start": 2.72,
|
"start": 2.72,
|
||||||
"end": 3.04,
|
"end": 3.04,
|
||||||
"confidence": 0.99794894
|
"confidence": 0.99794894
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "认",
|
"word": "My",
|
||||||
"start": 3.04,
|
"start": 3.04,
|
||||||
"end": 3.1999998,
|
"end": 3.1999998,
|
||||||
"confidence": 0.9970203
|
"confidence": 0.9970203
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "识",
|
"word": "Parttern",
|
||||||
"start": 3.1999998,
|
"start": 3.1999998,
|
||||||
"end": 3.36,
|
"end": 3.36,
|
||||||
"confidence": 0.9970235
|
"confidence": 0.9970235
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "大",
|
"word": "Thank",
|
||||||
"start": 3.36,
|
"start": 3.36,
|
||||||
"end": 3.6799998,
|
"end": 3.6799998,
|
||||||
"confidence": 0.98627764
|
"confidence": 0.98627764
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"word": "家",
|
"word": "You",
|
||||||
"start": 3.6799998,
|
"start": 3.6799998,
|
||||||
"end": 4.0,
|
"end": 4.0,
|
||||||
"confidence": 0.9939551
|
"confidence": 0.9939551
|
||||||
@@ -606,6 +609,8 @@ draft_id = add_koubo_from_srt(
|
|||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_image_impl(image_url="https://pic1.imgdb.cn/item/689aff2758cb8da5c81e64a2.png", start = 0, end = 4, draft_id=draft_id)
|
||||||
|
|
||||||
save_result = save_draft_impl(draft_id, draft_folder)
|
save_result = save_draft_impl(draft_id, draft_folder)
|
||||||
|
|
||||||
print(save_result)
|
print(save_result)
|
||||||
|
|||||||
Reference in New Issue
Block a user