exit 1
fi
+[[ ! -d "$cache_dir" ]] && echo 100 && exit 0
+
num=$(wc -l < /tmp/newsongs.txt)
num_processed=0
# description: Displays the number of updated simfiles
num=$(wc -l < /tmp/newsongs.txt)
-rm /tmp/newsongs.txt
+#rm /tmp/newsongs.txt
if [[ $num -gt 0 ]]; then
echo "$num New/updated simfiles"
"ITG": {
"type": "service",
"description": "Start/Stop the ITG service",
- "command": "/home/cameron/OpenITG/itg",
+ "command": "/home/cameron/Games/OpenITG/openitg-beta-2",
"user": "itg"
},
"gEdit": {
"description": "Update the ITG song list",
"commands": [
{
- "command": "./rsync-adapter.sh -ia --delete --exclude 'A is for Cool Shit' /mnt/linkstation/Test/Songs /mnt/linkstation/Test/itg",
+ "command": "./rsync-adapter.sh -ia --delete --exclude 'A is for Cool Shit' /home/cameron/PreComTestRepo/Songs /home/cameron/Games/OpenITG",
"title": "Syncing songs..."
},
{
- "command": "./cache-update-adapter.sh -d /mnt/linkstation/Test/itg/Cache/Songs/",
+ "command": "./cache-update-adapter.sh -d /home/cameron/Games/OpenITG/Cache/Songs/",
"title": "Updating cache..."
},
{
"user": "itg"
}
}
+ },
+ "Presets": {
+ "type": "menu",
+ "description": "Run presets",
+ "items": {
+ "SyncAndLaunch": {
+ "type": "preset",
+ "description": "Sync songs and launch ITG",
+ "itemsToRun": [
+ "Tasks.UpdateSongs",
+ "Services.ITG"
+ ]
+ }
+ }
}
}
}
menu_json="$(./JSON.sh -l < menu.json)"
current_item="MainMenu"
backtitle="DivinElegy PreCom"
-box_width=50
-box_height=15
+box_width=70
+box_height=30
function debug()
{
#Also cracks the shits without quotes.
#Also don't know why.
- dialog --clear --backtitle "$backtitle" --title "${1//./>}" --menu "$(get_item_description $1)" "$box_height" "$box_width" 4 "${options[@]}" 2>"${INPUT}"
+ dialog --clear --backtitle "$backtitle" --title "${1//./>}" --nocancel --menu "$(get_item_description $1)" "$box_height" "$box_width" 4 "${options[@]}" 2>"${INPUT}"
}
function toggle_service()
title=$(get_value_from_key "${key%.*}.title")
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;;
+ gauge) eval "$command" | dialog --clear --backtitle "$backtitle" --title "Running $1" --gauge "$title" "$box_height" "$box_width";;
+ msgbox) eval "$command" | dialog --clear --backtitle "$backtitle" --title "$title" --msgbox "$(eval \"$command\")" "$box_height" "$box_width";;
esac
fi
fi
# description: Modifies rsync's output to be used
# with dialog's --progress option
+#XXX: Some versions of rsync say to-chk instead of to-check, be careful
rsync --progress "$@" | tee >(grep -v "*deleting" | grep -i ".sm" > /tmp/newsongs.txt) | mawk -Winteractive '{ if (index($0, "to-check=") > 0) { split($0, pieces, "to-check="); split(pieces[2], term, ")"); split(term[1], division, "/"); print (1-(division[1]/division[2]))*100 } }' \
| sed --unbuffered 's/\([0-9]*\).*/\1/'