mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat: lyrikline and lyrik (from youtube) stream
This commit is contained in:
@@ -1,40 +1,49 @@
|
||||
{ pkgs, config, ... }:
|
||||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
meddlPort = 8000;
|
||||
meddl = {
|
||||
streamPort = 8000;
|
||||
mpdPort = 6600;
|
||||
};
|
||||
lyrikline = {
|
||||
streamPort = 8001;
|
||||
mpdPort = 6601;
|
||||
};
|
||||
lyrik = {
|
||||
streamPort = 8002;
|
||||
mpdPort = 6602;
|
||||
};
|
||||
in
|
||||
{
|
||||
containers.lyrik = {
|
||||
autoStart = true;
|
||||
config = {config, pkgs, ...}: {
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
network.port = lyrik.mpdPort;
|
||||
extraConfig = ''
|
||||
log_level "default"
|
||||
|
||||
audio_output {
|
||||
name "Lyrik-Radio"
|
||||
type "httpd"
|
||||
encoder "vorbis"
|
||||
port "${toString lyrik.streamPort}"
|
||||
bitrate "128"
|
||||
format "44100:16:2"
|
||||
always_on "yes"
|
||||
tags "yes"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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;
|
||||
network.port = meddl.mpdPort;
|
||||
extraConfig = ''
|
||||
log_level "default"
|
||||
volume_normalization "yes"
|
||||
@@ -43,7 +52,7 @@ in
|
||||
name "DrachenLord Radio"
|
||||
type "httpd"
|
||||
encoder "vorbis"
|
||||
port "${toString meddlPort}"
|
||||
port "${toString meddl.streamPort}"
|
||||
bitrate "128"
|
||||
format "44100:16:2"
|
||||
always_on "yes"
|
||||
@@ -55,7 +64,116 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
containers.lyrikline = {
|
||||
autoStart = true;
|
||||
config = {config, pkgs, ...}: {
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
network.port = lyrikline.mpdPort;
|
||||
extraConfig = ''
|
||||
log_level "default"
|
||||
|
||||
audio_output {
|
||||
name "lyrikline.org Radio"
|
||||
type "httpd"
|
||||
encoder "vorbis"
|
||||
port "${toString lyrikline.streamPort}"
|
||||
bitrate "128"
|
||||
format "44100:16:2"
|
||||
always_on "yes"
|
||||
tags "yes"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.lyrikline = {
|
||||
after = [ "container@lyrikline.service" ];
|
||||
wantedBy = [ "container@lyrikline.service" ];
|
||||
startAt = "*:00/5";
|
||||
environment.MPD_PORT = toString lyrikline.mpdPort;
|
||||
script = ''
|
||||
set -efu
|
||||
|
||||
lyrikline=https://www.lyrikline.org
|
||||
for _ in $(seq 1 10); do
|
||||
random_route="$(${pkgs.curl}/bin/curl -sSL "$lyrikline/index.php/tools/getrandompoem" --data-raw 'lang=de' --compressed | ${pkgs.jq}/bin/jq -r .link)"
|
||||
poem_url="$(${pkgs.curl}/bin/curl -sSL "$lyrikline$random_route" | grep -o 'https://.*\.mp3' | head -n1)"
|
||||
${pkgs.mpc_cli}/bin/mpc add "$poem_url"
|
||||
done
|
||||
|
||||
${pkgs.mpc_cli}/bin/mpc play
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.lyrik = {
|
||||
after = [ "container@lyrik.service" ];
|
||||
wantedBy = [ "container@lyrik.service" ];
|
||||
environment.MPD_PORT = toString lyrik.mpdPort;
|
||||
preStart = "${pkgs.mpc_cli}/bin/mpc crop";
|
||||
restartIfChanged = true;
|
||||
script =
|
||||
let
|
||||
videoIds = import <niveum/lib/hot-rotation/lyrik.nix>;
|
||||
streams = lib.concatMapStringsSep "\n" (id: "https://au.ytprivate.com/latest_version?id=${id}&itag=251") videoIds;
|
||||
streamsFile = pkgs.writeText "hotrot" streams;
|
||||
in ''
|
||||
set -efu
|
||||
|
||||
${pkgs.mpc_cli}/bin/mpc add < ${toString streamsFile}
|
||||
|
||||
${pkgs.mpc_cli}/bin/mpc crossfade 5
|
||||
${pkgs.mpc_cli}/bin/mpc random on
|
||||
${pkgs.mpc_cli}/bin/mpc repeat on
|
||||
${pkgs.mpc_cli}/bin/mpc play
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
systemd.services.meddl = {
|
||||
after = [ "container@meddl.service" ];
|
||||
wantedBy = [ "container@meddl.service" ];
|
||||
startAt = "*:00/10";
|
||||
environment.MPD_PORT = toString meddl.mpdPort;
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writers.writeDashBin "mpc-lyrikline" ''
|
||||
MPD_PORT=${toString lyrikline.mpdPort} ${pkgs.mpc_cli}/bin/mpc "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "mpc-meddl" ''
|
||||
MPD_PORT=${toString meddl.mpdPort} ${pkgs.mpc_cli}/bin/mpc "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "mpc-lyrik" ''
|
||||
MPD_PORT=${toString lyrik.mpdPort} ${pkgs.mpc_cli}/bin/mpc "$@"
|
||||
'')
|
||||
];
|
||||
|
||||
services.nginx.virtualHosts."radio.xn--kiern-0qa.de".locations = {
|
||||
"= /meddl.ogg".proxyPass = "http://127.0.0.1:${toString meddlPort}";
|
||||
"= /meddl.ogg".proxyPass = "http://127.0.0.1:${toString meddl.streamPort}";
|
||||
"= /lyrikline.ogg".proxyPass = "http://127.0.0.1:${toString lyrikline.streamPort}";
|
||||
"= /lyrik.ogg".proxyPass = "http://127.0.0.1:${toString lyrik.streamPort}";
|
||||
};
|
||||
}
|
||||
|
||||
1913
lib/hot-rotation/lyrik.nix
Normal file
1913
lib/hot-rotation/lyrik.nix
Normal file
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,17 @@ in [
|
||||
logo = "https://antenne-asb.ga/logo.png";
|
||||
desc = "Forked from antenne-asb.ga: Radiosender zum Youtuber Drachenlord. Hier läuft den ganzen Tag Drachenlord Musik von Haidern oder Podcasts zum Lord.";
|
||||
}
|
||||
{
|
||||
stream = "http://radio.xn--kiern-0qa.de/lyrik.ogg";
|
||||
station = "Lyrik";
|
||||
desc = "Lyrik-Lesung rund um die Uhr.";
|
||||
}
|
||||
{
|
||||
stream = "http://radio.xn--kiern-0qa.de/lyrikline.ogg";
|
||||
station = "Lyrikline";
|
||||
logo = "https://www.lyrikline.org/themes/lyrik/svg/Logo_lyrikline_pure.svg";
|
||||
desc = "24/7 zufällige Wiedergaben von lyrikline.org.";
|
||||
}
|
||||
{
|
||||
stream = "http://1.ice1.firststreaming.com/kkjz_fm.aac";
|
||||
station = "KJazz 88.1";
|
||||
|
||||
Reference in New Issue
Block a user