Commit Graph
46 Commits
Author SHA1 Message Date
fraujulianandClaude Opus 5.5 e798ce2e33 feat(schedule): add drag adorner for timeline reordering
Shows a label with type and title at the cursor and a line where the
row lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:21:04 +01:00
fraujulianandClaude Opus 5.5 7621c8c2a4 feat(import): add per-provider search result
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:21:03 +01:00
fraujulianandClaude Opus 5.5 87b73df9bc feat(import): add license types for the search filter
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:21:03 +01:00
fraujulianandClaude Opus 5.5 8a8918403f test(i18n): check both string tables and the keys used in code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:20:52 +01:00
fraujulianandClaude Opus 5.5 cf29d97bc4 feat(i18n): add Tr markup extension for XAML texts
{l:Tr Key} binds to Loc, so XAML texts follow a language switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:20:46 +01:00
fraujulianandClaude Opus 5.5 527c378ccd feat(i18n): add German and English string tables with Loc lookup
Loc reads Strings.resx (German, default) and Strings.en.resx and raises
Changed after a switch so views can refresh texts set in code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:20:46 +01:00
fraujulianandClaude Opus 5.5 d425ddcfca chore: add MIT license
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 09:20:22 +01:00
fraujulian e81257eca6 refactor(cleanup): comments, files and outdated code 2026-11-26 08:24:19 +01:00
fraujulianandClaude Opus 5.5 7a9ba99a27 fix(lautfm): send track searches to the Radioadmin search host
Radioadmin reads its track search host from client/_/config.json,
which names search.api.radioadmin.laut.fm. The provider asked
api.radioadmin.laut.fm instead, so the laut.fm library stayed empty.

Refs #15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 08:51:23 +01:00
fraujulianandClaude Opus 5.5 a94fb862d2 feat: stream live to laut.fm and import from its library
The Settings page gets a laut.fm card: a switch, the live access data
from Radioadmin (server, port, mountpoint, user, password) and the
station id and Radioadmin token for the library. Password and token
are written to settings.json encrypted with DPAPI for the Windows user.

While laut.fm is on, the Schedule page shows a Live button next to
"Jetzt starten". It logs in at the Icecast server with PUT and sends a
copy of the broadcast mix as MP3 at 128 kbit/s, encoded by Windows
Media Foundation. ProgramOutput hands that copy out through a live
feed. Each item that starts sets the stream title; ad items send
START_AD_BREAK at most once every 15 minutes.

LautFmProvider searches the station's tracks through the Radioadmin
API and the Import page lists it while laut.fm is on, so laut.fm tracks
are imported into the same library as local songs. Providers can now
hide themselves with IsAvailable.

Nothing was tested against a real laut.fm account; the tests use a
local fake server and fake HTTP answers.

Refs #15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 08:36:39 +01:00
fraujulianandClaude Opus 5.5 5d261717fe feat: mix music and microphone on one program output
Songs and the microphone now go through one audio channel,
ProgramOutput, instead of each opening its own device. ProgramMixer
builds two mixes in one pass: the broadcast for the listeners and a
monitor mix for the person at the desk. With two playback devices each
mix gets its own device; with one device the desk hears the monitor
mix.

The Schedule page gets a microphone button that works with or without
a running broadcast, and sliders for the music and microphone levels
on the broadcast, the music level on the monitor, and an option to
hear the broadcast exactly. The Settings page lets the user choose
the playback devices for the broadcast and for themselves.

MusicPlayer plays its tracks into the mixer; pause takes the track
out of the mix and resume puts it back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 08:21:13 +01:00
fraujulianandClaude Fable 5.2 2380f233b5 docs: describe dependency injection, music providers and the Internet Archive
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 15:09:36 +01:00
fraujulianandClaude Fable 5.2 e005688aeb fix(import): show which import tab is selected
The theme barely marks the selected tab. Its header is now bold with an
accent line below, and the other tab is dimmed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 15:09:36 +01:00
fraujulianandClaude Fable 5.2 d73b9b507f feat(import): add the Internet Archive as a music provider
Searches Creative Commons licensed MP3 audio. A search result there is an
item with several files, so the file list of each item is fetched too and
every MP3 becomes one result. Query operators are removed from the search
words, so they cannot change the license filter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 15:09:36 +01:00
fraujulianandClaude Fable 5.2 a8ccb9b73d refactor(import): put online sources behind IMusicProvider
A provider only has to search and return MusicTrack items. Downloading and
storing them is shared by all providers in TrackDownloader and
OnlineImportController. OpenverseProvider is the first implementation.
Song.OpenverseId becomes ExternalId and SongSource.Openverse becomes
Online; the database column and the stored values stay the same.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 15:09:35 +01:00
fraujulianandClaude Fable 5.2 c6e9bf4e82 refactor: build services with dependency injection
App registers the services, controllers, the main window and the pages in a
container, and the navigation view asks it for each page. Pages get their
controllers through the constructor instead of reading statics from App.
SettingsStore takes over the current settings from App.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 15:09:35 +01:00
fraujulianandClaude Fable 5.2 65743279b1 refactor(database): access the library through EF Core
SongRepository uses Entity Framework Core instead of hand-written SQL. The
table and column names stay the same, so existing libraries open unchanged.
The duration rule moves into the repository, and a duplicate Openverse id
now surfaces as DbUpdateException. Libraries from before the Openverse
import, which lack the OpenverseId column, are no longer upgraded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:40:12 +01:00
fraujulianandClaude Fable 5.2 7cdc3b3a41 refactor: remove the unused placeholder lists
The generator sizes ad and moderator items itself and leaves their titles
empty, so PlaceholderContent and its two models had no caller left.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:40:11 +01:00
fraujulianandClaude Fable 5.2 ac9170249b docs: describe the new schedule options, settings and German labels
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:53 +01:00
fraujulianandClaude Fable 5.2 54b02c3fd6 feat(settings): add the settings page and speaking reminders
The main window shows a dialog, optionally with a bing sound, shortly before
a news or moderator item goes on air. The settings page sits in the footer
of the navigation; the empty home page is gone and the app starts on the
schedule. Pages switch off the navigation view's outer scrolling so their
lists stay virtualized.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:52 +01:00
fraujulianandClaude Fable 5.2 80292ac90b feat(schedule): rework the schedule page
Adds the start time, unlimited mode, start from now, end now and the
buttons to move, edit and remove timeline items. Rows update in place and
slow controller calls run off the UI thread, with the buttons switching at
once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:52 +01:00
fraujulianandClaude Fable 5.2 d6a45cafa6 feat(import): batch import, working preview and a leaner page
Several Openverse results can be selected and imported in one go. The
preview streams through NAudio, because the WPF MediaPlayer cannot open
https URLs. The list of imported songs appears only once there is one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:51 +01:00
fraujulianandClaude Fable 5.2 d7388fbfc3 feat(library): simplify the library page and fit columns to their text
GridColumns widens text columns to the longest entry over all rows, since
the lists are virtualized and the built-in auto width only sees visible
rows. The page loses its license and attribution columns, gets Enter and
Delete on the list, and is in German.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:50 +01:00
fraujulianandClaude Fable 5.2 b8f5a3e469 feat(i18n): translate import and player messages to German
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:49 +01:00
fraujulianandClaude Fable 5.2 44d07a10df fix(openverse): decode HTML entities in titles and creators
Openverse sends some texts HTML-encoded, so "Angus &amp; Friends" showed up
as it came. Error messages are in German like the rest of the interface.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:49 +01:00
fraujulianandClaude Fable 5.2 f0726bc9fa feat(settings): store alert and minutes-per-hour settings
Settings live in settings.json next to the database. News, moderator talk
and ads together can take at most 60 minutes per hour. The app also follows
the Windows light, dark or high-contrast theme at startup.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:48 +01:00
fraujulianandClaude Fable 5.2 65c0e39e47 feat(schedule): add unlimited plans, start from now and timeline edits
The controller can plan from a chosen hour or from this moment, keep an
unlimited plan five hours ahead, move, remove and edit items, end the item
on air, and report the next news or moderator item that is due for a
reminder.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:47 +01:00
fraujulianandClaude Fable 5.2 1482402852 feat(playback): re-time or end the item on air
ReplaceCurrent hands the engine a plan in which the running item changed.
A news, ad or moderator item then runs for its new length, counted from its
start, and a song ends at once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 14:22:47 +01:00
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 0a0d8e1d4c feat: combine upload and Openverse into one import page
Adding music took two navigation items that each did half the job.
The new Import page has both sources as tabs and one shared list of
what was added in this session, with the reason for every failure and
a link to the library.

From computer: drop several MP3 or WAV files or pick them with a
multi-select dialog. Files are imported one by one on a background
thread with a progress bar, and a failing file does not stop the rest.

Openverse: search and download show a progress ring with a status
text. Results that are already in the library or have no duration are
marked in their row and cannot be imported; a double-click imports.

To detect duplicates, songs now store the Openverse result id. The
repository adds the column to existing databases and a unique index
keeps one song per Openverse result.

Refs #13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:34:35 +01:00
fraujulianandClaude Opus 5.5 497ac8fd6c fix: start each schedule item at its planned time
Start played the first item right away, although the plan begins at
the next full hour. The news was at :00 and :30 in the plan but not on
the real clock.

PlaybackEngine now takes a clock and waits before each item until its
planned start. An item that runs late is never cut; the next one then
starts right after it. When the broadcast starts after the plan has
begun, items that should already have started are skipped and playback
joins at the next one.

While the engine waits for the first item, the now-playing card shows
"On air at" with the planned time. Starting a plan that is already
over is refused with a message.

Refs #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:20:10 +01:00
fraujulianandClaude Opus 5.5 6f3ce85307 docs: document usage, architecture and assignment checklist
The README now explains how to use each page, how the schedule is
built, the MVC layers and main services, and the Openverse license
and attribution handling. A checklist maps every requirement of the
assignment to the code that covers it.

The review found one gap, now listed under known limitations: the
plan starts at the next full hour, but Start plays right away, so the
news only hits the real :00 and :30 when the broadcast starts at a
full hour.

The home page still said that features "will appear here"; it now
points to the pages that exist.

Refs #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:15:06 +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 7f9ed339e7 feat: add schedule and now-playing page
The new Schedule page lets the user choose 1 to 24 hours and create a
plan that starts at the next full hour. The timeline lists start time,
type, title and duration. Each type has a labelled chip: news,
ads and moderator segments get their own border color, songs stay
neutral because the accent color can be the same red as the news.

A now-playing card shows the current item with progress, elapsed and
planned time, Start and Stop buttons and a volume slider. The current
row is selected and scrolled into view. Errors from the generator and
skipped items appear in an InfoBar.

ScheduleController creates the plan from the library and drives the
PlaybackEngine. It lives on App for the whole app run, so a broadcast
keeps playing while the user switches pages, and it stops on exit.

Refs #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:01:28 +01:00
fraujulianandClaude Opus 5.5 b1e361f728 feat: add playback engine that runs a schedule
PlaybackEngine plays a generated schedule from start to end without
user input. Songs play through the MusicPlayer singleton and the next
item starts on TrackFinished. News, ads and moderator placeholders are
held for their duration.

A song that cannot be started, or that does not finish within its
length plus 10 seconds, raises ItemFailed and the engine moves on, so
one broken file or a device error does not stop the broadcast.
Start replaces a running schedule and Stop ends playback.

MusicPlayer now implements a small IAudioPlayer interface so the
engine can be tested with a fake player and a fake delay.

Refs #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:52:35 +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
fraujulian ba97d351b0 Merge remote-tracking branch 'origin/main' into j.lechner/openverse
# Conflicts:
#	src/Radiosender/Views/MainWindow.xaml
2026-11-23 10:42:16 +01:00
fraujulian d3f9da32b8 Merge remote-tracking branch 'origin/main' into j.lechner/openverse
# Conflicts:
#	src/Radiosender/Views/MainWindow.xaml
2026-11-23 10:38:16 +01:00
fraujulian 360077ff64 Merge remote-tracking branch 'origin/main' into j.lechner/song-upload
# Conflicts:
#	src/Radiosender/Radiosender.csproj
#	src/Radiosender/Views/MainWindow.xaml
2026-11-23 10:37:26 +01:00
fraujulianandClaude Opus 5.5 fc461b74cb feat: add Openverse audio search and import
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>
2026-11-23 10:26:11 +01:00
fraujulianandClaude Opus 5.5 7c95aba30a feat: add song upload for MP3 and WAV files
Add an Upload page where the user picks an MP3 or WAV file. The new
SongImportService copies it into %LOCALAPPDATA%\Radiosender\Music under
a unique name, reads the duration with NAudio and title/artist from tags
with TagLibSharp (falling back to the file name), and saves the song
with Source = Upload. Wrong extensions, unreadable files, garbage data
and files without audio are rejected; the copied file is deleted again
so nothing is left behind. The page shows the result in a Snackbar.

The music folder is injected so the service is testable without UI.
Tests cover a generated WAV, duplicate names, wrong extension, garbage
files, empty audio and missing files.

Refs #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:24:15 +01:00
fraujulianandClaude Opus 5.5 5ea2740895 feat: add music player singleton on NAudio
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>
2026-11-23 10:24:14 +01:00
fraujulianandClaude Opus 5.5 faa1dc19cc feat: add music library page with search, edit and delete
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>
2026-11-23 10:24:12 +01:00
fraujulianandClaude Opus 5.5 2241c57203 feat: add ad and moderator placeholder content
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>
2026-11-23 10:20:59 +01:00
fraujulianandClaude Opus 5.5 a02081fe66 feat: add SQLite song database and repository
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>
2026-11-23 10:06:14 +01:00
fraujulianandClaude Opus 5.5 910709fe26 feat: initialize WPF project with WPF UI
Add the Radiosender solution on .NET 10 with the WPF-UI 4.3.0 package.
The main window is a FluentWindow with a title bar and a NavigationView
that opens a home page. Models, Controllers and Services folders hold
the MVC structure for the next issues. Replace the GitLab template
README with build instructions.

Refs #1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:57:35 +01:00