summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/2configs')
-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