1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00

Use more Python.

This commit is contained in:
Markus Birth 2017-12-17 03:18:55 +01:00
parent e56599d3b4
commit f721d2acef
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
2 changed files with 8 additions and 8 deletions

View File

@ -30,9 +30,9 @@ print(" OK")
print("List of latest FULL firmware by PRD:") print("List of latest FULL firmware by PRD:")
for prd in prds: for prd, variant in prds.items():
model = prds[prd]["variant"] model = variant["variant"]
lastver = prds[prd]["last_full"] lastver = variant["last_full"]
if prdcheck in prd: if prdcheck in prd:
try: try:
fc.reset_session() fc.reset_session()
@ -41,7 +41,7 @@ for prd in prds:
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml) curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
txt_tv = tv txt_tv = tv
if tv != lastver: if tv != lastver:
txt_tv = tcllib.ANSI_CYAN + txt_tv + tcllib.ANSI_RESET + " (OTA: {})".format(prds[prd]["last_ota"]) txt_tv = tcllib.ANSI_CYAN + txt_tv + tcllib.ANSI_RESET + " (OTA: {})".format(variant["last_ota"])
print("{}: {} {} ({})".format(prd, txt_tv, fhash, model)) print("{}: {} {} ({})".format(prd, txt_tv, fhash, model))
except RequestException as e: except RequestException as e:
print("{}: {}".format(prd, str(e))) print("{}: {}".format(prd, str(e)))

View File

@ -35,9 +35,9 @@ print(" OK")
print("List of latest OTA firmware{} by PRD:".format(force_ver_text)) print("List of latest OTA firmware{} by PRD:".format(force_ver_text))
for prd in prds: for prd, variant in prds.items():
model = prds[prd]["variant"] model = variant["variant"]
lastver = prds[prd]["last_ota"] lastver = variant["last_ota"]
if args.forcever is not None: if args.forcever is not None:
lastver = args.forcever lastver = args.forcever
if prdcheck in prd: if prdcheck in prd:
@ -47,7 +47,7 @@ for prd in prds:
fc.fv = lastver fc.fv = lastver
check_xml = fc.do_check(max_tries=20) check_xml = fc.do_check(max_tries=20)
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml) curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
versioninfo = tcllib.ANSI_CYAN_DARK + fv + tcllib.ANSI_RESET + "" + tcllib.ANSI_CYAN + tv + tcllib.ANSI_RESET + " (FULL: {})".format(prds[prd]["last_full"]) versioninfo = tcllib.ANSI_CYAN_DARK + fv + tcllib.ANSI_RESET + "" + tcllib.ANSI_CYAN + tv + tcllib.ANSI_RESET + " (FULL: {})".format(variant["last_full"])
print("{}: {} {} ({})".format(prd, versioninfo, fhash, model)) print("{}: {} {} ({})".format(prd, versioninfo, fhash, model))
except RequestException as e: except RequestException as e:
print("{} ({}): {}".format(prd, lastver, str(e))) print("{} ({}): {}".format(prd, lastver, str(e)))