1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/packages/scripts/pls.nix
Kierán Meinhardt d03c6bb0de feat: convert to flake
feat(zaatar): convert to flake

feat(tahina, tabula): convert to flake

feat(makanek): convert to flake

feat(manakish, zaatar): convert to flake

feat(ci): build flake systems

fix: ci build

feat: secrets via submodule

foo

foo

foo
2023-02-23 15:12:53 +01:00

79 lines
1.9 KiB
Nix
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
config,
pkgs,
lib,
}: let
playlistAPI = "https://radio.lassul.us";
sendIRC = pkgs.writers.writeDash "send-irc" ''
${config.nur.repos.mic92.ircsink}/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!"
"👍"
"vibin'"
];
messages.bad = [
"how can anyone listen to this?"
"(°° "
"skip this!"
"next, please! i'm suffering!"
"that's just bad music"
"nope"
"that sucks!"
"👎"
"turn that down"
"make it stooop"
"noooo"
];
messages.neutral = [
"meh"
"i have no opinion about this song"
"idk man"
];
in
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}
;;
0|meh|neutral)
echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.neutral)} | shuf -n1 | ${sendIRC}
;;
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
''