Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: a lyric line held across a shot split is shown on both pieces (#8977)

[._.]/ Adam Eivyd32a62caa143
diff --git a/server/routes/musicVideoSceneSplit.test.js b/server/routes/musicVideoSceneSplit.test.js
index 0c7117482a..ef7490eb05 100644
--- a/server/routes/musicVideoSceneSplit.test.js
+++ b/server/routes/musicVideoSceneSplit.test.js
@@ -91,6 +91,13 @@ describe('POST /:id/scenes/:sceneId/split', () => {
expect(pieces.at(-1).endSec).toBe(55);
});
+ it('gives a sung line held across an unavoidable cut to both pieces', async () => {
+ await projects.updateProject(project.id, { lyricCues: [{ text: 'held note', startSec: 30, endSec: 50 }] });
+ const shot = await projects.addProjectScene(project.id, { startSec: 30, endSec: 50 });
+ const res = await split(shot.sceneId, { backend: 'grok' });
+ expect(res.body.scenes.map((p) => [p.startSec, p.endSec, p.lyricText])).toEqual([[30, 40, 'held note'], [40, 50, 'held note']]);
+ });
+
it('refuses a shot that fits one take, a lane with no per-take limit, a bad backend and an unknown scene', async () => {
const fits = await projects.addProjectScene(project.id, { startSec: 30, endSec: 40, shotMode: 'performance' });
expect((await split(fits.sceneId)).body.code).toBe('MUSIC_VIDEO_SPLIT_NOT_NEEDED');
diff --git a/server/services/musicVideo/projectsLogic.js b/server/services/musicVideo/projectsLogic.js
index 50fbc42154..e4d026c29f 100644
--- a/server/services/musicVideo/projectsLogic.js
+++ b/server/services/musicVideo/projectsLogic.js
@@ -445,10 +445,18 @@ export function reorderScenes(project, orderedIds) {
// Label suffix budget: the scene label schema caps at 120 characters.
const SCENE_LABEL_MAX = 120;
-/** The timed lyric lines sung inside `[startSec, endSec]`, joined, or null. */
+/**
+ * The timed lyric lines sung during `[startSec, endSec]`, joined, or null. A
+ * line held across a cut belongs to both pieces.
+ */
function lyricTextWithin(cues, startSec, endSec) {
const lines = (Array.isArray(cues) ? cues : [])
- .filter((cue) => typeof cue?.startSec === 'number' && cue.startSec >= startSec - 1e-6 && cue.startSec < endSec - 1e-6)
+ .filter((cue) => {
+ if (typeof cue?.startSec !== 'number') return false;
+ const cueEnd = typeof cue.endSec === 'number' ? cue.endSec : cue.startSec;
+ // Starts before the piece ends, and is still sounding (or starts) inside it.
+ return cue.startSec < endSec - 1e-6 && (cueEnd > startSec + 1e-6 || cue.startSec >= startSec - 1e-6);
+ })
.map((cue) => (typeof cue.text === 'string' ? cue.text.trim() : ''))
.filter(Boolean);
return lines.length ? lines.join(' / ').slice(0, 2000) : null;