Merge branch 'master' of ssh://kuschel.at:21861/public/scripts
This commit is contained in:
commit
73a989e4a4
@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
__version__ = '1.0.0'
|
||||
__website__ = 'https://www.fb.gv.at/Funk/amateurfunkdienst.html'
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import mariadb
|
||||
@ -9,9 +12,7 @@ import pypdf
|
||||
from pypdf import PdfReader
|
||||
import re # regular expression
|
||||
import datetime
|
||||
|
||||
__version__ = '1.0.0'
|
||||
__website__ = 'https://www.fb.gv.at/Funk/amateurfunkdienst.html'
|
||||
import configparser
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
@ -20,6 +21,18 @@ from selenium.webdriver.chrome.service import Service as ChromiumService
|
||||
def call_description():
|
||||
print(f'Download and Parse the Austrian Callbook Version {__version__}')
|
||||
|
||||
def call_configparser():
|
||||
config = configparser.ConfigParser()
|
||||
config['MARIADB'] = {
|
||||
'db_user': 'om',
|
||||
'db_password': 'oe3tkt',
|
||||
'db_host': '127.0.0.1',
|
||||
'db_port': 3306,
|
||||
'db_database': 'callbook'
|
||||
}
|
||||
with open(get_active_path('config.ini'), 'w') as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
def call_parser():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Download and Parse the Austrian Callbook',
|
||||
@ -155,12 +168,15 @@ def gender_substring(path, search_substring, verbose=0):
|
||||
|
||||
gender_substring.lines = None
|
||||
|
||||
def get_active_path(file)
|
||||
return os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
|
||||
|
||||
def get_gender(firstnames, surname, call, verbose=0):
|
||||
|
||||
# load the .gender file:
|
||||
genderfile = '.gender'
|
||||
gender = 'x'
|
||||
gpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), genderfile)
|
||||
gpath = get_active_path(genderfile)
|
||||
if os.path.exists(gpath):
|
||||
firstname = firstnames.split(' ', 1)[0]
|
||||
gender = gender_substring(gpath, firstname, verbose=0) # only check 1st/firstname of name, important when there are more than 1 firstnames
|
||||
@ -423,6 +439,7 @@ def exec_sql_file(cursor, sql_file):
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = call_parser()
|
||||
config = call_configparser()
|
||||
try:
|
||||
filename = call_website(**vars(args))
|
||||
if args.verbose > 1:
|
||||
|
7
config.ini
Normal file
7
config.ini
Normal file
@ -0,0 +1,7 @@
|
||||
[MARIADB]
|
||||
db_user = om
|
||||
db_password = oe3tkt
|
||||
db_host = 127.0.0.1
|
||||
db_port = 3306
|
||||
db_database = callbook
|
||||
|
Loading…
Reference in New Issue
Block a user