Showing 1 changed files with 27 additions and 0 deletions
+27
flightgear/fgfs_function
... ...
@@ -475,6 +475,33 @@ EOH
475 475
                                                      order by aircrafts.date desc"
476 476
                     return
477 477
                     ;;
478
+                --search-rating)
479
+                    echo 31 "cherche un appareil dans la base de données par l'évaluation" > /dev/null
480
+                    check_fgaddon || return 1
481
+                    if test -z $(sqlite3 $FGADDON/fgaddon.db <<< "select 1 from pragma_table_info('setxml')
482
+                            where name == '/sim/rating/${2:-void}'"); then
483
+                        echo "rating ${2:-void} non trouvé, ratings disponibles:"
484
+                        sqlite3 $FGADDON/fgaddon.db <<< "select name from pragma_table_info('setxml')
485
+                            where name like '/sim/rating/%'" | sed 's,/sim/rating/, - ,'
486
+                        return
487
+                    fi
488
+                    sqlite3 $FGADDON/fgaddon.db <<< "select printf('[%s, %s] %s (%s): %s ',
489
+                                                                   hangars.name,
490
+                                                                   date(aircrafts.date, 'unixepoch'),
491
+                                                                   setxml.file,
492
+                                                                   setxml.\`/sim/flight-model\`,
493
+                                                                   setxml.\`/sim/description\`)
494
+                                                     from setxml
495
+                                                     inner join aircrafts, hangars
496
+                                                     where
497
+                                                       aircrafts.hangar = hangars.id
498
+                                                     and
499
+                                                       setxml.variantof = aircrafts.id
500
+                                                     and
501
+                                                        setxml.\`/sim/rating/$2\` >= ${3:-4}
502
+                                                     order by aircrafts.date desc"
503
+                    return
504
+                    ;;
478 505
                 --mp-list)
479 506
                     echo 40 renvoie la liste des appareils visibles sur multiplayer depuis mpserver01 > /dev/null
480 507
                     local mplist=$(mktemp --dry-run /dev/shm/XXXXXXXXX)