This repository was archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfindardop
More file actions
211 lines (182 loc) · 3.83 KB
/
findardop
File metadata and controls
211 lines (182 loc) · 3.83 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
#!/bin/bash
#20191130 km4ack
OUTFILE=$HOME/patmenu/tempardoplist.txt
CONFIG=$HOME/.wl2k/config.json
TEMP=$HOME/patmenu/tempconfig.txt
TODAY=$(date +%Y%m%d-%R)
WHO=$(whoami)
LASTDL=$(cat $HOME/patmenu/ardop-list/ardoplist.txt | head -1)
PDF_APP='evince -w'
#PDF_APP='qpdfview'
source $HOME/patmenu/config
if [ $MAP = "usa" ]
then
MAP=$HOME/patmenu/grid-map.pdf
else
MAP=$HOME/patmenu/worldgridmap.pdf
fi
PS3="Please choose an option "
print_header () {
echo 'Call Grid Dist Azmuth Dial Freq Center Freq Shortcut'
echo '======================================================================================================='
}
MENU3 () {
echo;echo
MENU=("Change Band/Grid" "Add to Alias" "Quit")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"Change Band/Grid")
clear
MENU2
;;
"Add to Alias")
read -p "Which call would you like to add? " CALL
ADDALIAS
;;
"Quit")
rm $OUTFILE
exit 0
;;
*) echo "invalid option $REPLY";;
esac
done
}
MENU2 () {
MENU=("Change Grid" "20M" "30M" "40M" "80M" "Main Menu")
ARDOPLIST=$HOME/patmenu/ardop-list
echo;echo
printf "\033[1;31mGrid to be searched is $GRID\033[0m\n"
echo;echo "Now choose the band to search"
select ITEM in "${MENU[@]}"
do
case $ITEM in
"Change Grid")
read -p "Enter new grid to search " GRID
GRID=$(echo "${GRID^^}")
clear
MENU2
;;
"20M")
clear
BAND=20
FILE=$ARDOPLIST/20mardoplist.txt
echo;echo;
print_header
cat $FILE | egrep -i $GRID[[:digit:]]{2} | tee "$OUTFILE"
MENU3
;;
"30M")
clear
BAND=30
FILE=$ARDOPLIST/30mardoplist.txt
echo;echo;
print_header
cat $FILE | egrep -i $GRID[[:digit:]]{2} | tee "$OUTFILE"
MENU3
;;
"40M")
clear
BAND=40
FILE=$ARDOPLIST/40mardoplist.txt
echo;echo;
print_header
cat $FILE | egrep -i $GRID[[:digit:]]{2} | tee "$OUTFILE"
MENU3
;;
"80M")
clear
BAND=80
FILE=$ARDOPLIST/80mardoplist.txt
echo;echo;
print_header
cat $FILE | egrep -i $GRID[[:digit:]]{2} | tee "$OUTFILE"
MENU3
;;
"Main Menu")
MAIN
;;
*) echo "invalid option $REPLY";;
esac
done
}
MAIN () {
clear;echo;echo "Find Ardop by KM4ACK";echo
echo $LASTDL;echo
printf "\033[1;31mFor Best View, Maximize This Screen\033[0m\n";echo
echo "Set the grid to be searched. Refer to the map if needed.";echo
MENU=("Set Grid" "View Map" "Download List" "Set Auto Download" "Quit")
select ITEM in "${MENU[@]}"
do
case $ITEM in
"Set Grid")
read -p "Please enter first 2 letters of grid to search " GRID
GRID=$(echo "${GRID^^}")
echo;echo;clear
MENU2
;;
"View Map")
echo "Opening Map"
$PDF_APP $MAP > /dev/null 2>&1
MAIN
;;
"Download List")
$HOME/patmenu/getardoplist
LASTDL=$(cat $HOME/patmenu/ardop-list/ardoplist.txt | head -1)
MAIN
;;
"Set Auto Download")
$HOME/patmenu/auto-download
MAIN
;;
"Quit")
exit 0
;;
*) echo "invalid option $REPLY";;
esac
done
}
ADDALIAS () {
cp $CONFIG $CONFIG.$TODAY.bkup
RESULT=$(cat $OUTFILE | grep -i $CALL)
if [ -z "$RESULT" ]
then
echo;echo;echo "Sorry, nothing matches your search"
else
echo;echo $RESULT
echo;echo;read -p "Would you like to add this station to your alias list? y/n " ANS
if [ $ANS == 'y' ] || [ $ANS == 'Y' ]
then
NAME=$(echo $RESULT | awk '{ print $1 }')
if [ $RIGCONTROL = 'yes' ]
then
SC=$(echo $RESULT | awk '{ print $11 }')
else
SC=$(echo $RESULT | awk '{ print $11 }' | sed 's/[?].*$//')
fi
FREQ=$(echo $SC | sed 's/.*=//')
jq '.connect_aliases += {'\""$NAME-$BAND"M"-$FREQ"\"' : '\"$SC\"'}' $CONFIG > $TEMP
cp $TEMP $CONFIG
sudo killall pat
sudo systemctl start pat@$WHO
echo "Your alias list has been updated"
read -p "Would you like to add another? y/n " ANS
if [ $ANS == 'y' ] || [ $ANS == 'Y' ]
then
clear;echo;echo
print_header
cat $OUTFILE
read -p "Which call would you like to add? " CALL
ADDALIAS
fi
rm $TEMP $OUTFILE
sleep 2
MAIN
else
echo;echo; "Nothing was modded"
sleep 2
MAIN
fi
fi
}
MAIN