Read the printer URI from a file; added more checks for input validation.
This commit is contained in:
parent
f3835dbb63
commit
cf080cce1d
32
main.py
32
main.py
@ -12,14 +12,44 @@ subCategory = ""
|
|||||||
pageNumber = -1
|
pageNumber = -1
|
||||||
|
|
||||||
|
|
||||||
|
#Try to get the URI of the printer at the file in ~/.local/share/scan-auto/printer_uri
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
f = open(home+"/.local/share/scan-auto/printer_uri", "r")
|
||||||
|
print(f.readline())
|
||||||
|
|
||||||
|
printerURI = f.readline()
|
||||||
|
except:
|
||||||
|
print("Please create a file at " + home + "/.local/share/scan-auto/printer_uri")
|
||||||
|
|
||||||
|
print("And populate it with the hp-probe URI of your printer, e.g: escl:https://192.168.X.XX:443")
|
||||||
|
|
||||||
|
exit()
|
||||||
|
|
||||||
while mainCategory == "":
|
while mainCategory == "":
|
||||||
try:
|
try:
|
||||||
mainCategory = str(input("Main Category Of Document: "))
|
mainCategory = str(input("Main category of document: "))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
|
||||||
mainCategory = ""
|
mainCategory = ""
|
||||||
|
|
||||||
if mainCategory == "":
|
if mainCategory == "":
|
||||||
|
#Not best way to do this, but it's a small script, so idc :shrug:
|
||||||
|
os.system("clear")
|
||||||
|
print("Invalid input, please try again:")
|
||||||
|
|
||||||
|
|
||||||
|
while subCategory == "":
|
||||||
|
try:
|
||||||
|
subCategory = str(input("Subcategory of document: "))
|
||||||
|
|
||||||
|
except:
|
||||||
|
|
||||||
|
subCategory = ""
|
||||||
|
|
||||||
|
if subCategory == "":
|
||||||
|
#Not best way to do this, but it's a small script, so idc :shrug:
|
||||||
|
os.system("clear")
|
||||||
|
print("Invalid input, please try again:")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user