Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os.path
- PRINTER_MODELS_DRIVERS = {
- "615": "Hasar",
- "715v1": "Hasar",
- "715v2": "Hasar",
- "320": "Hasar",
- "PT-1000F": "Hasar2Gen",
- "PT-250F": "Hasar2Gen",
- "P-HAS-5100-FAR": "Hasar2Gen",
- "epsonlx300+": "Epson",
- "tm-220-af": "Epson",
- "tm-t900fa": "Epson",
- "tickeadoras": "Epson"
- }
- PRINTER_MODELS_VENDOR = {
- "615": "Hasar",
- "715v1": "Hasar",
- "715v2": "Hasar",
- "320": "Hasar",
- "PT-1000F": "Hasar",
- "PT-250F": "Hasar",
- "P-HAS-5100-FAR": "Hasar",
- "epsonlx300+": "Epson",
- "tm-220-af": "Epson",
- "tm-t900fa": "Epson",
- "tickeadoras": "Epson"
- }
- MAX_PORTS = 8
- if __name__ == "__main__":
- config_server = "[SERVIDOR]\npuerto = 12000\ndiscover_url = \nip_privada = \nuuid = \n\n"
- config_str = "[{0}]\ndriver = {1}\nmarca = {2}\nmodelo = {3}\npath = /dev/ttyUSB{4}\n\n"
- config = ""
- for port in range(1, MAX_PORTS+1):
- for key, value in PRINTER_MODELS_DRIVERS.items():
- name = "PUERTO_" + str(port).upper() + "_" + PRINTER_MODELS_DRIVERS[key].upper() + "_" + key.upper().replace("-", "")
- driver = PRINTER_MODELS_DRIVERS[key]
- vendor = PRINTER_MODELS_VENDOR[key]
- model = key
- tty = str(port-1)
- config += config_str.format(name, driver, vendor, model, tty)
- print(config_server+config)
- config_path = '../../fiscalberry/config.ini'
- file = open(config_path, 'w')
- file.write(config_server+config)
- file.close()
- print(config_path + " updated.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement