ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 narze

bad-apple

一個 Claude Code 外掛,在提示列資訊帶或側邊 pane 播放帶同步聲音的 Bad Apple!! 剪影藝術影片,並透過 function hooks 將影格繪成象限字元。

已翻譯

關於這個 mod

bad-apple-claude-mod 是以 function hooks 打包成 plugin 的 Claude Code Mod。它會在 Claude Code 裡播放 Bad Apple!! 剪影藝術 PV,可放在提示列上方的資訊帶或側邊 pane,歌曲會和畫面保持同步。影格會繪製成象限字元格(▘▀▌▙█),192x144 的來源影格最多縮放到 96x36 個字元格,並透過 $.ui.blit 約每秒重繪 60 次。選用的灰階模式會替每個字元格近似 32 個層級中的兩個,以處理反鋸齒。指令包括 /bad-apple、pane、pause、resume、restart、gray 和 stop,狀態列有畫面按鈕與時間/進度列。音訊使用 afplay(僅限 macOS)。影片與歌曲資產不隨附,必須在本機用 ffmpeg、python3 和 yt-dlp,透過 scripts/download-video.sh 與 scripts/build-assets.sh 建立,再用 claude --plugin-dir 載入。程式碼採 MIT License;媒體不在該授權涵蓋範圍內。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add narze/bad-apple-claude-mod
claude plugin install bad-apple
原文 / README

bad-apple-claude-mod

Plays Bad Apple!! inside Claude Code, as a mod (a plugin of function hooks). The video plays in the band above the prompt, or in a side pane, with the song in sync.

  • Quadrant cells: each cell is a solid quadrant glyph (▘▀▌▙█…) over 2x2 quarters, drawn as one Raster. Black and white by default; with gray on, each cell takes two of 32 gray levels, the best two-tone fit to how much of each quarter is lit, so edges are antialiased
  • 192x144 frames into at most 96x36 cells; smaller sites average bigger pixel blocks, never upscale
  • About 60 repaints a second with $.ui.blit, frame picked from the wall clock so video stays in sync with the song
  • Pause and resume, also for the song (the mod cuts the constant-bitrate MP3 at the right byte)
  • Time and a progress bar beside the video, and in the status line

Use

| Command | What it does | | --- | --- | | /bad-apple | Play in the band above the prompt (default) | | /bad-apple pane | Play in a pane (Esc closes it) | | /bad-apple pause / resume | Pause or resume | | /bad-apple restart | Play again from 0:00, in the same place | | /bad-apple gray | Turn grayscale antialiasing on or off (off by default; remembered across sessions) | | /bad-apple stop | Stop |

The band has Pause/Resume (p), Restart (r), Gray (g) and Stop (s) buttons; the pane has all but Stop (Esc closes it).

Sound plays through afplay, so only on macOS. Other systems get the video only.

Install

The video frames and the song are not in this repo. Build them on your machine. You need ffmpeg, python3, and yt-dlp (or uvx, which runs the latest yt-dlp).

git clone https://github.com/narze/bad-apple-claude-mod
cd bad-apple-claude-mod
./scripts/download-video.sh   # yt-dlp: YouTube -> work/bad-apple.webm
./scripts/build-assets.sh     # work file -> assets/
claude --plugin-dir "$PWD"

Scripts

| Script | What it does | | --- | --- | | scripts/download-video.sh [url] [--force] | Downloads the PV from YouTube with yt-dlp (480p or less) to the working file work/bad-apple.<ext>. Skips the download when the file is there; --force downloads again. Default URL: https://www.youtube.com/watch?v=FtutLA63Cp8 | | scripts/build-assets.sh [url] [--force] | Runs download-video.sh (same arguments), then makes 192x144 1-bit frames at 30 fps in assets/frames-*.bin and a 96 kbit/s mono MP3 in assets/bad-apple.mp3 |

If YouTube refuses the download (HTTP Error 403), update yt-dlp, or install uv so the script uses uvx yt-dlp@latest. work/ and assets/ are git-ignored.

Develop

claude plugin validate .
claude plugin test .
npx -p typescript tsc -p .   # after Claude Code has loaded the mod once (it writes .claude-plugin/types/)

| File | Role | | --- | --- | | hooks/register.tsx | Command, player, band and pane drawing | | hooks/frames.ts | Pure helpers: grid fit, frame encoding, MP3 offset | | hooks/bad-apple.test.ts | Tests (claude plugin test) | | types/index.d.ts | $.state contract (mode, isPaused, isMono) | | scripts/download-video.sh | Downloads the working video file to work/ | | scripts/build-assets.sh | Builds assets/ from the working file |

Credits

Bad Apple!! is a song from Touhou Project by ZUN, arranged by Alstroemeria Records, with the shadow-art PV by Anira. This repo has no part of the video or the song.

License

The code is MIT. The MIT license does not cover the video or the song.

更多類似作品