Showing 1 changed files with 8 additions and 9 deletions
+8 -9
.fgfs/fgaddon
... ...
@@ -111,13 +111,8 @@ case ${1:-rss} in
111 111
         get_updates_from_rss () {
112 112
             wget -qO- https://sourceforge.net/p/flightgear/fgaddon/feed | while xmlgetnext; do
113 113
                 case "$TAG" in
114
-                    'lastBuildDate')
115
-                        if test ${latest_update:-0} -ge $(date +%s -d "$VALUE"); then
116
-                            echo "no new updates"
117
-                            exit
118
-                        fi
119
-                    ;;
120 114
                     'item')
115
+                        let entry++
121 116
                         unset link pubDate revision title file;;
122 117
                     'link')
123 118
                         link="$VALUE";;
... ...
@@ -126,7 +121,12 @@ case ${1:-rss} in
126 121
                     'guid isPermaLink="false"')
127 122
                         revision=$(sed -r 's,^.+/([0-9]+)/$,\1,' <<< $VALUE);;
128 123
                     'pubDate')
129
-                        pubDate=$(date +%s -d "$VALUE");;
124
+                        pubDate=$(date +%s -d "$VALUE")
125
+                        if test $entry -eq 1 -a $pubDate -eq ${latest_update:-0}; then
126
+                            echo "no new updates" >&2
127
+                            break
128
+                        fi
129
+                    ;;
130 130
                     '/item')
131 131
                         echo "checking $revision ($(date +"%d %B" -d@$pubDate)): $title" >&2
132 132
                         wget -qO- "$link" > $aircrafts
... ...
@@ -150,7 +150,7 @@ case ${1:-rss} in
150 150
         total=$(( ${#ac_list[@]} / 2 ))
151 151
         for ((i=0; i < ${#ac_list[@]}; i=i+2)); do
152 152
             ac=${ac_list[i]}
153
-            update=${ac_list[ac+1]}
153
+            update=${ac_list[i+1]}
154 154
             update_database
155 155
         done
156 156
     ;;
... ...
@@ -161,4 +161,3 @@ case ${1:-rss} in
161 161
             echo "full: updates from all repo"
162 162
     ;;
163 163
 esac
164
-