Android and Linux

Sunday, February 13, 2011

Tasker/Zoom update task

I got tired of updating the beta versions of Tasker and Zoom so I made a little Task to automatically download them. In order to check if a newer version was available or if the installed version was current, I had to write a script which I've expanded to check for both versions of Tasker (market and non-market) and Zoom.
#! /system/bin/sh

case "$1" in

-z)
site=http://zoom.dinglisch.net/beta.html
file=/data/data/net.dinglisch.android.zoom/shared_prefs/state.xml

current=$(basename $(wget -q -O - $site | sed 's/\"/\n/g' | grep -m 1 '/releases/Zoom.'))
installed=Zoom.$(grep 'string name="lv"' $file | sed 's#<[^>]*>##g').apk

if echo $installed | grep -q $current
then echo "same" > /sdcard/Tasker/updater
else echo "$current" > /sdcard/Tasker/updater
fi
;;

-tm)
site=http://tasker.dinglisch.net/beta.html
file=/data/data/net.dinglisch.android.taskerm/shared_prefs/net.dinglisch.android.tasker.statey.xml

current=$(basename $(wget -q -O - $site | sed 's/\"/\n/g' | grep "http://tasker.dinglisch.net/releases" | grep m))

installed=Tasker.$(grep 'string name="lvn"' $file | sed 's#<[^>]*>##g').apk

if echo $installed | grep -q $current
then echo "same" > /sdcard/Tasker/updater
else echo "$current" > /sdcard/Tasker/updater
fi
;;

-t)
site=http://tasker.dinglisch.net/beta.html
file=/data/data/net.dinglisch.android.taskerm/shared_prefs/net.dinglisch.android.tasker.statey.xml

current=$(basename $(wget -q -O - $site | sed 's/\"/\n/g' | grep "http://tasker.dinglisch.net/releases" | grep -v m))
installed=Tasker.$(grep 'string name="lvn"' $file | sed 's#<[^>]*>##g').apk

if echo $installed | grep -q $current
then echo "same" > /sdcard/Tasker/updater
else echo "$current" > /sdcard/Tasker/updater
fi
;;

*)
echo "auto updater for Tasker/Zoom betas
-z check for Zoom update.
-t check for Tasker update, non Market version
-tm check for Tasker Market version update

This script checks the Tasker or Zoom beta website
for the newest version and writes it to a file if it's
newer than the installed version. See
http://a-more-common-hades.blogspot.com
for a Tasker task to utilize this script"
;;

esac
Then, the task to update them just needs to execute this script with one of three options.

-z check for Zoom update.
-t check for Tasker update, non Market version
-tm check for Tasker Market version update

I called the script "updateTZ" so the command I run is updateTZ -tm to check for the latest beta of the market version.

The Tasks are pretty simple but instead of pasting them here, I uploaded the two tasks to update Tasker and Zoom here at mediafire.com: http://www.mediafire.com/?fejn05a2uypvv. If you name the script anything else, or are using the non-market version of Tasker, you'll need to change the Locale Execute Plugin command accordingly.

If the currently installed version is up to date, the tasks flash "Tasker (or Zoom) is still up to date." If a new version is available, it downloads it then tries to open the downloaded file, which goes into the system install screen where you have to click "ok" to install.

Note: the current version of zoom, 1.0a8, has the wrong version information. It is still called 1.0a7 in the app so the zoom task won't currently work, it will keep seeing the app as an older version and update it.

Followers