forked from km4ack/pi-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog
More file actions
286 lines (266 loc) · 5.92 KB
/
catalog
File metadata and controls
286 lines (266 loc) · 5.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#!/bin/bash
#script to post WL2K catalog requests to pat winlink
#20191110 KM4ACK
#verify the city weather list exist
FILE=weather.txt
if [ -f $FILE ]; then
echo ""
else
echo "The weather reference file needs to be downloaded"
echo "This only occurs on the first run"
read -n 1 -s -r -p "Press any key to download"
wget https://raw.githubusercontent.com/km4ack/pi-scripts/master/pat/weather.txt
fi
#get callsign from pat config file
CALLSIGN=$(cat $HOME/.wl2k/config.json | grep -m 1 mycall | sed 's/\"mycall\": \"//' | sed 's/\",//' | sed -e 's/^\s*//')
PS3='Please enter your choice: '
#COMPOSE EMAIL Function
COMPOSE () {
#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/.wl2k/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
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"
read -n 1 -s -r -p "Press any key to continue"
exit 0
}
#GATEWAY Menu Function
GATEWAYS () {
clear;echo;echo;echo;
echo "Gateway List Request"
echo
MENU=("ARDOP List" "Packet List" "Main Menu")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"ARDOP List")
#ARDOP STATION REQUEST
TO="INQUIRY"
SUBJECT="REQUEST"
BODY="PUB_ARDOP"
COMPOSE
;;
"Packet List")
#PACKET STATION REQUEST
TO="INQUIRY"
SUBJECT="REQUEST"
BODY="PUB_PACKET"
COMPOSE
;;
"Main Menu")
MAIN-MENU
;;
*) echo "invalid option $REPLY";;
esac
done
}
#news Menu Function
NEWS () {
clear;echo;echo;echo;
echo "News Request"
echo
MENU=("Reuters Daily" "Reuters Market" "Reuters Money" "Reuters US News" "Main Menu")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"Reuters Daily")
#daily
TO="SMTP:query@saildocs.com"
SUBJECT="subject"
BODY="send Reuters-Daily-News"
COMPOSE
;;
"Reuters Market")
#market
TO="SMTP:query@saildocs.com"
SUBJECT="subject"
BODY="send Reuters-Market"
COMPOSE
;;
"Reuters Money")
#money
TO="SMTP:query@saildocs.com"
SUBJECT="subject"
BODY="send Reuters-Money"
COMPOSE
;;
"Reuters US News")
#us news
TO="SMTP:query@saildocs.com"
SUBJECT="subject"
BODY="send Reuters-US-News"
COMPOSE
;;
"Main Menu")
MAIN-MENU
;;
*) echo "invalid option $REPLY";;
esac
done
}
#WEATHER Menu Function
WEATHER () {
clear;echo;echo;echo
echo "Weather Report Request"
echo
MENU=("GPS Weather" "City Weather" "Main Menu")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"GPS Weather")
echo "Standby please"
GPSDATA=$(gpspipe -r -n 10 | grep GPGGA)
LAT=$(echo $GPSDATA | awk -F"," '{ print $3 }'| sed 's/\.//' | sed 's/./&./2')
LON=$(echo $GPSDATA | awk -F"," '{ print $5 }'| sed 's/\.//' | sed 's/./&./3')
TO="SMTP:query@saildocs.com"
SUBJECT="<No Subject>"
BODY="https://forecast.weather.gov/MapClick.php?lat="$LAT"&lon=-"$LON"&unit=0&lg=english&FcstType=text&TextType=1"
COMPOSE
;;
"City Weather")
echo;echo;
echo "You will need to know the area ID"
echo "you wish to see the forecast for."
echo "Area ID is left column of following table."
echo
echo "Use the space bar to scroll through"
echo "the table one screen at a time and note"
echo "the area ID you wish to use."
echo
read -n 1 -s -r -p "Press any key to continue"
clear
cat $HOME/patmenu/weather.txt | column -s ',' -t | more
echo;echo;echo;
echo "What is the area ID you would like to request? "
read CITY
if [ -z $CITY ]
then
echo "Area ID cannot be blank. Try again"
exit 0
fi
TO="INQUIRY"
SUBJECT="REQUEST"
BODY=$CITY
COMPOSE
;;
"Main Menu")
MAIN-MENU
;;
*) echo "invalid option $REPLY";;
esac
done
}
#Postitions Request Function
POSITIONS () {
clear;echo;echo;echo
echo "Position Report Request"
echo
MENU=("Single Station" "All Nearby" "Main Menu")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"Single Station")
TO="QTH"
SUBJECT="POSITION REQUEST"
echo "Which call sign would you like the position for?"
echo "Only one call sign may be entered"
read CALL
BODY=$CALL
COMPOSE
;;
"All Nearby")
TO="INQUIRY"
SUBJECT="REQUEST"
BODY="WL2K_NEARBY"
COMPOSE
;;
"Main Menu")
MAIN-MENU
;;
*) echo "invalid option $REPLY";;
esac
done
}
#Propagation Request Function
PROPAGATION () {
clear;echo;echo;echo
echo "Propagation Report Request"
echo
MENU=("3 Day Prop" "Daily WWV Report" "Main Menu")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"3 Day Prop")
TO="INQUIRY"
SUBJECT="REQUEST"
BODY="PROP_3DAY"
COMPOSE
;;
"Daily WWV Report")
TO="INQUIRY"
SUBJECT="REQUEST"
BODY="PROP_WWV"
COMPOSE
;;
"Main Menu")
MAIN-MENU
;;
*) echo "invalid option $REPLY";;
esac
done
}
MAIN-MENU () {
clear;echo;echo;echo
echo "Winlink Catalog Script by KM4ACK"
echo
MENU=("Gateway List" "Weather" "Position Reports" "Propagation" "News" "Exit")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"Gateway List")
GATEWAYS
;;
"Weather")
WEATHER
;;
"Position Reports")
POSITIONS
;;
"Propagation")
PROPAGATION
;;
"News")
NEWS
;;
"Exit")
exit 0
;;
*) echo "invalid option $REPLY";;
esac
done
}
#call main menu
MAIN-MENU