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

82 lines
1.9 KiB
Nix
Raw Permalink Normal View History

{
lib,
writers,
miller,
gnused,
curl,
nur,
}: let
2021-11-23 20:56:03 +01:00
playlistAPI = "https://radio.lassul.us";
sendIRC = writers.writeDash "send-irc" ''
${nur.repos.mic92.ircsink}/bin/ircsink \
2021-10-19 22:42:29 +02:00
--nick musikkritiker \
--server irc.hackint.org \
--port 6697 \
--secure \
--target '#the_playlist' >/dev/null 2>&1
'';
messages.good = [
"what a banger"
"ooh i love this song"
"this is top notch stuff!"
"nice!"
"noice!"
"yesss!"
"cool song!"
"i like this"
"that just sounds awesome!"
"that's a good song!"
"👍"
2021-10-19 22:42:29 +02:00
"vibin'"
];
messages.bad = [
"how can anyone listen to this?"
"(°° "
"skip this!"
"next, please! i'm suffering!"
"that's just bad music"
"nope"
"that sucks!"
"👎"
2021-10-19 22:42:29 +02:00
"turn that down"
2021-11-12 20:22:51 +01:00
"make it stooop"
"noooo"
];
2022-05-24 11:09:25 +02:00
messages.neutral = [
"meh"
"i have no opinion about this song"
"idk man"
];
in
writers.writeDashBin "pls" ''
2022-03-10 21:52:12 +01:00
case "$1" in
good|like|cool|nice|noice|top|yup|yass|yes|+)
${curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
2022-03-10 21:52:12 +01:00
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC}
;;
skip|next|bad|sucks|no|nope|flop|-)
${curl}/bin/curl -sS -XPOST "${playlistAPI}/skip"
2022-03-10 21:52:12 +01:00
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1 | ${sendIRC}
;;
2022-05-24 11:09:25 +02:00
0|meh|neutral)
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.neutral)} | shuf -n1 | ${sendIRC}
;;
2022-03-10 21:52:12 +01:00
say|msg)
shift
echo "$@" | ${sendIRC}
;;
recent)
${curl}/bin/curl -sS -XGET "${playlistAPI}/recent" | tac | head
2022-03-10 21:52:12 +01:00
;;
*)
${curl}/bin/curl -sS -XGET "${playlistAPI}/current" \
| ${miller}/bin/mlr --ijson --oxtab cat \
| ${gnused}/bin/sed -n '/artist\|title\|youtube/p'
2022-03-10 21:52:12 +01:00
;;
esac
wait
''