ADD .typo_call e.g. OE-7RLJ instead of OE7RLJ
This commit is contained in:
parent
301e80afa7
commit
3f223b399e
@ -1,11 +1,17 @@
|
||||
2000 Stockerau|Grillparzerstraße#Stockerau#Grillparzergasse
|
||||
2000 Stockerau|Grillparzergasse
|
||||
2123 Unterolberndf.|Sdlg.Rosenbergen#Unterolberndorf#Siedlung Rosenbergen
|
||||
2136 Laa/Thaya|Teichgasse#Laa an der Thaya
|
||||
2221 Groß Schweinbarth|Matzner Straße#Groß-Schweinbarth#Matznerstraße
|
||||
2345 Brunn/Gebirge#Brunn am Gebirge
|
||||
2431 Kleinneusiedl
|
||||
2560 Berndorf
|
||||
2563 Pottenstein
|
||||
3100 St Pölten|Widerinstraße#St. Pölten
|
||||
3372 Blindenmarkt
|
||||
3620 Spitz/Donau|Gaertnerweg#Spitz an der Donau#Gärtnerweg
|
||||
3813 Dietmanns
|
||||
3843 Dobersberg|Merkengersch
|
||||
3871 Nagelberg|Alt-Nagelberg#Alt-Nagelberg
|
||||
4020 Linz|Humboldtstraße
|
||||
4871 Pfaffing|Tiefenbach
|
||||
|
2
afu/.typo_call
Normal file
2
afu/.typo_call
Normal file
@ -0,0 +1,2 @@
|
||||
# TYPO CALL - 2024-07-04 Version 1.0.0
|
||||
OE-7RLJ OE7RLJ
|
@ -65,7 +65,7 @@ def call_parser():
|
||||
parser.add_argument('-V', '--version', action='version', version='{} {}'.format(os.path.split(__file__)[1],__version__))
|
||||
parser.add_argument('-v', '--verbose', action='append_const', const = 1)
|
||||
# Rufzeichenliste_AT_Stand_010624.pdf
|
||||
parser.add_argument('-p', '--path', default='Rufzeichenliste_AT_Stand_010624.pdf', help= 'skip the download if the specified path to a PDF file exists')
|
||||
parser.add_argument('-p', '--path', default='', help= 'skip the download if the specified path to a PDF file exists')
|
||||
# parser.add_argument('-t', '--type', default='' , help='specify the output, supported types are [ CSV | JSON ]') # not implemented yet
|
||||
parser.add_argument('-o', '--output', default='', help='specify the file where the data are written to, default stdout')
|
||||
parser.add_argument('-m', '--mariadb', help='SQL interface to MariaDB (MySql) format "<IP-Address>:<Port> <User> <Passwd>" or defined in .config')
|
||||
@ -78,14 +78,12 @@ def call_parser():
|
||||
return opt
|
||||
|
||||
def call_website(url,verbose,path='',interactive=False,output='',mariadb=''):
|
||||
|
||||
if path:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
else:
|
||||
print(f'The given path "{path}" does not exist.')
|
||||
sys.exit(3)
|
||||
|
||||
if(interactive):
|
||||
print('Interactive')
|
||||
driver=webdriver.Chrome()
|
||||
@ -144,7 +142,6 @@ def is_clubstation(call):
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def replace_substring_with_line(path, search_substring, verbose=0):
|
||||
|
||||
try:
|
||||
@ -199,6 +196,7 @@ def get_gender(firstnames, surname, call, verbose=0):
|
||||
if verbose > 0:
|
||||
get_gender.cnt += 1
|
||||
print(f'({get_gender.cnt}){call} "{firstname}" [{firstnames} {surname}] not found in file {genderfile} - gender "x" is set.')
|
||||
|
||||
return gender
|
||||
|
||||
get_gender.cnt = 0
|
||||
@ -251,9 +249,33 @@ def call_split_name(fullname, call, verbose):
|
||||
|
||||
return firstname, surname, gender
|
||||
|
||||
def fix_call(call,verbose=1):
|
||||
fixfile = '.typo_call'
|
||||
path = get_active_path(fixfile)
|
||||
if os.path.exists(path):
|
||||
if not fix_call.lines:
|
||||
with open(path,'r') as file:
|
||||
fix_call.lines = file.readlines()
|
||||
if verbose > 0:
|
||||
print(f'File "{fixfile}":')
|
||||
for line in fix_call.lines:
|
||||
print(f'>> {line.rstrip()}')
|
||||
print('>> ** EOF **')
|
||||
for line in fix_call.lines[1:]: # starting with line 1
|
||||
words = line.rstrip().split()
|
||||
if len(words) != 2:
|
||||
continue
|
||||
if words[0] == call:
|
||||
if verbose > 0:
|
||||
print(f'Corr typo call: {words[0]} => {words[1]}')
|
||||
return words[1]
|
||||
|
||||
return call
|
||||
fix_call.lines = None
|
||||
|
||||
def fix_typo(call, fullname, verbose=1):
|
||||
fixtypofile = '.typo_callbook'
|
||||
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), fixtypofile)
|
||||
path = get_active_path(fixtypofile)
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
if not fix_typo.lines:
|
||||
@ -539,6 +561,7 @@ def call_data_record(line, mod_date, verbose, cur):
|
||||
assert(len(records) == 5)
|
||||
# OE Call:
|
||||
call = records[0]
|
||||
call = fix_call(call,verbose)
|
||||
match = re.search(r'^(OE[0-9][A-Z]{1,3})', call)
|
||||
assert(match.string == call)
|
||||
fullname = records[1]
|
||||
@ -645,6 +668,7 @@ def exec_sql_file(cursor, sql_file):
|
||||
statement = ''
|
||||
else:
|
||||
statement += line
|
||||
|
||||
except FileNotFoundError:
|
||||
print(f'The file {path} was not found.')
|
||||
except Exception as e:
|
||||
@ -674,6 +698,7 @@ def call_create_database(configdb):
|
||||
conn.close()
|
||||
sys.exit(5)
|
||||
cur.execute('USE ' + database)
|
||||
|
||||
return conn
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user