commit 31d3e5499638781f95f996e71aac813b51f8acfb
parent 2b7b0c7c8ddfde64a2d15c0178be6b128523a3da
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 28 Oct 2026 09:40:57 -0400
umtool: swap-clip gives the new clip its own source date, not the replaced note's
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/umtool/song/swap-clip.mjs b/umtool/song/swap-clip.mjs
@@ -267,7 +267,15 @@ if (!best) throw new Error("no replacement found");
const { c, midi, dur, shift } = best;
console.log(` -> ${c.video}@${c.start} midi ${midi.toFixed(2)} dur ${dur.toFixed(3)}s` +
` shift ${(note.targetMidi - midi).toFixed(2)} (was ${note.srcDur}s)`);
-v.plan[idx] = { ...note,
+// The note's `date` is its SOURCE's upload date (arrange-poly orders the song by it); spreading
+// the old note kept the replaced clip's date on the new one -- mk-plan-fatal5's 8 swaps all
+// carried dates of videos they no longer play.
+const dates = JSON.parse(readFileSync(path.join(DIR, "dates.json"), "utf8"));
+const date = dates[c.video];
+if (!date) console.log(` WARNING: ${c.video} has no entry in dates.json; the note keeps no date`);
+else if (note.date && date !== note.date) console.log(` date ${note.date} -> ${date} (the slot's place in the chronology moves)`);
+const { date: _oldDate, ...rest } = note;
+v.plan[idx] = { ...rest, ...(date ? { date } : {}),
video: c.video, srcStart: c.start, srcEnd: c.end, srcDur: +dur.toFixed(3),
srcF0: best.f0 ?? c.f0, srcMidi: +midi.toFixed(2), shift: +(note.targetMidi - midi).toFixed(3),
spreadCents: c.spreadCents, noTrim: !!c.noTrim, keepSide: 0, headOffset: 0 };