Basic gauge task widget in place
authorCameron Ball <c.ball1729@gmail.com>
Sat, 6 Jun 2015 03:33:48 +0000 (11:33 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Sat, 6 Jun 2015 03:33:48 +0000 (11:33 +0800)
menu.json
menu.sh

index 1b4e23f..7e8db62 100644 (file)
--- a/menu.json
+++ b/menu.json
             "user": "itg"
           }
         }
+      },
+      "Tasks": {
+        "type": "menu",
+        "description": "Run tasks",
+        "items": {
+          "UpdateSongs": {
+            "type": "task",
+            "description": "Check for updates to ITG song list",
+            "widget": "gauge",
+            "command": "./rsync-adapter.sh -ia --delete --exclude 'A is for Cool Shit' /mnt/linkstation/Music/SkyHill /home/cameron/rsync-adapter-test",
+            "user": "itg"
+          }
+        }
       }
     }
   }
diff --git a/menu.sh b/menu.sh
index 28f377d..7bf6dd5 100755 (executable)
--- a/menu.sh
+++ b/menu.sh
@@ -133,12 +133,23 @@ function toggle_service()
        echo "Back" > "${INPUT}"
 }
 
+function run_task()
+{
+       task_command=$(get_item_key $1 command)
+       task_widget=$(get_item_key $1 widget)
+
+       $task_command | dialog --clear --backtitle "$backtitle" --title "Running $1" --gauge "Processing..." 6 50
+
+        echo "Back" > "${INPUT}"
+}
+
 function process_item()
 {
        type=$(get_item_type $1)
        case $type in
                menu) render_menu $1;;
                service) toggle_service $1;;
+               task) run_task $1;;
        esac
 }