simple trss rss reader coming soon(tm)
This commit is contained in:
parent
ca434c3e7a
commit
d89220e326
1
Makefile
1
Makefile
|
@ -11,6 +11,7 @@ man:
|
|||
sh:
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/paste $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/trss $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/disp $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/wallpaper $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f sh/yt $(DESTDIR)$(PREFIX)/bin
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
# get configuration & data directories
|
||||
DATA="$HOME/.cache/trss"
|
||||
CONFIG="$HOME/.config/trss"
|
||||
|
||||
# make sure these directories are in place
|
||||
mkdir -p "$DATA"
|
||||
mkdir -p "$CONFIG"
|
||||
|
||||
import_information () {
|
||||
FEEDS=""
|
||||
for i in "$CONFIG"/*; do
|
||||
. "$i"
|
||||
[ -z "$FEEDS" ] && FEEDS="$NAME" || FEEDS="$FEEDS $NAME"
|
||||
done
|
||||
}
|
||||
|
||||
synchronize () {
|
||||
for i in $FEEDS; do
|
||||
url="$(get_feed_attr "$i" feed)"
|
||||
printf "> synchronizing feed %s via url %s\n" "$i" "$url"
|
||||
curl "$url" -so "$DATA/${i}.xml"
|
||||
|
||||
# generate sfeed formatted file
|
||||
printf "> creating sfeed compound feed file for feed %s\n" "$i"
|
||||
cat "$DATA/${i}.xml" | sfeed | cat - "$DATA/${i}.sfeed" | uniq >> "$DATA/${i}.tmp.sfeed"
|
||||
mv "$DATA/${i}.tmp.sfeed" "${DATA}/${i}.sfeed"
|
||||
done
|
||||
}
|
||||
|
||||
get_feed_attr () {
|
||||
eval "printf '%s' \${$1_$2}"
|
||||
}
|
||||
|
||||
import_information
|
||||
synchronize
|
||||
printf "%s\n" "$FEEDS"
|
||||
get_feed_attr seirdy humanname
|
Loading…
Reference in New Issue