added lookup of latest lotw upload date
This commit is contained in:
parent
5d5cdbb1bf
commit
7fdb54aac7
15
qrz.sh
15
qrz.sh
@ -40,7 +40,7 @@ session_xml=$(curl -s -X GET 'http://xmldata.qrz.com/xml/current/?username='${us
|
|||||||
|
|
||||||
# check for login errors
|
# check for login errors
|
||||||
#e=$(printf %s "$session_xml" | grep -oP "(?<=<Error>).*?(?=</Error>)" ) # only works with GNU grep
|
#e=$(printf %s "$session_xml" | grep -oP "(?<=<Error>).*?(?=</Error>)" ) # only works with GNU grep
|
||||||
e=$(printf %s "$session_xml" | awk -v FS="(<Error>|<\/Error>)" '{print $2}' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
e=$(printf %s "$session_xml" | awk -v FS="(<Error>|<\/Error>)" '{print $2}' 2>/dev/null | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
||||||
if [ "$e" != "" ]
|
if [ "$e" != "" ]
|
||||||
then
|
then
|
||||||
echo "The following error has occured: $e"
|
echo "The following error has occured: $e"
|
||||||
@ -49,14 +49,14 @@ if [ "$e" != "" ]
|
|||||||
|
|
||||||
# extract session key from response
|
# extract session key from response
|
||||||
#session_key=$(printf %s "$session_xml" |grep -oP '(?<=<Key>).*?(?=</Key>)') # only works with GNU grep
|
#session_key=$(printf %s "$session_xml" |grep -oP '(?<=<Key>).*?(?=</Key>)') # only works with GNU grep
|
||||||
session_key=$(printf %s "$session_xml" | awk -v FS="(<Key>|<\/Key>)" '{print $2}' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
session_key=$(printf %s "$session_xml" | awk -v FS="(<Key>|<\/Key>)" '{print $2}' 2>/dev/null | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
||||||
|
|
||||||
# lookup callsign at qrz.com
|
# lookup callsign at qrz.com
|
||||||
lookup_result=$(curl -s -X GET 'http://xmldata.qrz.com/xml/current/?s='${session_key}';callsign='${call}'')
|
lookup_result=$(curl -s -X GET 'http://xmldata.qrz.com/xml/current/?s='${session_key}';callsign='${call}'')
|
||||||
|
|
||||||
# check for login errors
|
# check for login errors
|
||||||
#e=$(printf %s "$lookup_result" | grep -oP "(?<=<Error>).*?(?=</Error>)" ) # only works with GNU grep
|
#e=$(printf %s "$lookup_result" | grep -oP "(?<=<Error>).*?(?=</Error>)" ) # only works with GNU grep
|
||||||
e=$(printf %s "$lookup_result" | awk -v FS="(<Error>|<\/Error>)" '{print $2}' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
e=$(printf %s "$lookup_result" | awk -v FS="(<Error>|<\/Error>)" '{print $2}' 2>/dev/null | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
||||||
if [ "$e" != "" ]
|
if [ "$e" != "" ]
|
||||||
then
|
then
|
||||||
echo "$e"
|
echo "$e"
|
||||||
@ -67,7 +67,7 @@ if [ "$e" != "" ]
|
|||||||
for f in "call" "fname" "name" "addr1" "addr2" "country" "grid" "email" "user" "lotw" "mqsl" "eqsl" "qslmgr"
|
for f in "call" "fname" "name" "addr1" "addr2" "country" "grid" "email" "user" "lotw" "mqsl" "eqsl" "qslmgr"
|
||||||
do
|
do
|
||||||
#z=$(printf %s "$lookup_result" | grep -oP "(?<=<${f}>).*?(?=</${f}>)" ) # only works with GNU grep
|
#z=$(printf %s "$lookup_result" | grep -oP "(?<=<${f}>).*?(?=</${f}>)" ) # only works with GNU grep
|
||||||
z=$(printf %s "$lookup_result" | awk -v FS="(<${f}>|<\/${f}>)" '{print $2}' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
z=$(printf %s "$lookup_result" | awk -v FS="(<${f}>|<\/${f}>)" '{print $2}' 2>/dev/null | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
|
||||||
eval "$f='${z}'";
|
eval "$f='${z}'";
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -97,7 +97,12 @@ if [ "$eqsl" == "1" ]
|
|||||||
fi
|
fi
|
||||||
if [ "$lotw" == "1" ]
|
if [ "$lotw" == "1" ]
|
||||||
then
|
then
|
||||||
echo "LoTW: yes"
|
lotwdate=$(curl -s https://lotw.arrl.org/lotw-user-activity.csv | grep -i $call | cut -d ',' -f 2)
|
||||||
|
if [ "$lotwdate" != "" ]
|
||||||
|
then
|
||||||
|
lotwdate="(last uploaded: $lotwdate)"
|
||||||
|
fi
|
||||||
|
echo "LoTW: yes $lotwdate"
|
||||||
fi
|
fi
|
||||||
if [ "$mqsl" == "1" ]
|
if [ "$mqsl" == "1" ]
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user