mirror of
https://github.com/Ircama/epson_print_conf.git
synced 2025-05-23 19:47:00 -04:00
Fix waste counter conversion for some printers
This commit is contained in:
parent
54e9362422
commit
f14cd91b8e
2 changed files with 11 additions and 13 deletions
|
@ -218,8 +218,8 @@ The `-m` option is optional and is used to filter the printer model in scope. If
|
||||||
Program usage:
|
Program usage:
|
||||||
|
|
||||||
```
|
```
|
||||||
parse_devices.py [-h] [-m PRINTER_MODEL] [-l LINE_LENGTH] [-i] [-d] [-t] [-v] [-f] [-e] [-c CONFIG_FILE] [-s DEFAULT_MODEL] -a HOSTNAME [-p PICKLE_FILE] [-I]
|
parse_devices.py [-h] [-m PRINTER_MODEL] [-l LINE_LENGTH] [-i] [-d] [-t] [-v] [-f] [-e] [-c CONFIG_FILE]
|
||||||
[-N] [-A] [-S]
|
[-s DEFAULT_MODEL] [-a HOSTNAME] [-p PICKLE_FILE] [-I] [-N] [-A] [-S]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
|
|
|
@ -170,20 +170,19 @@ def generate_config(config, traverse, add_fatal_errors, full, printer_model):
|
||||||
for ncounter in counter:
|
for ncounter in counter:
|
||||||
if ncounter.tag == "entry":
|
if ncounter.tag == "entry":
|
||||||
if "oids" in waste:
|
if "oids" in waste:
|
||||||
waste["oids"] += text_to_bytes(
|
waste["oids"] += text_to_bytes(ncounter.text)
|
||||||
ncounter.text
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
waste["oids"] = text_to_bytes(
|
waste["oids"] = text_to_bytes(ncounter.text)
|
||||||
ncounter.text
|
|
||||||
)
|
|
||||||
if ncounter.tag == "max":
|
if ncounter.tag == "max":
|
||||||
waste["divider"] = (
|
waste["divider"] = int(ncounter.text) / 100
|
||||||
int(ncounter.text) / 100
|
|
||||||
)
|
|
||||||
if full:
|
if full:
|
||||||
for filter in ncounter:
|
for filter in ncounter:
|
||||||
waste["filter"] = filter.text
|
waste["filter"] = filter.text
|
||||||
|
if counter.text:
|
||||||
|
if "oids" in waste:
|
||||||
|
waste["oids"] += text_to_bytes(counter.text)
|
||||||
|
else:
|
||||||
|
waste["oids"] = text_to_bytes(counter.text)
|
||||||
chars[waste_string[count]] = waste
|
chars[waste_string[count]] = waste
|
||||||
count += 1
|
count += 1
|
||||||
if item.tag == "serial":
|
if item.tag == "serial":
|
||||||
|
@ -389,8 +388,7 @@ if __name__ == "__main__":
|
||||||
'--address',
|
'--address',
|
||||||
dest='hostname',
|
dest='hostname',
|
||||||
action="store",
|
action="store",
|
||||||
help='Default printer host name or IP address. (Example: -a 192.168.1.87)',
|
help='Default printer host name or IP address. (Example: -a 192.168.1.87)'
|
||||||
required=True
|
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p',
|
'-p',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue