1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat(makanek): host drachenlord radio and stream from zaatar

the streaming links from antenne-asb.ga serve OGG but they say they
serve MP3. so mpd gets confused.
therefore regularly fetches song urls from antenne-asb.ga, queues, and
broadcasts them.
This commit is contained in:
2021-01-30 20:24:43 +01:00
parent 6843ac90b5
commit 018f79f88d
4 changed files with 66 additions and 3 deletions

61
configs/meddl.nix Normal file
View File

@@ -0,0 +1,61 @@
{ pkgs, config, ... }:
let
meddlPort = 8000;
in
{
containers.meddl = {
autoStart = true;
config = {config, pkgs, ...}: {
environment.systemPackages = [ pkgs.mpc_cli ];
systemd.services.meddl = {
before = [ "mpd.service" ];
wantedBy = [ "mpd.service" ];
startAt = "*:00/10";
script = ''
set -efu
host=http://antenne-asb.ga
prepend_host() {
sed "s#^#$host/#"
}
${pkgs.curl}/bin/curl -sSL "$host" \
| ${pkgs.pup}/bin/pup 'li a attr{href}' \
| prepend_host \
| while read -r song; do
song_url="$(${pkgs.curl}/bin/curl -sSL "$song" \
| ${pkgs.pup}/bin/pup 'audio source attr{src}' \
| prepend_host
)"
${pkgs.mpc_cli}/bin/mpc add "$song_url"
done
${pkgs.mpc_cli}/bin/mpc play
'';
};
services.mpd = {
enable = true;
extraConfig = ''
log_level "default"
volume_normalization "yes"
audio_output {
name "DrachenLord Radio"
type "httpd"
encoder "vorbis"
port "${toString meddlPort}"
bitrate "128"
format "44100:16:2"
always_on "yes"
tags "yes"
}
'';
};
};
};
services.nginx.virtualHosts."makanek.r".locations = {
"= /meddl.ogg".proxyPass = "http://127.0.0.1:${toString meddlPort}";
};
}

View File

@@ -39,7 +39,8 @@ in
services.mpd-fm = { services.mpd-fm = {
enable = true; enable = true;
stationsFile = "/etc/mpd-fm/stations.json"; # stationsFile = "/etc/mpd-fm/stations.json";
stations = lib.lists.imap0 (id: {desc ? "", logo ? "https://picsum.photos/seed/${builtins.hashString "md5" stream}/300", stream, station}: { inherit id desc logo stream station; }) streams;
webPort = 8080; webPort = 8080;
}; };
@@ -70,7 +71,7 @@ in
recommendedTlsSettings = true; recommendedTlsSettings = true;
virtualHosts.default = { virtualHosts.default = {
basicAuth.dj = lib.strings.fileContents <system-secrets/mpd-web.key>; basicAuth.dj = lib.strings.fileContents <system-secrets/mpd-web.key>;
locations."~ ^/listen" = { locations."= /listen.ogg" = {
proxyPass = "http://127.0.0.1:${toString multi-room-audio-port}"; proxyPass = "http://127.0.0.1:${toString multi-room-audio-port}";
}; };
locations."/" = { locations."/" = {

View File

@@ -35,7 +35,7 @@ in [
desc = "Diminutive from lassus (weary, faint, tired). A programming human. Doing superior professional art."; desc = "Diminutive from lassus (weary, faint, tired). A programming human. Doing superior professional art.";
} }
{ {
stream = "ANTENNE_ASB_URL"; stream = "http://makanek.r/meddl.ogg";
station = "Antenne ASB"; station = "Antenne ASB";
logo = "https://antenne-asb.ga/logo.png"; logo = "https://antenne-asb.ga/logo.png";
desc = "Nonstop Drachenlord Radio Hier wird nicht nur, aber auch Meddl gespielt."; desc = "Nonstop Drachenlord Radio Hier wird nicht nur, aber auch Meddl gespielt.";

View File

@@ -11,6 +11,7 @@ in
<niveum/configs/nextcloud.nix> <niveum/configs/nextcloud.nix>
<niveum/configs/save-space.nix> <niveum/configs/save-space.nix>
<niveum/configs/version.nix> <niveum/configs/version.nix>
<niveum/configs/meddl.nix>
<niveum/configs/urlwatch.nix> <niveum/configs/urlwatch.nix>
<niveum/configs/gitea.nix> <niveum/configs/gitea.nix>
<niveum/configs/matterbridge.nix> <niveum/configs/matterbridge.nix>