User friendliness
authorCameron Ball <c.ball1729@gmail.com>
Thu, 11 Jun 2015 03:17:08 +0000 (11:17 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Thu, 11 Jun 2015 03:17:08 +0000 (11:17 +0800)
cache-update-confirmation-adapter.sh [new file with mode: 0755]
menu.json
menu.sh

diff --git a/cache-update-confirmation-adapter.sh b/cache-update-confirmation-adapter.sh
new file mode 100755 (executable)
index 0000000..809c6d0
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+#
+# widget:      msgbox
+# description: Displays the number of updated simfiles
+
+num=$(wc -l < /tmp/newsongs.txt)
+rm /tmp/newsongs.txt
+
+if [[ $num -gt 0 ]]; then
+       echo "$num New/updated simfiles"
+else
+       echo "No new/updated simfiles"
+fi
index afb6d39..a51772f 100644 (file)
--- a/menu.json
+++ b/menu.json
                {
                        "command": "./cache-update-adapter.sh -d /mnt/linkstation/Test/itg/Cache/Songs/",
                        "title": "Updating cache..."
+               },
+               {
+                       "command": "./cache-update-confirmation-adapter.sh",
+                       "title": "Songs updated"
                }
            ],
             "user": "itg"
diff --git a/menu.sh b/menu.sh
index 7985ce2..8a0d4b1 100755 (executable)
--- a/menu.sh
+++ b/menu.sh
@@ -180,19 +180,12 @@ function run_task()
                                command="$(get_value_from_key $key)"
                                title=$(get_value_from_key "${key%.*}.title")
 
-                               #todo: check exit status and display an error message if one
-                               #command fails (and break the loop)
                                case "$widget" in
                                        gauge) eval "$command" | dialog --clear --backtitle "$backtitle" --title "Running $1" --gauge "$title" 6 50;;
+                                       msgbox) eval "$command" | dialog --clear --backtitle "$backtitle" --title "Running $1" --msgbox "$title" 6 50;;
                                esac
                        fi
                 fi
-
-               #todo: Figure out a nice way to display a success message that can be customised
-               #for example after updating the songlist it would be nice for it to say how many
-               #song were updated
-               #
-               #Perhaps the easiest way is just to add another task (i.e., write another script) to do that?
         done <<< "$menu_json"
 
         echo "Back" > "${INPUT}"