citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit db6696ffea1d622e74aa76ef8a792a1689959a14
parent 5e2a829f4401b3fc7f732302836730141e1e027e
Author: William Casarin <jb55@jb55.com>
Date:   Tue,  4 Jan 2022 10:59:49 -0800

rssbin updates

Diffstat:
Mbin/fuzz-rss | 15++++++++++++++-
Mbin/rss | 4++--
Mbin/rssfeed | 28++++++++++++++++++++++++----
Mbin/rssfeeds | 6+++---
4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/bin/fuzz-rss b/bin/fuzz-rss @@ -1,3 +1,16 @@ #!/usr/bin/env bash set -eou pipefail -echo open "$(rss)" + +filter=${1:-"cat"} + +res=$(<~/var/rss.tsv eval "$filter" | rss) +link=$(awkp 1 <<<"$res") +typ=$(awkp 2 <<<"$res") + +opener="open" + +if [[ $typ =~ "@blog" ]]; then + opener="plainweb" +fi + +echo $opener $link diff --git a/bin/rss b/bin/rss @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -eou pipefail -<~/var/rss.tsv datefmt '%m-%d' | +datefmt '%m-%d' | fzf --tac --no-sort | -cutt -f4 +cutt -f4,5 diff --git a/bin/rssfeed b/bin/rssfeed @@ -8,6 +8,27 @@ if [ -z "$1" ]; then fi name=${2:-feed} +typ=${3:-type} + +if [ "$typ" = "@blog" ] || [ "$typ" = "@busy" ] +then + +link=$(cat <<EOF +(.comments | strings) // +(.link | strings) // +(.enclosure | objects | ."@url") // +EOF +) + +else + +link=$(cat <<EOF +(.enclosure | objects | ."@url") // +(.link | strings) // +EOF +) + +fi jqs=$(cat <<EOF def month_to_num: @@ -33,21 +54,20 @@ def parse_date: | "\(.year)-\(.month | month_to_num)-\(.day)T\(.h):\(.m):\(.s)Z" | fromdateiso8601) // - (.published | strings | sub(".00:00$"; "Z") | fromdateiso8601) + ((.published // ."dc:date") | strings | sub(".00:00$"; "Z") | fromdateiso8601) ; def parse_url: . | objects | - (.enclosure | objects | ."@url") // - (.link | strings) // + $link (.link | objects | ."@href") ; (.rss.channel.item // .feed.entry) | .[] | -[(. | parse_date), "$name", .title, (. | parse_url)] | +[(. | parse_date), "$name", .title, (. | parse_url), "$typ"] | @tsv EOF ) diff --git a/bin/rssfeeds b/bin/rssfeeds @@ -4,6 +4,6 @@ set -eou pipefail ( while IFS=$'\t' read -r name type url do - echo rssfeed "$url" "$name" -done < ~/dotfiles/rssfeeds -) | parallel | sort -n > ~/var/rss.tsv + echo rssfeed "$url" "$name" "$type" +done +) < ~/dotfiles/rssfeeds | parallel | sort -n > ~/var/rss.tsv