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>
This commit is contained in:
fraujulianandClaude Opus 5.5 committed 2026-11-25 08:36:39 +01:00
1 parent 5d261717fe
commit a94fb862d2
16 files changed
+999 -16

No files matched your search

+10
View File
@@ -41,6 +41,15 @@ public partial class App : Application
// Music providers: add a line here for each new IMusicProvider; the import page lists them all.
services.AddSingleton<IMusicProvider, OpenverseProvider>();
services.AddSingleton<IMusicProvider, InternetArchiveProvider>();
// The station's own library; listed only while laut.fm is switched on in the settings.
services.AddSingleton<IMusicProvider>(provider => new LautFmProvider(
provider.GetRequiredService<System.Net.Http.HttpClient>(), () => provider.GetRequiredService<SettingsStore>().Current));
services.AddSingleton(provider => new LiveController(
provider.GetRequiredService<ScheduleController>(),
provider.GetRequiredService<SettingsStore>(),
provider.GetRequiredService<ProgramOutput>(),
provider.GetRequiredService<System.Net.Http.HttpClient>(),
() => DateTime.Now));
services.AddSingleton(provider => new TrackDownloader(provider.GetRequiredService<System.Net.Http.HttpClient>(), TrackDownloader.DefaultMusicFolder));
services.AddSingleton<OnlineImportController>();
services.AddSingleton(provider => new SongImportService(provider.GetRequiredService<SongRepository>(), SongImportService.DefaultMusicDirectory));
@@ -70,6 +79,7 @@ public partial class App : Application
protected override void OnExit(ExitEventArgs e)
{
_services?.GetRequiredService<LiveController>().Stop();
_services?.GetRequiredService<ScheduleController>().Stop();
_services?.Dispose();
base.OnExit(e);