2021-05-25 21:07:07 +02:00
|
|
|
|
{ pkgs }:
|
|
|
|
|
|
let
|
|
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
|
|
|
|
|
|
|
playlistAPI = "prism.r:8001";
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2021-05-25 21:07:07 +02:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
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'"
|
2021-05-25 21:07:07 +02:00
|
|
|
|
];
|
|
|
|
|
|
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-05-25 21:07:07 +02:00
|
|
|
|
];
|
|
|
|
|
|
in
|
|
|
|
|
|
pkgs.writers.writeDashBin "pls" ''
|
|
|
|
|
|
case "$1" in
|
2021-06-02 09:01:25 +02:00
|
|
|
|
good|like|cool|nice|noice|top|yup|yass|yes|+)
|
2021-10-19 22:42:29 +02:00
|
|
|
|
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC}
|
2021-05-25 21:07:07 +02:00
|
|
|
|
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
|
|
|
|
|
|
;;
|
|
|
|
|
|
skip|next|bad|sucks|no|nope|flop|-)
|
2021-10-19 22:42:29 +02:00
|
|
|
|
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1 | ${sendIRC}
|
2021-05-25 21:07:07 +02:00
|
|
|
|
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/skip"
|
|
|
|
|
|
;;
|
|
|
|
|
|
*)
|
2021-06-02 09:01:25 +02:00
|
|
|
|
${pkgs.curl}/bin/curl -sS -XGET "${playlistAPI}/current" \
|
|
|
|
|
|
| ${pkgs.miller}/bin/mlr --ijson --oxtab cat \
|
|
|
|
|
|
| ${pkgs.gnused}/bin/sed -n '/artist\|title\|youtube/p'
|
2021-05-25 21:07:07 +02:00
|
|
|
|
;;
|
|
|
|
|
|
esac
|
|
|
|
|
|
wait
|
|
|
|
|
|
''
|