Updated ini to allow configuring host ip/port

This commit is contained in:
kassarole 2023-03-28 22:21:43 -04:00
parent 71c1086e05
commit 2d1f504b67
2 changed files with 12 additions and 2 deletions

View File

@ -1,2 +1,4 @@
[data]
folder_location = z:\books\
host = 127.0.0.1
port = 8080

10
gui.py
View File

@ -1,5 +1,13 @@
from nicegui import *
from bookrequest import *
import configparser
config = configparser.ConfigParser()
try:
config.read('config.ini')
except Exception as e:
print(e)
print('Config file not found. Please ensure conf.ini is in the same \
location as bookrequest.py')
def pass_command() -> None:
if title.value != '':
result = searchBook(title.value, unattended=True)
@ -7,4 +15,4 @@ def pass_command() -> None:
downloadBook(result)
with ui.card().classes('absolute-center'):
title = ui.input('Title').on('keydown.enter', pass_command)
ui.run()
ui.run(host=config['data']['host'],port=int(config['data']['port']))