Introduction
Introduction Statistics Contact Development Disclaimer Help
sfeedmenu - sfeed-tools - Sfeed helper scripts.
git clone git://bitreich.org/sfeed-tools git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfr…
Log
Files
Refs
Tags
README
---
sfeedmenu (1231B)
---
1 #!/bin/sh
2 # sfeedmenu with filter
3 # by: eidolon
4
5 # Set environment variable SFEED_NEW_AGE in seconds to set max
6 # age of displayed feeds. Default is 24 hours, SFEED_NEW_AGE=$((3600*24…
7
8 die() {
9 printf '%s: %s\n' "${0##*/}" "$*" >&2
10 exit 1
11 }
12
13 filter() {
14 # filter read items and deduplicate items by url
15 LC_ALL=C awk -v urlfile="$urlfile" '
16 BEGIN { while (getline < urlfile > 0) r[$0] = 1 }
17 {
18 $0 = substr($0, 3)
19 match($0, /[a-z]+:\/\//)
20 url = substr($0, RSTART)
21 if (!dedup[url]++ && !r[url])
22 print
23 }'
24 }
25
26 graburl() {
27 printf '%s\n' "$1" | sed -n 's,.* \([A-Za-z]*://\)\(.*\)$,\1\2,p'
28 }
29
30 plumber=plumb
31 feeddir="$HOME/.sfeed/feeds"
32 urlfile="$HOME/.sfeed/urls"
33
34 command -v "$plumber" >/dev/null || die "$plumber not found."
35
36 [ -d "$feeddir" ] || die "$feeddir not found."
37 [ -f "$urlfile" ] || : > "$urlfile"
38
39 feeds=$(sfeed_plain "$feeddir"/* | grep '^N' | filter | sort -rn)
40 count=$(printf '%s\n' "$feeds" | wc -l | tr -d " ")
41 prompt="$count feed items:"
42
43 while IFS= read -r i
44 do
45 [ -n "$i" ] || exit 1
46 i=$(graburl "$i")
47 printf '%s\n' "$i" >> "$urlfile"
48 "$plumber" "$i"
49 done << _EOF
50 $(printf '%s\n' "$feeds" | dmenu -b -p "$prompt" -l 12)
51 _EOF
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.