56 lines
1.2 KiB
Python
56 lines
1.2 KiB
Python
import subprocess
|
|
|
|
import os
|
|
|
|
from os.path import expanduser
|
|
home = expanduser("~")
|
|
|
|
mainCategory = ""
|
|
|
|
subCategory = ""
|
|
|
|
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 == "":
|
|
try:
|
|
mainCategory = str(input("Main category of document: "))
|
|
|
|
except:
|
|
|
|
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:")
|