mcpField
I
import-art

import-art

github.com/bitwize-music-studio创意与媒体603222 次安装2 周前更新
代码仓库

关于 import-art

import-art 是用于音乐专辑素材管理的技能,会将封面复制到音频目录和内容目录,并按配置及专辑信息确定目标路径。

主要功能

  1. 01查找专辑并解析路径
  2. 02封面复制到两个目录
  3. 03音频目录使用 album.png
  4. 04内容目录保留图片扩展名

适用场景

  1. 01为发行准备专辑封面
  2. 02将封面加入专辑文档目录

MCP 相关

该技能调用 MCP 的 find_album 查找专辑,并用 resolve_path 解析音频和内容目录。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/bitwize-music-studio/claude-ai-music-skills --skill import-art

安装后在 Claude Code 中输入/import-art确认已加载。

详细介绍

你的任务

输入:$ARGUMENTS

根据配置,将专辑封面复制到音频文件夹和专辑内容文件夹。


导入封面技能

根据配置,将专辑封面复制到两个必需的位置。

第 1 步:解析参数

预期格式:<file-path> <album-name>

示例:

  • ~/Downloads/album-art.jpg sample-album
  • ~/Downloads/cover.png sample-album

如果缺少参数,请询问:

Usage: /import-art <file-path> <album-name>

Example: /import-art ~/Downloads/album-art.jpg sample-album

第 2 步:通过 MCP 查找专辑并解析路径

  1. 调用 find_album(album_name) — 模糊匹配,返回包括流派在内的专辑元数据
  2. 调用 resolve_path("audio", album_slug) — 返回音频目录路径
  3. 调用 resolve_path("content", album_slug) — 返回内容目录路径

如果未找到专辑:

Error: Album "{album-name}" not found.
Create it first with: /new-album {album-name} <genre>

第 3 步:构造目标路径

需要两个目标位置(路径来自 MCP resolve_path 调用):

  1. 音频文件夹(用于平台/母带处理):{audio_path}/album.png
  2. 内容文件夹(用于文档):{content_path}/album-art.{ext}

重要:resolve_path 会自动包含艺人文件夹。

第 4 步:创建目录并复制文件

# Create audio directory (includes artist folder!)
mkdir -p {audio_root}/artists/{artist}/albums/{genre}/{album}

# Copy to audio folder as album.png
cp "{source_file}" "{audio_root}/artists/{artist}/albums/{genre}/{album}/album.png"

# Copy to content folder preserving extension
cp "{source_file}" "{content_root}/artists/{artist}/albums/{genre}/{album}/album-art.{ext}"

第 5 步:确认

报告:

Album art imported for: {album-name}

Copied to:
1. {audio_root}/artists/{artist}/albums/{genre}/{album}/album.png (for platforms)
2. {content_root}/artists/{artist}/albums/{genre}/{album}/album-art.{ext} (for docs)

错误处理

源文件不存在:

Error: File not found: {source_file}

配置文件缺失:

Error: Config not found at ~/.bitwize-music/config.yaml
Run /configure to set up.

未找到专辑:

Error: Album "{album-name}" not found.
Create it first with: /new-album {album-name} <genre>

不是图像文件:

Warning: File doesn't appear to be an image: {source_file}
Expected: .jpg, .jpeg, .png, .webp

Continue anyway? (y/n)

示例

/import-art ~/Downloads/sample-album-cover.jpg sample-album

配置中有:

paths:
  content_root: ~/bitwize-music
  audio_root: ~/bitwize-music/audio
artist:
  name: bitwize

找到专辑的位置:~/bitwize-music/artists/bitwize/albums/electronic/sample-album/

结果:

Album art imported for: sample-album

Copied to:
1. ~/bitwize-music/audio/artists/bitwize/albums/electronic/sample-album/album.png (for platforms)
2. ~/bitwize-music/artists/bitwize/albums/electronic/sample-album/album-art.jpg (for docs)

常见错误

❌ 不要:手动读取配置并构造路径

错误做法:

cat ~/.bitwize-music/config.yaml
cp art.png ~/music-projects/audio/sample-album/

正确做法:

# Use MCP to find album and resolve both paths
find_album(album_name) → returns album metadata
resolve_path("audio", album_slug) → audio path with artist folder
resolve_path("content", album_slug) → content path with genre

原因:resolve_path 会自动处理配置读取、艺人文件夹和流派解析。

❌ 不要:只将封面放在一个位置

错误做法:

# Only copying to audio folder
cp art.png {audio_root}/artists/{artist}/albums/{genre}/{album}/album.png
# Missing: content folder copy

正确做法:

# Copy to BOTH locations
# 1. Audio location (for streaming platforms)
cp art.png {audio_root}/artists/{artist}/albums/{genre}/{album}/album.png
# 2. Content location (for documentation)
cp art.jpg {album_path}/album-art.jpg

原因:专辑封面需要放在两个位置——音频文件夹用于发行,内容文件夹用于文档。

❌ 不要:混淆文件名

错误做法:

# Using same filename in both locations
cp art.png {audio_root}/artists/{artist}/albums/{genre}/{album}/album-art.png
cp art.png {album_path}/album.png

正确命名:

Audio location: album.png (or album.jpg)
Content location: album-art.jpg (or album-art.png)

原因:不同位置使用不同的命名约定,以免混淆。

❌ 不要:手动搜索专辑

错误做法:

find . -name "README.md" -path "*albums/$album_name*"

正确做法:

find_album(album_name) → returns album data including path and genre
❌ 不要:忘记创建目录

错误做法:

# Copying without ensuring directory exists
cp art.png {audio_root}/artists/{artist}/albums/{genre}/{album}/album.png
# Fails if directory doesn't exist

正确做法:

# Create directory first
mkdir -p {audio_root}/artists/{artist}/albums/{genre}/{album}/
cp art.png {audio_root}/artists/{artist}/albums/{genre}/{album}/album.png

原因:音频目录可能尚不存在,尤其是新专辑的目录。

评论

支持 Markdown