1
0
mirror of https://github.com/km4ack/patmenu2.git synced 2025-05-18 07:40:11 -07:00

add radar requests

This commit is contained in:
KM4ACK 2023-11-27 11:19:52 -06:00
parent ec7dca1b19
commit b12f2c2324

View File

@ -1,5 +1,6 @@
#function file for patmenu 2 catalog #function file for patmenu 2 catalog
#20200430 km4ack #20200430 km4ack
#27NOV2023 edit KM4ACK
MYPATH=$HOME/patmenu2 MYPATH=$HOME/patmenu2
@ -13,37 +14,7 @@ CALLSIGN=$(cat $PATCONFIG | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's
#COMPOSE EMAIL Function #COMPOSE EMAIL Function
COMPOSE () { COMPOSE () {
echo "${BODY}" | pat compose ${TO} -s "$SUBJECT"
#Count body characters
BODYCOUNT=${#BODY}
NEWCOUNT=$(expr $BODYCOUNT + 1)
#set date
TODAY=$(date '+%Y/%m/%d %H:%M')
TODAY1=$(date)
#generate 12 random number
NEW_UUID=$(cat /dev/urandom | tr -dc 'A-Z0-9' | fold -w 12 | head -n 1)
#add .b2f to end of random number for new file name
NEW_FILE=$HOME/.local/share/pat/mailbox/$CALLSIGN/out/$NEW_UUID".b2f"
#create new file
touch $NEW_FILE
#add file contents
echo "Mid: "$NEW_UUID >> $NEW_FILE
echo "Body: "$NEWCOUNT >> $NEW_FILE
echo "Content-Transfer-Encoding: 8bit" >> $NEW_FILE
echo "Content-Type: text/plain; charset=ISO-8859-1" >> $NEW_FILE
echo "Date: "$TODAY >> $NEW_FILE
echo "From: "$CALLSIGN >> $NEW_FILE
echo "Mbo: "$CALLSIGN >> $NEW_FILE
echo "Subject: "$SUBJECT >> $NEW_FILE
echo "To: "$TO >> $NEW_FILE
echo "Type: Private" >> $NEW_FILE
echo "" >> $NEW_FILE
echo $BODY >> $NEW_FILE
#give user some feedback #give user some feedback
echo "Your request has been posted to the outbox of Pat Winlink" echo "Your request has been posted to the outbox of Pat Winlink"
echo "Please go to Pat and initiate a connection to send the request" echo "Please go to Pat and initiate a connection to send the request"
@ -111,11 +82,9 @@ gpxlogger > $TMPFILE &
CGPSPID=$(echo $!) CGPSPID=$(echo $!)
sleep 2 sleep 2
kill $CGPSPID kill $CGPSPID
DATA=$(grep lat= $TMPFILE | head -1) DATA=$(grep lat= $TMPFILE | head -1)
LAT=$(echo $DATA | awk '{print $2}' | sed 's/"//g;s/lat=//') LAT=$(echo $DATA | awk '{print $2}' | sed 's/"//g;s/lat=//')
LONG=$(echo $DATA | awk '{print $3}' | sed 's/"//g;s/lon=//;s/>//') LONG=$(echo $DATA | awk '{print $3}' | sed 's/"//g;s/lon=//;s/>//')
TO="SMTP:query@saildocs.com" TO="SMTP:query@saildocs.com"
SUBJECT="<No Subject>" SUBJECT="<No Subject>"
BODY="https://forecast.weather.gov/MapClick.php?lat="$LAT"&lon="$LONG"&unit=0&lg=english&FcstType=text&TextType=1" BODY="https://forecast.weather.gov/MapClick.php?lat="$LAT"&lon="$LONG"&unit=0&lg=english&FcstType=text&TextType=1"
@ -135,8 +104,7 @@ yad --title="Search Results" --width=500 --height=500 \
CITY=$(echo $CITY | awk -F "|" '{print $2}') CITY=$(echo $CITY | awk -F "|" '{print $2}')
if [ -z "$CITY" ] if [ -z "$CITY" ]; then
then
$MAIN & $MAIN &
exit exit
fi fi
@ -147,7 +115,6 @@ BODY=$CITY
COMPOSE COMPOSE
elif [ "$WEATHER" = 'GRIB Files' ]; then elif [ "$WEATHER" = 'GRIB Files' ]; then
echo "Need GRIB Files" echo "Need GRIB Files"
FILE=/run/user/$UID FILE=/run/user/$UID
QUESTION () { QUESTION () {
@ -169,15 +136,12 @@ fi
ANS=$(echo $DEGREE | awk -F "|" '{print $1}') ANS=$(echo $DEGREE | awk -F "|" '{print $1}')
echo $ANS echo $ANS
if [ $ANS = "10" ] if [ $ANS = "10" ]; then
then
AREA=5 AREA=5
echo "aree=5" echo "aree=5"
elif [ $ANS = "6" ] elif [ $ANS = "6" ]; then
then
AREA=3 AREA=3
elif [ $ANS = "2" ] elif [ $ANS = "2" ]; then
then
AREA=1 AREA=1
fi fi
@ -202,11 +166,9 @@ yad --height=600 --width=400 --center --list --checklist --column=Request --colu
BUTTON=$? BUTTON=$?
if [ $BUTTON = "252" ] if [ $BUTTON = "252" ]; then
then
exit exit
elif [ $BUTTON = "1" ] elif [ $BUTTON = "1" ]; then
then
$MAIN & $MAIN &
exit exit
fi fi
@ -238,10 +200,6 @@ fi
exit exit
} }
POSITION(){ POSITION(){
POST=$(yad --form --width=420 --text-align=center --center --title="Position" --text-align=center \ POST=$(yad --form --width=420 --text-align=center --center --title="Position" --text-align=center \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
@ -292,8 +250,6 @@ elif [ "$REPORT" = "100 Mobile Stations" ]; then
BODY="WL2K_MOBILES" BODY="WL2K_MOBILES"
COMPOSE COMPOSE
fi fi
} }
PROPAGATION(){ PROPAGATION(){
@ -367,38 +323,57 @@ elif [ "$NEWS" = "US News" ]; then
fi fi
} }
RADAR(){
RADAR=$(yad --form --width=420 --text-align=center --center --title="Radar Reports" --text-align=center \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="<b>Radar Requests</b>" \
--field="Choose Radar":CB "Southern Miss Valley|Pacific Northwest|North Rockies|Upper Miss Valley|Central Great Lakes|Northeast|\
Pacific Southwest|Southern Rockies|Southern Plains|Southeast|National|Alaska|Hawaii|Guam|Puerto Rico" \
--button="Main Menu":1 \
--button="Continue":2)
QUIT=$?
RADAR=$(echo $RADAR | awk -F "|" '{print $1}')
TO=INQUIRY
SUBJECT=REQUEST
if [ $QUIT = 1 ]; then
$MAIN &
exit
elif [ $QUIT = 252 ]; then
exit
fi
case $RADAR in
"Southern Miss Valley")
BODY=US.RAD.SMVAL;;
"Pacific Northwest")
BODY=US.RAD.PNW;;
"North Rockies")
BODY=US.RAD.NROC;;
"Upper Miss Valley")
BODY=US.RAD.UMVAL;;
"Central Great Lakes")
BODY=US.RAD.GRLAK;;
"Northeast")
BODY=US.RAD.NEAST;;
"Pacific Southwest")
BODY=PACSW;;
"Southern Rockies")
BODY=US.RAD.SROC;;
"Southern Plains")
BODY=US.RAD.SPLA;;
"Southeast")
BODY=SEAST;;
"National")
BODY=US.RAD.CONUS;;
"Alaska")
BODY=US.RAD.ALASK;;
"Hawaii")
BODY=US.RAD.HAWAI;;
"Guam")
BODY=US.RAD.GUAM;;
"Puerto Rico")
BODY=US.RAD.PR;;
esac
COMPOSE
}