2021-05-25 21:07:07 +02:00
|
|
|
|
{ pkgs }:
|
|
|
|
|
|
let
|
|
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
|
|
|
|
|
|
|
irc = {
|
|
|
|
|
|
host = "irc.hackint.org";
|
|
|
|
|
|
port = 6697;
|
|
|
|
|
|
tls = true;
|
|
|
|
|
|
channel = "#the_playlist";
|
|
|
|
|
|
nick = "musikkritiker";
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
playlistAPI = "prism.r:8001";
|
|
|
|
|
|
|
|
|
|
|
|
sendIRC = pkgs.writers.writeDash "send-irc" ''
|
|
|
|
|
|
${pkgs.nur.repos.mic92.untilport}/bin/untilport ${irc.host} ${toString irc.port} && \
|
|
|
|
|
|
${pkgs.nur.repos.mic92.irc-announce}/bin/irc-announce \
|
|
|
|
|
|
${irc.host} ${toString irc.port} ${irc.nick} ${lib.escapeShellArg irc.channel} ${toString (if irc.tls then 1 else 0)} \
|
2021-06-02 09:01:25 +02:00
|
|
|
|
"$*" 2>&1 >/dev/null
|
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!"
|
|
|
|
|
|
"👍"
|
|
|
|
|
|
];
|
|
|
|
|
|
messages.bad = [
|
|
|
|
|
|
"how can anyone listen to this?"
|
|
|
|
|
|
"(╯°□°)╯ ┻━┻"
|
|
|
|
|
|
"skip this!"
|
|
|
|
|
|
"next, please! i'm suffering!"
|
|
|
|
|
|
"that's just bad music"
|
|
|
|
|
|
"nope"
|
|
|
|
|
|
"that sucks!"
|
|
|
|
|
|
"👎"
|
|
|
|
|
|
];
|
|
|
|
|
|
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-06-01 22:12:41 +02:00
|
|
|
|
${sendIRC} "$(echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1)" &
|
2021-05-25 21:07:07 +02:00
|
|
|
|
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
|
|
|
|
|
|
;;
|
|
|
|
|
|
skip|next|bad|sucks|no|nope|flop|-)
|
2021-06-01 22:12:41 +02:00
|
|
|
|
${sendIRC} "$(echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1)" &
|
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
|
|
|
|
|
|
''
|