aboutsummaryrefslogtreecommitdiff
path: root/sfeed-browser
diff options
context:
space:
mode:
Diffstat (limited to 'sfeed-browser')
-rwxr-xr-xsfeed-browser62
1 files changed, 62 insertions, 0 deletions
diff --git a/sfeed-browser b/sfeed-browser
new file mode 100755
index 0000000..be56d74
--- /dev/null
+++ b/sfeed-browser
@@ -0,0 +1,62 @@
1#!/bin/sh
2
3# This script is based on sfeed (https://codemadness.org/sfeed.html), but
4# it allows you organize your feeds in directories and subdirectories.
5# In your $sfd directory (see below) you should have two folders:
6# urls: it can contain more subfolders and files. Each file should contain
7# only one line with the url to the feed. The name of the file is the
8# name of the feed (it can contains spaces and such).
9# files: this one can be empty, it will be filled with the feed files
10# An older version of this script also marked viewed items and removed
11# them before displaying the choice of feeds. Contact me if you are interested
12# in using it.
13
14# Requires: sfeed, dmenu-file-picker (or similar), open-url (or similar)
15
16filepicker="dmenu-filepicker" # Try "nnn -p -"
17menu=${MENU:-dmenu}
18menuopts="-l 35 -i"
19urlopener=open-url
20sfd="$XDG_CONFIG_HOME/sfeed"
21showlast=10
22
23# Might add more stuff later
24fixurl() {
25 sed 's/old\.reddit\.com/reddit\.com/'
26}
27
28dirtofeedpaths() {
29 while read line; do
30 find "$line" | while read fname; do
31 [ -f "$fname" ] && echo "$fname"
32 done
33 done
34}
35
36pathstosfeedrc() {
37 printf "sfeedpath=\"$sfd/files\"\n\nfeeds() {\n"
38 while read line; do
39 feedname=$(echo "$line" | sed 's/.*\///')
40 read feedurl <"$line"
41 printf "\tfeed \"$feedname\" \"$feedurl\"\n"
42 done
43 printf "}\n"
44}
45
46feedmenu() {
47 while read line; do
48 feedname=$(echo "$line" | sed 's/.*\///')
49 sfeed_plain "$sfd/files/$feedname" | head -$showlast
50 done | $menu $menuopts
51}
52
53openfeeds() {
54 while read line; do
55 url=$(echo "$line" | sed 's/.*[\t ]//' | fixurl)
56 [ -n "$url" ] && echo $url
57 done | xargs $urlopener
58}
59
60$filepicker "$sfd/urls" | dirtofeedpaths > "$sfd/last"
61pathstosfeedrc < "$sfd/last" > "$sfd/sfeedrc"
62sfeed_update "$sfd/sfeedrc" && feedmenu < "$sfd/last" | openfeeds

Generated with cgit - Back to sebastiano.tronto.net