mirror of
https://github.com/kmein/niveum
synced 2026-03-16 18:21:07 +01:00
feat(radio): allow setting DI_FM_KEY as env variable
This commit is contained in:
@@ -180,6 +180,9 @@ in {
|
||||
(niveumPackages.mpv-radio.override {
|
||||
di-fm-key-file = config.age.secrets.di-fm-key.path;
|
||||
})
|
||||
(niveumPackages.mpv-tuner.override {
|
||||
di-fm-key-file = config.age.secrets.di-fm-key.path;
|
||||
})
|
||||
# kmein.slide
|
||||
termdown
|
||||
niveumPackages.image-convert-tolino
|
||||
|
||||
@@ -300,6 +300,7 @@
|
||||
menu-calc = pkgs.callPackage packages/menu-calc.nix {};
|
||||
meteo = pkgs.callPackage packages/meteo.nix {};
|
||||
mpv-radio = pkgs.callPackage packages/mpv-radio.nix {di-fm-key-file = "/dev/null";};
|
||||
mpv-tuner = pkgs.callPackage packages/mpv-tuner.nix {di-fm-key-file = "/dev/null";};
|
||||
mpv-tv = pkgs.callPackage packages/mpv-tv.nix {};
|
||||
mpv-visualizer = pkgs.callPackage packages/mpv-visualizer.nix {};
|
||||
new-mac = pkgs.callPackage packages/new-mac.nix {};
|
||||
|
||||
@@ -1961,6 +1961,11 @@ in
|
||||
station = "The Quran Radio";
|
||||
tags = [tags.arabic tags.text tags.holy];
|
||||
}
|
||||
{
|
||||
stream = "http://www.radioeins.de/livemp3";
|
||||
station = "radioeins | RBB";
|
||||
tags = [tags.top40 tags.pop];
|
||||
}
|
||||
]
|
||||
++ map (name: {
|
||||
stream = "https://${name}.stream.publicradio.org/${name}.aac";
|
||||
@@ -1980,21 +1985,25 @@ in
|
||||
++ map (name: {
|
||||
stream = rockradio name;
|
||||
station = rockradio-name name;
|
||||
tags = [tags.rock];
|
||||
})
|
||||
rockradio-channels
|
||||
++ map (name: {
|
||||
stream = jazzradio name;
|
||||
station = jazzradio-name name;
|
||||
tags = [tags.jazz];
|
||||
})
|
||||
jazzradio-channels
|
||||
++ map (name: {
|
||||
stream = zenradio name;
|
||||
station = zenradio-name name;
|
||||
tags = [tags.chill];
|
||||
})
|
||||
zenradio-channels
|
||||
++ map (name: {
|
||||
stream = classicalradio name;
|
||||
station = classicalradio-name name;
|
||||
tags = [tags.classical];
|
||||
})
|
||||
classicalradio-channels
|
||||
/*
|
||||
|
||||
@@ -113,16 +113,17 @@
|
||||
set -efu
|
||||
|
||||
${watcherOptions.script} > ${watcherName}
|
||||
${pkgs.git}/bin/git add ${watcherName}
|
||||
${pkgs.git}/bin/git commit --message "${watcherName} / $(${pkgs.coreutils}/bin/date -Is)" || :
|
||||
|
||||
if [ -n "$(${pkgs.git}/bin/git diff HEAD^ -- ${watcherName})" ]; then
|
||||
if [ -n "$(${pkgs.git}/bin/git diff -- ${watcherName})" ]; then
|
||||
${lib.strings.concatMapStringsSep "\n" (reporter: ''
|
||||
${pkgs.git}/bin/git diff HEAD^ -- ${watcherName} | ${reporter}
|
||||
'')
|
||||
watcherOptions.reporters}
|
||||
:
|
||||
fi
|
||||
|
||||
${pkgs.git}/bin/git add ${watcherName}
|
||||
${pkgs.git}/bin/git commit --message "${watcherName} / $(${pkgs.coreutils}/bin/date -Is)" || :
|
||||
'';
|
||||
})
|
||||
cfg.watchers;
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
streams);
|
||||
in
|
||||
writers.writeDashBin "mpv-radio" ''
|
||||
export DI_FM_KEY=$(cat "${di-fm-key-file}")
|
||||
if [ -z ''${DI_FM_KEY} ]; then
|
||||
DI_FM_KEY=$(cat "${di-fm-key-file}")
|
||||
fi
|
||||
exec ${mpv}/bin/mpv --force-window=yes "$(
|
||||
${dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} \
|
||||
| ${coreutils}/bin/cut -f3 \
|
||||
|
||||
22
packages/mpv-tuner.nix
Normal file
22
packages/mpv-tuner.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
writeText,
|
||||
lib,
|
||||
writers,
|
||||
mpv,
|
||||
gnused,
|
||||
di-fm-key-file,
|
||||
findutils,
|
||||
}: let
|
||||
streams = import ../lib/streams.nix {
|
||||
di-fm-key = "%DI_FM_KEY%";
|
||||
};
|
||||
streams-list = writeText "streams.txt" (lib.concatMapStringsSep "\n" (station: station.stream) streams);
|
||||
in
|
||||
writers.writeDashBin "mpv-tuner" ''
|
||||
if [ -z ''${DI_FM_KEY} ]; then
|
||||
DI_FM_KEY=$(cat "${di-fm-key-file}")
|
||||
fi
|
||||
shuf ${streams-list} \
|
||||
| ${gnused}/bin/sed s/%DI_FM_KEY%/"$DI_FM_KEY"/ \
|
||||
| ${findutils}/bin/xargs ${mpv}/bin/mpv
|
||||
''
|
||||
Reference in New Issue
Block a user