Talk:CellHunter
From Openmoko
Here is my cellhunter_upload.sh script. Feel free to use/modify/delete/distribute it:
#!/bin/sh
if ! test -e "cellhunter_offline.log"; then
echo "$0: No logfile found."
exit 1
fi
add_points() {
POINTS="$((${POINTS}+$1))"
}
analyze() {
if test "$2" == "0"; then
if test "$1" == "new_gps"; then
echo -n "N"
add_points 50
elif test "$1" == "new"; then
echo -n "n"
add_points 10
elif test "$1" == "old_newgps"; then
echo -n "G"
add_points 10
elif test "$1" == "old_oldgps"; then
echo -n "g"
add_points 1
elif test "$1" == "old_oldgps_near"; then
echo -n "O"
elif test "$1" == "old"; then
echo -n "o"
else
echo -n "?($1):"
fi
else
echo -n "!($2):"
fi
}
POINTS=0
echo "$0: Loading cellgunter_offline.log..."
CELLS=`cat ${HOME}/cellhunter_offline.log`
echo -n "$0: Sending: "
for cell in ${CELLS}; do
RESULT=`wget --user-agent "cellhunter 0.5.0 offline" -q --output-document=- "${cell}" | cut -d ";" -f 1`
STATUS="$?"
analyze "${RESULT}" "${STATUS}"
done
echo ": done."
echo "$0: Removing logfile..."
rm -f ${HOME}/cellhunter_offline.log
echo "$0: New points gained: ${POINTS}"
echo "$0: Bye."
exit 0
--Quix0r 04:02, 23 December 2009 (UTC)
