Commit Graph
3 Commits
Author SHA1 Message Date
fraujulianandClaude Fable 5.2 5193427629 feat(schedule): aim for target minutes and plan from any start time
The generator takes targets for ads and moderator talk per hour. It tries
several hundred random song picks per half hour, keeps the one that leaves
closest to the target, and lets the second half hour make up for the first.
A start between two news times gets a lead-in of music. News, ad and
moderator items start without a title.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:46 +01:00
fraujulianandClaude Opus 5.5 667501e805 feat: add song requests with hot swap
A listener request can now replace any upcoming item in the schedule,
also while the broadcast is running. The user picks a song from the
library, selects a row in the timeline and clicks "Play instead of
selected".

ScheduleGenerator.Replace puts the song at that position and rebuilds
only the rest of its half hour. Filler goes before the songs, so the
last song still ends exactly when the next news starts. Items before
the swap and all later half hours stay as they were. The filler budget
counts the ads and talk already planned earlier in that half hour, and
an ad never follows another ad.

PlaybackEngine.ReplaceUpcoming switches the running engine to the new
plan. It refuses when the item has already started, and the engine
reads each next item under a lock, so a swap cannot hit an item that
is just going on air.

The timeline marks the item on air with a play icon instead of
selecting it, so the selection is free for the swap target. A hint
next to the button says why a row cannot be replaced (news, already
played, no song chosen).

Refs #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:10:38 +01:00
fraujulianandClaude Opus 5.5 174e223186 feat: add schedule generator for news, songs and ads
ScheduleGenerator plans X full hours in half-hour slots. Each slot
starts with 5 minutes of news at :00 or :30, then random songs from
the library. Ads and moderator placeholders fill the remaining gap so
the last song of the slot ends exactly when the next news starts, and
no song is cut.

Each half hour gets 2 to 10 minutes of ads and moderator talk, which
keeps every hour within the 20 minute limit. Ads alternate with
moderator segments and are capped by a configurable MaxAdBlock, so no
ad block comes close to 20 minutes. If the library cannot fill a slot,
the generator throws a ScheduleException with a hint to add songs.

Unit tests cover every rule over several random seeds.

Refs #8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:47:49 +01:00