Showing 1 changed files with 16 additions and 10 deletions
+16 -10
.fgfs/fgfs_function
... ...
@@ -231,26 +231,32 @@ function fgfs () {
231 231
                     telnet mpserver01.flightgear.org 5001 2>/dev/null > $mplist
232 232
                     grep 'pilot(s) online' $mplist
233 233
                     echo
234
-                    for model in $(awk '/@/{a[$NF]++}END{for (i in a) print i}' $mplist); do
235
-                        if test -r $FGADDON/$model \
236
-                             -o -r $FGDIR/source/fgdata/$model; then
237
-                            installed_model[${${(s:/:)model}[2]}]=1
238
-                        elif test -r $FGDIR/source/fgdata/AI/$model; then
239
-                            installed_model[*${${(s:/:)model}[2]}]=1
234
+                    local IFS=$'\n'
235
+                    for model in $(awk '/@/{a[$NF]++}END{for (i in a) printf("%s (%i)\n", i, a[i])}' $mplist); do
236
+                        if test -r $FGADDON/${model% *} \
237
+                             -o -r $FGDIR/source/fgdata/${model% *}; then
238
+
239
+                            ((++installed_model[${${(s:/:)model}[2]} ${model#* }]))
240
+
241
+                        elif test -r $FGDIR/source/fgdata/AI/${model% *}; then
242
+
243
+                            ((++installed_model[*${${(s:/:)model}[2]} ${model#* }]))
244
+
240 245
                         elif test -n "$(command -v sqlite3)" -a -r $FGADDON/fgaddon.db; then
241 246
                             ac_name=$(sqlite3 $FGADDON/fgaddon.db <<< 'select     printf("%s/%s", aircrafts.name, setxml.file)
242 247
                                                                        from       aircrafts
243 248
                                                                        inner join setxml
244 249
                                                                        where      aircrafts.id = setxml.variantof
245
-                                                                       and        setxml.`/sim/model/path` = "'$model'"
250
+                                                                       and        setxml.`/sim/model/path` = "'${model% *}'"
246 251
                                                                        limit      1')
247 252
                             if test -n "$ac_name"; then
248
-                                fgaddon_model[${ac_name}]=1
253
+                                ((++fgaddon_model[${ac_name} ${model#* }]))
249 254
                             else
250
-                                unknown_model[${model}]=1
255
+                                ((++unknown_model[${model}]))
251 256
                             fi
257
+
252 258
                         else
253
-                            unknown_model[${model}]=1
259
+                            ((++unknown_model[${model}]))
254 260
                         fi
255 261
                     done
256 262
                     if test ${#installed_model[@]} -gt 0; then