Talk:CellHunter
From Openmoko
(Difference between revisions)
(Initial creation with my cellhunter_upload.sh script) |
(Total points added) |
||
Line 43: | Line 43: | ||
echo -n "$0: Sending: " | echo -n "$0: Sending: " | ||
for cell in ${CELLS}; do | for cell in ${CELLS}; do | ||
− | + | RESPONSE=`wget --user-agent "cellhunter 0.5.0 offline" -q --output-document=- "${cell}"` | |
+ | RESULT=`echo "${RESPONSE}" | cut -d ";" -f 1` | ||
+ | TOTAL_POINTS=`echo "${RESPONSE}" | cut -d ";" -f 6` | ||
STATUS="$?" | STATUS="$?" | ||
analyze "${RESULT}" "${STATUS}" | analyze "${RESULT}" "${STATUS}" | ||
Line 53: | Line 55: | ||
echo "$0: New points gained: ${POINTS}" | echo "$0: New points gained: ${POINTS}" | ||
+ | echo "$0: Total points: ${TOTAL_POINTS}" | ||
echo "$0: Bye." | echo "$0: Bye." | ||
exit 0</nowiki></pre> | exit 0</nowiki></pre> | ||
− | --[[User:Quix0r|Quix0r]] 04: | + | --[[User:Quix0r|Quix0r]] 04:05, 23 December 2009 (UTC) |
Revision as of 06:05, 23 December 2009
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 RESPONSE=`wget --user-agent "cellhunter 0.5.0 offline" -q --output-document=- "${cell}"` RESULT=`echo "${RESPONSE}" | cut -d ";" -f 1` TOTAL_POINTS=`echo "${RESPONSE}" | cut -d ";" -f 6` 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: Total points: ${TOTAL_POINTS}" echo "$0: Bye." exit 0
--Quix0r 04:05, 23 December 2009 (UTC)