mirror of
https://codeberg.org/mclemens/dxpager.git
synced 2024-09-28 20:26:07 -04:00
added a VIP call list. All spots of those calls will be notified
This commit is contained in:
parent
b5606ec7d7
commit
c9189c7102
@ -8,8 +8,9 @@ worked/confirmed before. To achieve this, it
|
|||||||
* determines the DX station's continent
|
* determines the DX station's continent
|
||||||
* determines if the DX station uses LotW
|
* determines if the DX station uses LotW
|
||||||
* determines if the DX station's country has been confirmed via LotW
|
* determines if the DX station's country has been confirmed via LotW
|
||||||
|
* checks if the DX call is in your VIP call list
|
||||||
* de-duplicates spots
|
* de-duplicates spots
|
||||||
* and finally - if it's a new DXCC - sends the information to your dapnet pager
|
* and finally - if it's a new DXCC or a watchlist triggered - sends the information to your dapnet pager
|
||||||
|
|
||||||
# Limitations
|
# Limitations
|
||||||
|
|
||||||
|
22
dxpager.py
22
dxpager.py
@ -50,7 +50,8 @@ class DXPager():
|
|||||||
"""initialize things"""
|
"""initialize things"""
|
||||||
|
|
||||||
self.print_banner()
|
self.print_banner()
|
||||||
|
|
||||||
|
self.vip_calls = []
|
||||||
|
|
||||||
self.cache = TTLCache(maxsize=100, ttl=3600)
|
self.cache = TTLCache(maxsize=100, ttl=3600)
|
||||||
self.config = configparser.ConfigParser()
|
self.config = configparser.ConfigParser()
|
||||||
@ -74,6 +75,9 @@ class DXPager():
|
|||||||
with open(self.config_dir + self.config['files']['lotw_activity'], encoding='us-ascii') as csvfile:
|
with open(self.config_dir + self.config['files']['lotw_activity'], encoding='us-ascii') as csvfile:
|
||||||
self.lotw_activity = list(csv.reader(csvfile, delimiter=','))
|
self.lotw_activity = list(csv.reader(csvfile, delimiter=','))
|
||||||
|
|
||||||
|
if self.config['filter'] and self.config['filter']['vip_calls']:
|
||||||
|
self.vip_calls = self.config['filter']['vip_calls'].split(',')
|
||||||
|
print(self.vip_calls)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def print_banner():
|
def print_banner():
|
||||||
@ -100,6 +104,8 @@ class DXPager():
|
|||||||
'port': '7373',
|
'port': '7373',
|
||||||
'user': 'N0CALL',
|
'user': 'N0CALL',
|
||||||
'timeout': '100'}
|
'timeout': '100'}
|
||||||
|
config['filter'] = {
|
||||||
|
'vip_calls': 'DK1MI,N0CALL'}
|
||||||
config['dapnet'] = {
|
config['dapnet'] = {
|
||||||
'dapnet_user': 'N0CALL',
|
'dapnet_user': 'N0CALL',
|
||||||
'dapnet_pass': 'xxxxxxxxxxxxxxxxxxxx',
|
'dapnet_pass': 'xxxxxxxxxxxxxxxxxxxx',
|
||||||
@ -293,11 +299,21 @@ class DXPager():
|
|||||||
"emergency": False})
|
"emergency": False})
|
||||||
cf = call_dx+freq
|
cf = call_dx+freq
|
||||||
hash_entry = hashlib.md5(cf.encode())
|
hash_entry = hashlib.md5(cf.encode())
|
||||||
|
|
||||||
|
# check if the DX call is in your VIP call list.
|
||||||
|
# Call sign addition like /P will be ignored
|
||||||
|
is_vip_call = False
|
||||||
|
my_regex = r"(^.*\/)?" + re.escape(call_dx) + r"(\/.*?)?$"
|
||||||
|
for vip in self.vip_calls:
|
||||||
|
if re.search(my_regex, vip, re.IGNORECASE):
|
||||||
|
is_vip_call = True
|
||||||
|
|
||||||
# If the DX station's entity hasn't been worked/confirmed via
|
# If the DX station's entity hasn't been worked/confirmed via
|
||||||
# LotW yet, the message will be sent to the dapnet API
|
# LotW yet, the message will be sent to the dapnet API
|
||||||
if hash_entry.hexdigest() not in self.cache.keys():
|
if hash_entry.hexdigest() not in self.cache.keys():
|
||||||
if self.check_lotw_confirmed and self.config['lotw']['user'] != "N0CALL" \
|
if (self.check_lotw_confirmed and self.config['lotw']['user'] != "N0CALL" \
|
||||||
and cty_details[2] not in self.confirmed_entities:
|
and cty_details[2] not in self.confirmed_entities) or \
|
||||||
|
is_vip_call:
|
||||||
response = requests.post(self.config['dapnet']['dapnet_url'], \
|
response = requests.post(self.config['dapnet']['dapnet_url'], \
|
||||||
data=dapnet_json, auth=HTTPBasicAuth(\
|
data=dapnet_json, auth=HTTPBasicAuth(\
|
||||||
self.config['dapnet']['dapnet_user'],\
|
self.config['dapnet']['dapnet_user'],\
|
||||||
|
Loading…
Reference in New Issue
Block a user