diff --git a/README.md b/README.md index 3b8c2e3..4d1a0ad 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ worked/confirmed before. To achieve this, it * determines the DX station's continent * determines if the DX station uses 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 - * 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 diff --git a/dxpager.py b/dxpager.py index 8ac5b58..d1cd42b 100755 --- a/dxpager.py +++ b/dxpager.py @@ -50,7 +50,8 @@ class DXPager(): """initialize things""" self.print_banner() - + + self.vip_calls = [] self.cache = TTLCache(maxsize=100, ttl=3600) 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: 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 def print_banner(): @@ -100,6 +104,8 @@ class DXPager(): 'port': '7373', 'user': 'N0CALL', 'timeout': '100'} + config['filter'] = { + 'vip_calls': 'DK1MI,N0CALL'} config['dapnet'] = { 'dapnet_user': 'N0CALL', 'dapnet_pass': 'xxxxxxxxxxxxxxxxxxxx', @@ -293,11 +299,21 @@ class DXPager(): "emergency": False}) cf = call_dx+freq 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 # LotW yet, the message will be sent to the dapnet API if hash_entry.hexdigest() not in self.cache.keys(): - if self.check_lotw_confirmed and self.config['lotw']['user'] != "N0CALL" \ - and cty_details[2] not in self.confirmed_entities: + if (self.check_lotw_confirmed and self.config['lotw']['user'] != "N0CALL" \ + and cty_details[2] not in self.confirmed_entities) or \ + is_vip_call: response = requests.post(self.config['dapnet']['dapnet_url'], \ data=dapnet_json, auth=HTTPBasicAuth(\ self.config['dapnet']['dapnet_user'],\