mirror of
https://github.com/kmein/niveum
synced 2026-03-19 19:41:08 +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 {
|
(niveumPackages.mpv-radio.override {
|
||||||
di-fm-key-file = config.age.secrets.di-fm-key.path;
|
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
|
# kmein.slide
|
||||||
termdown
|
termdown
|
||||||
niveumPackages.image-convert-tolino
|
niveumPackages.image-convert-tolino
|
||||||
|
|||||||
@@ -300,6 +300,7 @@
|
|||||||
menu-calc = pkgs.callPackage packages/menu-calc.nix {};
|
menu-calc = pkgs.callPackage packages/menu-calc.nix {};
|
||||||
meteo = pkgs.callPackage packages/meteo.nix {};
|
meteo = pkgs.callPackage packages/meteo.nix {};
|
||||||
mpv-radio = pkgs.callPackage packages/mpv-radio.nix {di-fm-key-file = "/dev/null";};
|
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-tv = pkgs.callPackage packages/mpv-tv.nix {};
|
||||||
mpv-visualizer = pkgs.callPackage packages/mpv-visualizer.nix {};
|
mpv-visualizer = pkgs.callPackage packages/mpv-visualizer.nix {};
|
||||||
new-mac = pkgs.callPackage packages/new-mac.nix {};
|
new-mac = pkgs.callPackage packages/new-mac.nix {};
|
||||||
|
|||||||
@@ -1961,6 +1961,11 @@ in
|
|||||||
station = "The Quran Radio";
|
station = "The Quran Radio";
|
||||||
tags = [tags.arabic tags.text tags.holy];
|
tags = [tags.arabic tags.text tags.holy];
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
stream = "http://www.radioeins.de/livemp3";
|
||||||
|
station = "radioeins | RBB";
|
||||||
|
tags = [tags.top40 tags.pop];
|
||||||
|
}
|
||||||
]
|
]
|
||||||
++ map (name: {
|
++ map (name: {
|
||||||
stream = "https://${name}.stream.publicradio.org/${name}.aac";
|
stream = "https://${name}.stream.publicradio.org/${name}.aac";
|
||||||
@@ -1980,21 +1985,25 @@ in
|
|||||||
++ map (name: {
|
++ map (name: {
|
||||||
stream = rockradio name;
|
stream = rockradio name;
|
||||||
station = rockradio-name name;
|
station = rockradio-name name;
|
||||||
|
tags = [tags.rock];
|
||||||
})
|
})
|
||||||
rockradio-channels
|
rockradio-channels
|
||||||
++ map (name: {
|
++ map (name: {
|
||||||
stream = jazzradio name;
|
stream = jazzradio name;
|
||||||
station = jazzradio-name name;
|
station = jazzradio-name name;
|
||||||
|
tags = [tags.jazz];
|
||||||
})
|
})
|
||||||
jazzradio-channels
|
jazzradio-channels
|
||||||
++ map (name: {
|
++ map (name: {
|
||||||
stream = zenradio name;
|
stream = zenradio name;
|
||||||
station = zenradio-name name;
|
station = zenradio-name name;
|
||||||
|
tags = [tags.chill];
|
||||||
})
|
})
|
||||||
zenradio-channels
|
zenradio-channels
|
||||||
++ map (name: {
|
++ map (name: {
|
||||||
stream = classicalradio name;
|
stream = classicalradio name;
|
||||||
station = classicalradio-name name;
|
station = classicalradio-name name;
|
||||||
|
tags = [tags.classical];
|
||||||
})
|
})
|
||||||
classicalradio-channels
|
classicalradio-channels
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -113,16 +113,17 @@
|
|||||||
set -efu
|
set -efu
|
||||||
|
|
||||||
${watcherOptions.script} > ${watcherName}
|
${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: ''
|
${lib.strings.concatMapStringsSep "\n" (reporter: ''
|
||||||
${pkgs.git}/bin/git diff HEAD^ -- ${watcherName} | ${reporter}
|
${pkgs.git}/bin/git diff HEAD^ -- ${watcherName} | ${reporter}
|
||||||
'')
|
'')
|
||||||
watcherOptions.reporters}
|
watcherOptions.reporters}
|
||||||
:
|
:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
${pkgs.git}/bin/git add ${watcherName}
|
||||||
|
${pkgs.git}/bin/git commit --message "${watcherName} / $(${pkgs.coreutils}/bin/date -Is)" || :
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
cfg.watchers;
|
cfg.watchers;
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
streams);
|
streams);
|
||||||
in
|
in
|
||||||
writers.writeDashBin "mpv-radio" ''
|
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 "$(
|
exec ${mpv}/bin/mpv --force-window=yes "$(
|
||||||
${dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} \
|
${dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} \
|
||||||
| ${coreutils}/bin/cut -f3 \
|
| ${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