1
0
mirror of https://github.com/kmein/niveum synced 2026-03-19 19:41:08 +01:00

feat(pls): use ircaids

This commit is contained in:
2021-10-19 22:42:29 +02:00
parent 4ae2fa4a6a
commit c06fb3f50c
2 changed files with 11 additions and 14 deletions

View File

@@ -198,6 +198,7 @@ in {
kpaste kpaste
irc-announce irc-announce
git-preview git-preview
ircaids
]; ];
} }

View File

@@ -2,21 +2,15 @@
let let
inherit (pkgs) lib; inherit (pkgs) lib;
irc = {
host = "irc.hackint.org";
port = 6697;
tls = true;
channel = "#the_playlist";
nick = "musikkritiker";
};
playlistAPI = "prism.r:8001"; playlistAPI = "prism.r:8001";
sendIRC = pkgs.writers.writeDash "send-irc" '' sendIRC = pkgs.writers.writeDash "send-irc" ''
${pkgs.nur.repos.mic92.untilport}/bin/untilport ${irc.host} ${toString irc.port} && \ ${pkgs.ircaids}/bin/ircsink \
${pkgs.nur.repos.mic92.irc-announce}/bin/irc-announce \ --nick musikkritiker \
${irc.host} ${toString irc.port} ${irc.nick} ${lib.escapeShellArg irc.channel} ${toString (if irc.tls then 1 else 0)} \ --server irc.hackint.org \
"$*" 2>&1 >/dev/null --port 6697 \
--secure \
--target '#the_playlist' >/dev/null 2>&1
''; '';
messages.good = [ messages.good = [
@@ -31,6 +25,7 @@ let
"that just sounds awesome!" "that just sounds awesome!"
"that's a good song!" "that's a good song!"
"👍" "👍"
"vibin'"
]; ];
messages.bad = [ messages.bad = [
"how can anyone listen to this?" "how can anyone listen to this?"
@@ -41,16 +36,17 @@ let
"nope" "nope"
"that sucks!" "that sucks!"
"👎" "👎"
"turn that down"
]; ];
in in
pkgs.writers.writeDashBin "pls" '' pkgs.writers.writeDashBin "pls" ''
case "$1" in case "$1" in
good|like|cool|nice|noice|top|yup|yass|yes|+) good|like|cool|nice|noice|top|yup|yass|yes|+)
${sendIRC} "$(echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1)" & echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC}
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good" ${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good"
;; ;;
skip|next|bad|sucks|no|nope|flop|-) skip|next|bad|sucks|no|nope|flop|-)
${sendIRC} "$(echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1)" & echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1 | ${sendIRC}
${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/skip" ${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/skip"
;; ;;
*) *)