-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.py
277 lines (249 loc) · 12.3 KB
/
params.py
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
#! /usr/bin/python3 -u
################################################################################
#
# Params.py - Rev 1.0
# Copyright (C) 2021-4 by Joseph B. Attili, aa2il AT arrl DOT net
#
# Command line param parser for bandmap
#
################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
################################################################################
import sys
import os
import argparse
from collections import OrderedDict
from rig_io import CONNECTIONS,RIGS
from settings import *
################################################################################
# Sometimes when these don't work, its bx the login handshaking needs some work
NODES=OrderedDict()
#NODES['PY3NZ'] = 'dxc.baependi.com.br:8000' # dxwatch.com - down?
#NODES['NK7Z'] = 'nk7z-cluster.ddns.net:7373' # Lots of spots! - down?
NODES['NC7J'] = 'dxc.nc7j.com:7373' # OK - AR cluster
NODES['W3LPL'] = 'w3lpl.net:7373' # Ok - lots of spots, no FT8 dxc.w3lpl.net
#telnet telnet.reversebeacon.net 7000
#telnet telnet.reversebeacon.net 7001
NODES['RBN'] = 'telnet.reversebeacon.net:7000' # RBN - 7000 for CW & RTTY, 7001 for ft8
NODES['AE5E'] = 'dxspots.com' #
NODES['VE7CC'] = 'dxc.ve7cc.net' #
NODES['W9PA'] = 'dxc.w9pa.net:7373' # Ok - lots of spots, no FT8 dxc.w3lpl.net
NODES['WC2L'] = 'dxc.wc2l.com' #
NODES['K3LR'] = 'dx.k3lr.com' #
NODES['WS7I'] = 'ws7i.ewarg.org:7300' # OK - need to work on filtering - uses "non AR" cluster, can show FT8
NODES['W8AEF'] = 'paul.w8aef.com:7373' # AZ - no FT8 - can turn it on
NODES['N6WS'] = 'n6ws.no-ip.org:7300' # Ok
NODES['K1TTT'] = 'k1ttt.net:7373' # (Peru, MA); Skimmer capable
NODES['W6RFU'] = 'ucsbdx.ece.ucsb.edu:7300' # Ok - CQ Zones 1-5 spots only (i.e. US & Canada)
NODES['AE5E'] = 'dxspots.com' # Ok - not many spots
NODES['N4DEN'] = 'dxc.n4den.us:7373' # Ok
NODES['W6KK'] = 'w6kk.zapto.org:7300' # Ok - USA and VE spots only, not many spots
NODES['N7OD'] = 'n7od.pentux.net' # Ok
NODES['WC4J'] = 'dxc.wc4j.net' # Doesnt work
NODES['WA9PIE'] = 'dxc.wa9pie.net:8000' # HRD
NODES['K2LS'] = 'dxc.k2ls.com' # CQ Zones 1-8 spots only (i.e. NA) - not sure how to log in
NODES['W6CUA'] = 'w6cua.no-ip.org:7300' # Not sure how to log on?
NODES['K7EK'] = 'www.k7ek.net:9000' # Doesn't work?
NODES['K6EXO'] = 'k6exo.dyndns.org:7300' # Doesn't work?
NODES['N6WS'] = 'n6ws.no-ip.org:7300' # Not sure how to log on?
NODES['N7OD'] = 'n7od.pentux.net' # Not sure how to log on?
NODES['ANY'] = ''
NODES['NONE'] = ''
################################################################################
# Structure to contain processing params
class PARAMS:
def __init__(self):
# Process command line args
# Can add required=True to anything that is required
arg_proc = argparse.ArgumentParser()
arg_proc.add_argument('-contest', action='store_true',help='Conest Mode')
arg_proc.add_argument('-ss', action='store_true',help='ARRL Sweepstakes')
arg_proc.add_argument('-echo', action='store_true',help='Echo lines from server')
arg_proc.add_argument("-rig", help="Connection Type to Rig",
type=str,default=["NONE"],nargs='+',
choices=CONNECTIONS+['NONE']+RIGS)
arg_proc.add_argument("-port", help="TCPIP port",
type=int,default=0)
arg_proc.add_argument("-cluster", help="Server",
type=str,default="ANY",
choices=list(NODES.keys()) )
arg_proc.add_argument("-wsjt", help="wsjt", nargs='*',
type=str,default=None)
arg_proc.add_argument("-log", help="Log file (keep track of dupes)",
type=str,
default=None)
#default=None,nargs='*')
#default="~/logs/[MYCALL].adif")
#default="") #,nargs='+')
arg_proc.add_argument('-dx_only', action='store_true',
help='Show only DX spots')
arg_proc.add_argument('-nodupes', action='store_true',
help='Dont show dupes')
arg_proc.add_argument("-modes", help="Show only these modes",
type=str,default='ANY',nargs='*')
arg_proc.add_argument('-na_only', action='store_true',
help='Show only spots from North America')
arg_proc.add_argument('-buttons', action='store_true',
help='Enable band buttons')
arg_proc.add_argument('-bm_udp', action='store_true',
help='Start UDP client')
arg_proc.add_argument('-save', action='store_true',
help='Save All Spots')
arg_proc.add_argument('-cwops', action='store_true',
help='Highlight CWops Members')
arg_proc.add_argument('-show_mode', action='store_true',
help='Show mode needs')
arg_proc.add_argument('-show_year', action='store_true',
help='Show dxcc needs for this year')
arg_proc.add_argument('-ft4', action='store_true',
help='Use FT4 freqs instead of FT8')
arg_proc.add_argument('-small', action='store_true',
help='Use small font')
arg_proc.add_argument('-center', action='store_true',
help='Keep list centered on rig freq')
arg_proc.add_argument("-vfo", help="VFO to follow",
type=str,default="A",
choices=['A','B'] )
#arg_proc.add_argument('-noft8', action='store_true',help='Filter out FT8 spots')
arg_proc.add_argument('-bm_geo',type=str,default=None,
help='Geometry')
arg_proc.add_argument('-test', action='store_true',help='Test Mode')
arg_proc.add_argument("-hours", help="Max no. hours for a dupe",
type=float,default=2*24)
arg_proc.add_argument("-age", help="Max no. minutes to keep a spot around",
type=int,default=None)
arg_proc.add_argument('-desktop',type=int,default=None,
help='Desk Top Work Space No.')
arg_proc.add_argument("-debug", help="Debug Level",
type=int,default=0)
args = arg_proc.parse_args()
self.CONNECTION = args.rig[0]
if len(args.rig)>=2:
self.RIG = args.rig[1]
else:
self.RIG = None
self.PORT = args.port
self.MAX_HOURS_DUPE = args.hours
self.CONTEST_MODE = args.contest
self.DESKTOP = args.desktop
self.SMALL_FONT = args.small or self.CONTEST_MODE
self.STAND_ALONE = True
self.BM_GEO = args.bm_geo
self.TEST_MODE = args.test
self.CW_SS = args.ss
self.CWOPS = args.cwops
self.DX_ONLY = args.dx_only
self.NA_ONLY = args.na_only
self.NEW_CWOPS_ONLY = False
self.BM_UDP_CLIENT = args.bm_udp
self.SAVE_SPOTS = args.save
self.RIG_VFO = args.vfo
self.FT4 = args.ft4
self.DEBUG = args.debug
self.SHOW_NEED_MODE = args.show_mode
self.SHOW_NEED_YEAR = args.show_year
self.SHOW_DUPES = not args.nodupes
self.GUI_BAND = None
self.GUI_MODE = None
valid_modes=['CW','RTTY','DIGI','PH']
if type(args.modes) is list:
self.SHOW_MODES = args.modes
elif args.modes=='ANY':
self.SHOW_MODES = valid_modes
else:
self.SHOW_MODES = [args.modes]
for m in self.SHOW_MODES:
if m not in valid_modes:
print('PARAMS ERROR - Unrecognized mode:',m,'\nValid modes are',valid_modes)
sys.exit(0)
# See http://www.ng3k.com/misc/cluster.html for a list
self.SERVER=args.cluster.upper()
self.WSJT_FNAME=None
self.WSJT_IP_ADDRESS = '127.0.0.1'
self.WSJT_PORT = 2237
WSJT2=args.wsjt
if WSJT2!=None:
print("\nWSJT2=",WSJT2,len(WSJT2))
self.WSJT_FNAME=os.path.expanduser("~/.local/share/WSJT-X")
self.WSJT_FNAME+=" - "+WSJT2[0]
self.WSJT_FNAME+="/ALL.TXT"
self.CLUSTER='WSJT'
self.SERVER='WSJT'
if len(WSJT2)>=2:
self.WSJT_PORT = int(WSJT2[1])
print("WSJT_FNAME=", self.WSJT_FNAME)
print("WSJT_PORT =", self.WSJT_IP_ADDRESS,self.WSJT_PORT)
#sys.exit(0)
else:
self.CLUSTER=NODES[self.SERVER]
#print('CLUSTER=',CLUSTER)
if args.log==None:
if args.wsjt==None:
#self.LOG_NAME = "~/logs/[MYCALL].adif"
self.LOG_NAME = "~/[OPERATOR]/[MYCALL].adif"
#self.LOG_NAME = "~/logs/[OPERATOR].adif"
else:
self.LOG_NAME = "~/.local/share/WSJT-X"
if WSJT2!=None:
self.LOG_NAME+=" - "+WSJT2[0]
self.LOG_NAME += "/wsjtx_log.adi"
else:
self.LOG_NAME = args.log
if False:
#print(len(args.log))
print(args.log)
print(WSJT2)
print(self.SERVER)
print(self.LOG_NAME)
sys,exit(0)
self.ECHO_ON=args.echo
if args.age:
self.MAX_AGE=args.age
elif self.CLUSTER=='WSJT':
self.MAX_AGE=4 # Was 5
else:
self.MAX_AGE=5 # Was 10
self.rootlogger = "dxcsucker"
self.TIME_OUT=.01
# Read config file
self.SETTINGS,self.RCFILE = read_settings('.keyerrc')
self.MY_CALL = self.SETTINGS['MY_CALL']
self.OPERATOR = self.SETTINGS['MY_OPERATOR']
self.LOG_NAME = self.LOG_NAME.replace('[OPERATOR]',self.OPERATOR)
if self.OPERATOR!=self.MY_CALL:
self.LOG_NAME0 = os.path.expanduser( self.LOG_NAME.replace('[MYCALL]',self.OPERATOR ) )
else:
self.LOG_NAME0 = None
MY_CALL2 = self.MY_CALL.replace('/','_')
self.LOG_NAME = os.path.expanduser( self.LOG_NAME.replace('[MYCALL]',MY_CALL2 ) )
self.NODES = NODES
self.threads = []
print('LOG_NAME=',self.LOG_NAME,'\tSTAND_ALONE=',self.STAND_ALONE)
if self.SERVER=="WSJT" or args.buttons:
self.ALLOW_CHANGES=True
else:
self.ALLOW_CHANGES=False
# The spreadsheets with the DXCC already worked data & node info
#MY_CALL3 = self.MY_CALL.split('/')[0]
MY_CALL3 = self.OPERATOR.split('/')[0]
self.DATA_DIR = os.path.expanduser('~/'+MY_CALL3+'/')
self.CHALLENGE_FNAME = self.DATA_DIR+'/states.xls'
if not os.path.isfile(self.CHALLENGE_FNAME):
self.CHALLENGE_FNAME = 'states.xls'
if not os.path.isfile(self.CHALLENGE_FNAME):
self.CHALLENGE_FNAME = None
self.NODES_FNAME = self.DATA_DIR+'/states.xls'
if not os.path.isfile(self.NODES_FNAME):
self.NODES_FNAME = 'nodes.xls'
self.KEEP_FREQ_CENTERED=args.center
self.RIGHT_CLICK_TUNES_VFOB = self.SERVER!="WSJT"