Add an Openverse page that searches free audio through the anonymous
Openverse API, previews a result by streaming its URL with MediaPlayer
and imports it into the library.
OpenverseClient uses HttpClient with a timeout and a generic User-Agent.
It downloads only the result's https URL, limits files to 50 MB, never
overwrites an existing file and deletes partial files on failure.
Timeouts, HTTP 429 and other errors become readable messages. Imported
songs get Source = Openverse plus license and attribution from the API.
Results without a duration cannot be imported, because songs need one.
Refs #5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add MusicPlayer, a thread-safe lazy singleton that plays one audio
file at a time through NAudio 3.3.0 (WaveOut and AudioFileReader).
It offers Play, Pause, Resume, Stop, Position, Duration, Volume and
IsPlaying, plus TrackFinished and PositionChanged events. The station
needs one shared playback point that later schedule and UI code can
drive.
TrackFinished fires only when a track ends on its own. Stop and Play
unsubscribe from the old output before releasing it, so they never
raise it. Both events run on a thread-pool thread, so WPF callers
must marshal to the dispatcher. Reader and output are disposed on
stop, on replacement and on process exit. A missing file throws
FileNotFoundException and an unreadable one InvalidDataException;
in both cases the player stays stopped.
Tests cover the singleton, error cases and events. Tests that need an
audio device skip when none is present.
Refs #6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Library page reachable from the navigation. It lists all songs
from the SQLite database, filters them by title or artist, edits title,
artist, license and attribution in a dialog, and deletes a song after a
confirmation prompt. File path, duration and source stay read-only.
LibraryController wraps SongRepository so the view only forwards user
actions. Changes are written to the database immediately, and the list
reloads every time the page is shown.
Refs #3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add AdSpot and ModeratorSegment models with Title and Duration and a
read-only in-memory seed list for each in PlaceholderContent. Ads and
moderator talk are placeholders without audio, so no database table is
needed. Lengths vary (ads 30 s to 2 min, moderator 30 s to 3 min) so the
schedule generator can size these segments to end songs exactly before
the news. Tests check the lists are non-empty with titles and positive
durations.
Refs #7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Store the music library in SQLite through Microsoft.Data.Sqlite.
SongRepository creates the database file and the Songs table if they
are missing and offers GetAll, GetById, Add, Update and Delete with
parameterized queries. The app opens the database on startup at
%LOCALAPPDATA%\Radiosender\radiosender.db.
Add an xUnit test project that covers CRUD, persistence across
instances, SQL characters in values and the duration check.
Refs #2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>