summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-02-23 23:42:33 +0100
committerlassulus <lassulus@lassul.us>2021-02-23 23:42:33 +0100
commit1f34fcdcd076003326a385db958b64820211dd78 (patch)
tree8198478c488343be802e48d1389da3a5f0243da0 /krebs
parent924471087c667640bad7ba38b5f9b00f2770f906 (diff)
news candyman: add more helpers
Diffstat (limited to 'krebs')
-rw-r--r--krebs/2configs/news.nix27
1 files changed, 25 insertions, 2 deletions
diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix
index a6cf02c17..410beb041 100644
--- a/krebs/2configs/news.nix
+++ b/krebs/2configs/news.nix
@@ -122,13 +122,36 @@
add-youtube.filename = pkgs.writeDash "add-youtube" ''
set -euf
if [ "$#" -ne 1 ]; then
- echo 'usage: ${name}: add-youtube $nick $channelid'
+ echo 'usage: ${name}: add-youtube $nick $channel/video/stream/id'
exit 1
fi
youtube_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
- youtube_id=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]')
+ youtube_url=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]')
+ if [ ''${#youtube_url} -eq 24 ]; then
+ youtube_id=$youtube_url
+ else
+ youtube_id=$(${pkgs.youtube-dl}/bin/youtube-dl --max-downloads 1 -j "$youtube_url" | ${pkgs.jq}/bin/jq -r '.channel_id')
+ fi
echo "brockman: add yt_$youtube_nick http://rss.r/?action=display&bridge=Youtube&context=By+channel+id&c=$youtube_id&duration_min=&duration_max=&format=Mrss"
'';
+ add-twitch.filename = pkgs.writeDash "add-twitch" ''
+ set -euf
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: ${name}: add-twitch $handle'
+ exit 1
+ fi
+ twitch_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
+ echo "brockman: add twitch_$twitch_nick http://rss.r/?action=display&bridge=Twitch&channel=$twitch_nick&type=all&format=Atom"
+ '';
+ add-twitter.filename = pkgs.writeDash "add-twitter" ''
+ set -euf
+ if [ "$#" -ne 1 ]; then
+ echo 'usage: ${name}: add-twitter $handle'
+ exit 1
+ fi
+ twitter_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
+ echo "brockman: add tw_$twitter_nick http://rss.r/?action=display&bridge=Twitch&channel=$twitter_nick&type=all&format=Atom"
+ '';
search.filename = pkgs.writeDash "search" ''
set -euf
if [ "$#" -ne 1 ]; then