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

77 lines
1.9 KiB
Nix
Raw Normal View History

2022-03-10 21:52:12 +01:00
{pkgs}: let
inherit (pkgs) lib;
2021-11-23 20:56:03 +01:00
playlistAPI = "https://radio.lassul.us";
sendIRC = pkgs.writers.writeDash "send-irc" ''
2021-10-19 22:42:29 +02:00
${pkgs.ircaids}/bin/ircsink \
--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
2022-03-10 21:52:12 +01:00
pkgs.writers.writeDashBin "pls" ''
case "$1" in
good|like|cool|nice|noice|top|yup|yass|yes|+)
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC}
;;
skip|next|bad|sucks|no|nope|flop|-)
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/skip"
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)
${pkgs.curl}/bin/curl -sS -XGET "${playlistAPI}/recent" | tac | head
;;
*)
${pkgs.curl}/bin/curl -sS -XGET "${playlistAPI}/current" \
| ${pkgs.miller}/bin/mlr --ijson --oxtab cat \
| ${pkgs.gnused}/bin/sed -n '/artist\|title\|youtube/p'
;;
esac
wait
''