1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-10 06:16:46 +00:00

add prd filter to allota

This commit is contained in:
thurask 2017-10-31 11:41:06 -04:00
parent ab46b5b912
commit 8b669ba73c
No known key found for this signature in database
GPG Key ID: A6CCCDEA29795048

View File

@ -17,6 +17,7 @@ fc.cltp = fc.CLTP.MOBILE
dp = tcllib.DefaultParser(__file__) dp = tcllib.DefaultParser(__file__)
dp.add_argument("forcever", nargs="?", default=None) dp.add_argument("forcever", nargs="?", default=None)
dp.add_argument("-p", "--prd", dest="tocheck", nargs="?", default=None)
args = dp.parse_args(sys.argv[1:]) args = dp.parse_args(sys.argv[1:])
if args.forcever is not None: if args.forcever is not None:
@ -24,6 +25,8 @@ if args.forcever is not None:
else: else:
force_ver_text = "" force_ver_text = ""
prdcheck = "" if args.tocheck is None else args.tocheck
print("List of latest OTA firmware{} by PRD:".format(force_ver_text)) print("List of latest OTA firmware{} by PRD:".format(force_ver_text))
with open("prds.txt", "r") as f: with open("prds.txt", "r") as f:
@ -32,14 +35,15 @@ with open("prds.txt", "r") as f:
prd, lastver, model = prdline.split(" ", 2) prd, lastver, model = prdline.split(" ", 2)
if args.forcever is not None: if args.forcever is not None:
lastver = args.forcever lastver = args.forcever
try: if prdcheck in prd:
fc.reset_session() try:
fc.curef = prd fc.reset_session()
fc.fv = lastver fc.curef = prd
check_xml = fc.do_check(max_tries=20) fc.fv = lastver
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml) check_xml = fc.do_check(max_tries=20)
versioninfo = tcllib.ANSI_CYAN_DARK + fv + tcllib.ANSI_RESET + "" + tcllib.ANSI_CYAN + tv + tcllib.ANSI_RESET curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
print("{}: {} {} ({})".format(prd, versioninfo, fhash, model)) versioninfo = tcllib.ANSI_CYAN_DARK + fv + tcllib.ANSI_RESET + "" + tcllib.ANSI_CYAN + tv + tcllib.ANSI_RESET
except RequestException as e: print("{}: {} {} ({})".format(prd, versioninfo, fhash, model))
print("{} ({}): {}".format(prd, lastver, str(e))) except RequestException as e:
continue print("{} ({}): {}".format(prd, lastver, str(e)))
continue