diff options
-rw-r--r-- | odin/strm/rss_staggered | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/odin/strm/rss_staggered b/odin/strm/rss_staggered index 54bbd1a3..c5198a25 100644 --- a/odin/strm/rss_staggered +++ b/odin/strm/rss_staggered | |||
@@ -7,8 +7,13 @@ staggerFile=~/.rss-stagger | |||
7 | 7 | ||
8 | [[ "${FLOCKER}" != "$0" ]] && exec env FLOCKER="$0" flock -x "${staggerFile}" "$0" "$@" || : | 8 | [[ "${FLOCKER}" != "$0" ]] && exec env FLOCKER="$0" flock -x "${staggerFile}" "$0" "$@" || : |
9 | 9 | ||
10 | feeds=$(@rss2email@/bin/r2e list | awk -F ':' 'END { print $1; }') | 10 | typeset -A feeds |
11 | max=$(($feeds + 1)) | 11 | r2e list | while read num junk name junk; do |
12 | num=${num%:} | ||
13 | feeds[${num}]=${name} | ||
14 | done | ||
15 | |||
16 | max=$(($#feeds)) | ||
12 | num=$(((max * delta_t) / interval)) | 17 | num=$(((max * delta_t) / interval)) |
13 | [[ $num -lt 1 ]] && num=1 | 18 | [[ $num -lt 1 ]] && num=1 |
14 | 19 | ||
@@ -17,6 +22,7 @@ now=$((now % max)) | |||
17 | 22 | ||
18 | typeset -a run | 23 | typeset -a run |
19 | run=() | 24 | run=() |
25 | |||
20 | typeset -a names | 26 | typeset -a names |
21 | names=() | 27 | names=() |
22 | 28 | ||
@@ -25,8 +31,11 @@ n=0 | |||
25 | for i in $(seq $((now + 1)) $((now + num + 1))); do | 31 | for i in $(seq $((now + 1)) $((now + num + 1))); do |
26 | n=$((i % max)) | 32 | n=$((i % max)) |
27 | run+=$n | 33 | run+=$n |
34 | names+=$feeds[${n}] | ||
28 | done | 35 | done |
29 | 36 | ||
30 | echo $n >! ${staggerFile} | 37 | echo $n >! ${staggerFile} |
31 | 38 | ||
39 | print ${names} | ||
40 | |||
32 | exec @rss2email@/bin/r2e run $run | 41 | exec @rss2email@/bin/r2e run $run |