~jadedctrl/jam-xwx-moe

~jadedctrl/jam-xwx-moe/robotoj/novaĵoj facilaj/sfeedrc
 ..
0 # This is an sfeedrc(5) configuration file for sfeed_update(1).
1
2 # The key difference is that it truncates your feed files at every update,
3 # keeping only new posts. This saves you the work of filtering out old posts.
4
5
6 # You probably want to EDIT this.
7 sfeedpath="/opt/fedbots/uea/"
8
9
10 # You probably want to EDIT this.
11 # This contains a list of all your feeds, in the format:
12 # feed NAME URL DOMAIN ENCODING
13 feeds() {
14 feed "posts" "https://uea.facila.org/rss/1-artikola-fluo.xml/" "https://uea.facila.org" "UTF-8"
15 }
16
17
18 # This overrides sfeed_update’s default merge() function.
19 # This makes it so that only new and unseen posts are put in the feed file.
20 # This is done by storing the date of the latest post in an extended attribute,
21 # for comparison during the next update..
22 merge() {
23 local oldfile="$2"
24 local newfile="$3"
25
26 local previous_max_date="$(attr -q -g sfeed_latest "$oldfile" 2> /dev/null)"
27 if test -z "$previous_max_date"; then
28 previous_max_date=0
29 fi
30
31 # Update the date of the last-processed post.
32 local latest_date="$(latest_date "$newfile")"
33 attr -qs sfeed_latest -V "$latest_date" "$oldfile" 2> /dev/null
34
35 # Output only new and unprocessed posts.
36 after_date "$newfile" "$previous_max_date"
37 }
38
39
40 # Given an sfeed file, this returns the date of the latest post (in seconds
41 # since the UNIX epoch).
42 latest_date() {
43 local file="$1"
44 awk -F '\t' \
45 '$1 > latest { latest = $1 } END { print latest }' \
46 "$file"
47 }
48
49
50 # This outputs only lines of an sfeed file with a date after the given min_date
51 # (in seconds since UNIX epoch).
52 after_date() {
53 local file="$1"
54 local min_date="$2"
55 awk -F '\t' -v min_date="$min_date" \
56 '$1 > min_date { print $0 }' \
57 "$file"
58 }