From ec22e689fe40990651b79fcaa727e532c4b88eb6 Mon Sep 17 00:00:00 2001 From: Michael Clemens Date: Thu, 19 May 2022 15:59:26 +0200 Subject: [PATCH] added banner bugfixes --- colorspot.py | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/colorspot.py b/colorspot.py index 0c7e1d1..0e4be51 100755 --- a/colorspot.py +++ b/colorspot.py @@ -1,4 +1,10 @@ #!/usr/bin/env python3 + + +# Infos on colors: https://pypi.org/project/colored/ +# Country list extracted from http://www.arrl.org/files/file/dxcclist.txt + + import sys import csv import re @@ -9,6 +15,7 @@ from telnetlib import Telnet from colored import fg, bg, attr import configparser from collections import defaultdict +import random class ColorSpot(): @@ -21,7 +28,24 @@ class ColorSpot(): self.qsl_countries = self.get_confirmed_countries() - + self.print_banner() + + @staticmethod + def rnd_col(): + r = lambda: random.randint(0,255) + return'#%02X%02X%02X' % (r(),r(),r()) + + + def print_banner(self): + """print an awesome banner""" + ver = self.version + # print the banner + print(fg(self.rnd_col())+" ___ _ ___ _ ") + print(fg(self.rnd_col())+" / __|___| |___ _ _/ __|_ __ ___| |_ ") + print(fg(self.rnd_col())+" | (__/ _ \ / _ \ '_\__ \ '_ \/ _ \ _|") + print(fg(self.rnd_col())+" \___\___/_\___/_| |___/ .__/\___/\__|") + print(fg(self.rnd_col())+" -= DK1MI =- |_| ") + print(attr('reset')) @staticmethod def read_config(config, file_name): @@ -55,9 +79,9 @@ class ColorSpot(): 'alert_fg': 'white', 'default_bg': 'black'} config['cont_colors'] = { - "AF": "dark_orange_3b", + "AF": "light_salmon_3b", "AN": "white", - "AS": "red", + "AS": "orange_red_1", "EU": "cyan", "NA": "steel_blue_3", "OC": "orchid", @@ -68,8 +92,9 @@ class ColorSpot(): 'alert_bg': 'indian_red_1a', 'alert_fg': 'white', 'default_bg': 'black'} - config['aliases'] = { - 'fed. rep. of germany': 'federal republic of germany'} + config['alias']= { + 'Asiatic Russia': 'Russia', + 'European Russia': 'Russia'} config['dxcc'] = { "1A": "Sov. Mil. Order of Malta,EU", "3A": "Monaco,EU", @@ -732,6 +757,8 @@ class ColorSpot(): for row in file: if re.search("COUNTRY", row): country = row.partition(">")[2].lower().rstrip() + if country in self.config['alias']: + country = self.config['alias'][country] if country not in ret: ret.append(country) return ret @@ -814,7 +841,7 @@ class ColorSpot(): except AttributeError: print(line) elif "login: " in line: - print(line) + print(fg("grey_27") + line + attr("reset")) ##################################################### # Main Routine #