mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Why
Commercial producers (Vocal Star first) care a lot about their CD+G
output, but the tenant theme editor only covered the MP4 title card /
lyrics / end screen. CD+G styling needed an admin to hand-edit the theme
JSON.
## What
**New "CD+G" tab** (only on portals with `features.enable_cdg` and a
`cdg` theme section):
- **Up card**: image, title/artist colours, title/artist sizes,
separator text between them (e.g. "MADE FAMOUS BY") + its colour, text
position from top (keeps text below a logo baked into the image),
title–artist gap.
- **Lyrics**: sung / unsung / screen / border colours, size, outline
width + colour, lyrics font ("Same as main font" or a distinct one, e.g.
condensed Oswald).
- **Instrumental breaks**: image, text, colour. **Closing screen**:
image, line colours.
**Real previews**: on the CD+G tab the preview request sets
`include_cdg`; the backend composes a short CDG with the real
`CDGGenerator` from the draft's `cdg` section and renders the up card +
a part-sung lyrics page with the new `karaoke_gen/.../cdg_decoder.py`
(single pass, multi-frame; moved out of the CDG test). 300×216 upscaled
3× with hard pixels, ~1 s. Other tabs never pay for it.
**Images**: uploads from the CD+G tab are fitted (letterboxed) to
300×216 PNG (`purpose=cdg`); the CD+G dropdowns only offer 300×216
images (`cdg_images` from the editor GET, header-only reads);
save/preview reject other sizes since the CDG renderer never resizes.
All 4 existing themes' CD+G images verified 300×216.
**Validation**: `cdg` hex colours, numeric bounds, single-line text
limits; distinct CDG font resolved for the preview the same way renders
do (`cdg_font` asset), title/outro use the main font.
## Tests
- Backend: CDG validation/fit/size-check/upload/editor list
(tenant_theme_service), real CD+G preview renders incl. colour change +
distinct font + missing asset + timeout (theme_preview_service), route
include_cdg + upload purpose. CDG title-card tests now use the shared
decoder.
- Frontend: new `TenantThemeEditorCdg.test.tsx` (10): tab gating,
includeCdg only on that tab, edits map to `cdg`, outline applies to both
strokes, font follow/distinct, fitted upload, CD+G-sized image list,
pixelated 300/216 previews. Full jest 1716 pass.
- Backend suite: all pass except `test_emulator_integration.py`, which
fails identically on main locally (a stray local Firestore emulator
enables it); CI runs emulator tests separately.
- 32 locales translated. CodeRabbit: 2 minor findings fixed.
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Gp5fBmsmWJxgkEHb4JfhXR
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>