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

Converted tclcheck_allfull.py to new style.

This commit is contained in:
Markus Birth 2018-02-09 00:17:43 +01:00
parent 784a511708
commit fdcc16a293
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A

View File

@ -7,8 +7,6 @@
import sys import sys
from requests.exceptions import RequestException
import tcllib import tcllib
import tcllib.argparser import tcllib.argparser
from tcllib import ansi, devlist from tcllib import ansi, devlist
@ -17,7 +15,6 @@ from tcllib.requests import RequestRunner, CheckRequest, ServerVoteSelector, wri
dev = DesktopDevice() dev = DesktopDevice()
fc = tcllib.FotaCheck()
dpdesc = """ dpdesc = """
Checks for the latest FULL updates for all PRD numbers or only for Checks for the latest FULL updates for all PRD numbers or only for
@ -34,27 +31,30 @@ prds = devlist.get_devicelist()
print("List of latest FULL firmware by PRD:") print("List of latest FULL firmware by PRD:")
runner = RequestRunner(ServerVoteSelector())
runner.max_tries = 20
for prd, variant in prds.items(): for prd, variant in prds.items():
model = variant["variant"] model = variant["variant"]
lastver = variant["last_full"] lastver = variant["last_full"]
if prdcheck in prd: if not prdcheck in prd:
try: continue
dev.curef = prd dev.curef = prd
fc.reset_session(dev) chk = CheckRequest(dev)
check_xml = fc.do_check(dev, max_tries=20) runner.run(chk)
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml) if chk.success:
txt_tv = tv result = chk.get_result()
if tv != lastver: txt_tv = result.tvver
txt_tv = "{} (old: {} / OTA: {})".format( if result.tvver != lastver:
ansi.CYAN + txt_tv + ansi.RESET, txt_tv = "{} (old: {} / OTA: {})".format(
ansi.CYAN_DARK + variant["last_full"] + ansi.RESET, ansi.CYAN + txt_tv + ansi.RESET,
variant["last_ota"] ansi.CYAN_DARK + variant["last_full"] + ansi.RESET,
) variant["last_ota"]
else: )
fc.delete_last_dump() else:
print("{}: {} {} ({})".format(prd, txt_tv, fhash, model)) result.delete_dump()
except RequestException as e: print("{}: {} {} ({})".format(prd, txt_tv, result.filehash, model))
print("{}: {}".format(prd, str(e))) else:
continue print("{}: {}".format(prd, str(chk.error)))
write_info_if_dumps_found() write_info_if_dumps_found()