|
|
Line 1: |
Line 1: |
− | Here is my cellhunter_upload.sh script. Feel free to use/modify/delete/distribute it:
| + | There is now a downloadable package available: |
− | <pre><nowiki>#!/bin/sh
| + | http://www.opkg.org/package_324.html |
| | | |
− | if ! test -e "cellhunter_offline.log"; then
| + | Happy cell collecting! ;-) |
− | echo "$0: No logfile found."
| + | --[[User:Quix0r|Quix0r]] 00:01, 9 January 2010 (UTC) |
− | 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 cellhunter_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</nowiki></pre>
| + | |
− | --[[User:Quix0r|Quix0r]] 04:05, 23 December 2009 (UTC) | + | |