From 793eb7a4fe3e8504888af5da4d2e327277ce1186 Mon Sep 17 00:00:00 2001 From: Li Jian <4362378@qq.com> Date: Sat, 19 Jul 2025 22:56:48 +0800 Subject: [PATCH] Initial commit: WB ComfyUI Utils - Audio Duration Node --- .gitignore | 50 +++++++++++++---- LICENSE | 21 ++++++++ PUBLISH_GUIDE.md | 136 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 55 +++++++++++++++++-- __init__.py | 4 +- package.json | 26 +++++++++ 6 files changed, 278 insertions(+), 14 deletions(-) create mode 100644 LICENSE create mode 100644 PUBLISH_GUIDE.md create mode 100644 package.json diff --git a/.gitignore b/.gitignore index d6df3b5..c69f0f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,40 @@ -__pycache__ -*.pyc -*.pyo -*.pyd -*.pyw -*.pyz -*.pywz -*.pyzw -*.pyzwz -*.pyzwzw \ No newline at end of file +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyTorch +*.pth +*.pt + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# ComfyUI +output/ +temp/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4615c1c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 webuilder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/PUBLISH_GUIDE.md b/PUBLISH_GUIDE.md new file mode 100644 index 0000000..c8d370a --- /dev/null +++ b/PUBLISH_GUIDE.md @@ -0,0 +1,136 @@ +# 发布指南 + +## 发布到Node Manager的步骤 + +### 1. 准备GitHub仓库 + +1. 在GitHub上创建新仓库 ✅ 已完成 +2. 仓库名: `WB-ComfyUI-Utils` ✅ 已完成 +3. 设置为公开仓库 ✅ 已完成 + +### 2. 上传代码 + +```bash +# 初始化Git仓库 +git init + +# 添加所有文件 +git add . + +# 提交更改 +git commit -m "Initial commit: WB ComfyUI Utils - Audio Duration Node" + +# 添加远程仓库 +git remote add origin https://github.com/webuilder/WB-ComfyUI-Utils.git + +# 推送到GitHub +git push -u origin main +``` + +### 3. 更新package.json + +编辑 `package.json` 文件,更新以下信息: + +```json +{ + "name": "wb-comfyui-utils", + "version": "1.0.0", + "description": "A collection of useful ComfyUI utility nodes including audio duration, text processing, and more", + "author": "webuilder", + "repository": { + "type": "git", + "url": "https://github.com/webuilder/WB-ComfyUI-Utils" + }, + "keywords": [ + "comfyui", + "utils", + "audio", + "duration", + "text", + "processing", + "nodes" + ], + "license": "MIT", + "dependencies": [], + "comfyui": { + "nodes": [ + "WB_AudioDuration" + ] + } +} +``` + +### 4. 更新README.md + +编辑 `README.md` 文件,更新: +- 作者信息 ✅ 已完成 +- GitHub仓库链接 ✅ 已完成 +- 问题反馈链接 ✅ 已完成 + +### 5. 更新LICENSE + +编辑 `LICENSE` 文件,更新版权信息: +``` +Copyright (c) 2024 webuilder +``` +✅ 已完成 + +### 6. 测试节点 + +在发布前,确保节点在ComfyUI中正常工作: +1. 将代码复制到ComfyUI的custom_nodes目录 +2. 重启ComfyUI +3. 测试节点功能 + +### 7. 创建Release + +1. 在GitHub仓库页面点击 "Releases" +2. 点击 "Create a new release" +3. 填写版本信息: + - Tag: v1.0.0 + - Title: WB ComfyUI Utils v1.0.0 + - Description: 描述工具集功能 +4. 发布Release + +### 8. 等待Node Manager收录 + +Node Manager会自动扫描GitHub上的ComfyUI节点仓库。通常需要几天时间才会出现在搜索结果中。 + +### 9. 验证发布 + +1. 在ComfyUI中打开Node Manager +2. 搜索 "WB Utils" 或 "WB Audio Duration" +3. 确认节点可以正常安装 + +## 注意事项 + +1. **仓库必须是公开的** ✅ 已完成 +2. **必须包含package.json文件** ✅ 已完成 +3. **package.json中的comfyui.nodes字段必须正确** ✅ 已完成 +4. **README.md应该包含详细的安装和使用说明** ✅ 已完成 +5. **代码应该经过充分测试** + +## 常见问题 + +### Q: 节点没有出现在Node Manager中? +A: 检查以下几点: +- 仓库是否为公开 ✅ 已完成 +- package.json格式是否正确 ✅ 已完成 +- 是否创建了Release + +### Q: 安装后节点不工作? +A: 检查以下几点: +- __init__.py文件是否正确 ✅ 已完成 +- 节点注册是否正确 ✅ 已完成 +- 依赖是否满足 ✅ 已完成 + +### Q: 如何更新节点? +A: 创建新的Release,更新版本号。 + +### Q: 如何添加新节点到工具集? +A: +1. 在__init__.py中添加新节点类 +2. 在NODE_CLASS_MAPPINGS中注册新节点 +3. 在package.json的comfyui.nodes数组中添加新节点名 +4. 更新README.md文档 +5. 创建新的Release \ No newline at end of file diff --git a/README.md b/README.md index 8278bee..c2d7743 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,40 @@ -# ComfyUI WB Audio Duration Node +# ComfyUI WB Utils -一个简单的ComfyUI自定义节点,用于获取音频文件的时长。 +一个ComfyUI实用工具节点集合,包含音频处理、文本处理等实用功能。 ## 功能 +### 当前节点 + +#### WB Audio Duration - 支持1D, 2D, 3D音频张量格式 - 支持 `waveform` 和 `audio` 键格式 - 提供详细的调试信息 - 格式化时长显示(秒、分、小时) +### 计划中的节点 + +- 文本处理节点 +- 图像处理节点 +- 数据转换节点 +- 更多实用工具... + ## 安装 +### 方法1: 通过Node Manager (推荐) +1. 在ComfyUI中打开Node Manager +2. 搜索 "WB Utils" 或 "WB Audio Duration" +3. 点击安装 + +### 方法2: 手动安装 1. 将此文件夹复制到ComfyUI的 `custom_nodes` 目录 2. 重启ComfyUI 3. 在节点列表中找到 "WB Audio Duration" ## 使用方法 +### WB Audio Duration 节点 + 1. 添加 "Load Audio" 节点加载音频文件 2. 添加 "WB Audio Duration" 节点 3. 连接音频输出到时长节点 @@ -24,11 +42,13 @@ ## 输出 +### WB Audio Duration - `duration_seconds`: 时长(秒,浮点数) - `duration_text`: 格式化的时长文本 ## 支持格式 +### WB Audio Duration - 1D张量: `[samples]` - 2D张量: `[channels, samples]` 或 `[batch, samples]` - 3D张量: `[batch, channels, samples]` @@ -39,4 +59,33 @@ - 音频输入类型 - 音频字典键 - 音频数据形状 -- 计算过程 \ No newline at end of file +- 计算过程 + +## 示例 + +```python +# WB Audio Duration 输入音频字典格式 +{ + 'waveform': torch.tensor([...]), # 音频数据 + 'sample_rate': 22050 # 采样率 +} + +# 输出 +(19.59, '19.59秒') # (时长秒数, 格式化文本) +``` + +## 许可证 + +MIT License + +## 作者 + +webuilder + +## 问题反馈 + +如果您遇到任何问题,请在 [GitHub Issues](https://github.com/webuilder/WB-ComfyUI-Utils/issues) 上提交Issue。 + +## 贡献 + +欢迎提交Pull Request来添加新的实用节点! \ No newline at end of file diff --git a/__init__.py b/__init__.py index 80ec3d4..efb770c 100644 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,6 @@ -# ComfyUI Audio Duration Node Package +# ComfyUI WB Audio Duration Node +# Author: Your Name +# Description: A simple node to get audio duration from audio input # 直接定义节点类,避免导入问题 import os diff --git a/package.json b/package.json new file mode 100644 index 0000000..fdfe008 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "wb-comfyui-utils", + "version": "1.0.0", + "description": "A collection of useful ComfyUI utility nodes including audio duration, text processing, and more", + "author": "webuilder", + "repository": { + "type": "git", + "url": "https://github.com/webuilder/WB-ComfyUI-Utils" + }, + "keywords": [ + "comfyui", + "utils", + "audio", + "duration", + "text", + "processing", + "nodes" + ], + "license": "MIT", + "dependencies": [], + "comfyui": { + "nodes": [ + "WB_AudioDuration" + ] + } +} \ No newline at end of file