1
0
mirror of https://github.com/km4ack/patmenu2.git synced 2025-05-16 14:50:13 -07:00

add radar requests

This commit is contained in:
KM4ACK 2023-11-27 11:02:18 -06:00
parent ca9c2914c1
commit 68c231c1b2

View File

@ -13,37 +13,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"
@ -122,10 +92,7 @@ LONG=$(echo $DATA | awk '{print $3}' | sed 's/"//g;s/lon=//;s/>//')
COMPOSE COMPOSE
elif [ "$WEATHER" = 'City Weather' ]; then elif [ "$WEATHER" = 'City Weather' ]; then
FILE=$MYPATH/weather.txt FILE=$MYPATH/weather.txt
PARSER='OFS="\n" {print $1, $2, $3}' PARSER='OFS="\n" {print $1, $2, $3}'
CITY=$(tail -76 $FILE | awk "$PARSER" | \ CITY=$(tail -76 $FILE | awk "$PARSER" | \
yad --title="Search Results" --width=500 --height=500 \ yad --title="Search Results" --width=500 --height=500 \
--image $LOGO --window-icon=$LOGO --image-on-top \ --image $LOGO --window-icon=$LOGO --image-on-top \
@ -135,8 +102,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,10 +113,8 @@ 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(){
DEGREE=$(yad --center --wrap --width=350 --title="Auto Download" --text-align=center \ DEGREE=$(yad --center --wrap --width=350 --title="Auto Download" --text-align=center \
--text="How many degrees would you like" \ --text="How many degrees would you like" \
--form --separator="|" --item-separator="|" \ --form --separator="|" --item-separator="|" \
@ -169,15 +133,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 +163,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
@ -289,8 +248,6 @@ elif [ "$REPORT" = "100 Mobile Stations" ]; then
BODY="WL2K_MOBILES" BODY="WL2K_MOBILES"
COMPOSE COMPOSE
fi fi
} }
PROPAGATION(){ PROPAGATION(){
@ -364,32 +321,60 @@ 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
}