mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
Output some stats when scanning for new PRDs.
This commit is contained in:
parent
095ba8cebb
commit
fb830f8dd1
@ -7,6 +7,8 @@ import collections
|
|||||||
import tcllib
|
import tcllib
|
||||||
from requests.exceptions import RequestException, Timeout
|
from requests.exceptions import RequestException, Timeout
|
||||||
|
|
||||||
|
tcllib.make_escapes_work()
|
||||||
|
|
||||||
fc = tcllib.FotaCheck()
|
fc = tcllib.FotaCheck()
|
||||||
fc.serid = "3531510"
|
fc.serid = "3531510"
|
||||||
fc.fv = "AAA000"
|
fc.fv = "AAA000"
|
||||||
@ -27,17 +29,28 @@ with open("prds.txt", "r") as afile:
|
|||||||
for key, value in prdc.items():
|
for key, value in prdc.items():
|
||||||
prddict[key].append(value)
|
prddict[key].append(value)
|
||||||
|
|
||||||
for center in prddict.keys():
|
|
||||||
|
|
||||||
|
for center in sorted(prddict.keys()):
|
||||||
tails = [int(i) for i in prddict[center]]
|
tails = [int(i) for i in prddict[center]]
|
||||||
|
total_count = 1000 - len(tails)
|
||||||
|
done_count = 0
|
||||||
|
print("Checking {} variant codes for model {}.".format(total_count, center))
|
||||||
for j in range(0, 1000):
|
for j in range(0, 1000):
|
||||||
if j not in tails:
|
if j in tails:
|
||||||
curef = "PRD-{}-{}".format(center, str(j).rjust(3, "0"))
|
continue
|
||||||
try:
|
curef = "PRD-{}-{:03}".format(center, j)
|
||||||
fc.reset_session()
|
done_count += 1
|
||||||
fc.curef = curef
|
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
||||||
check_xml = fc.do_check(https=False)
|
print(tcllib.ANSI_UP_DEL, end="")
|
||||||
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
try:
|
||||||
txt_tv = tv
|
fc.reset_session()
|
||||||
print("{}: {} {}".format(curef, txt_tv, fhash))
|
fc.curef = curef
|
||||||
except (SystemExit, RequestException, Timeout) as e:
|
check_xml = fc.do_check(https=False)
|
||||||
continue
|
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
||||||
|
txt_tv = tv
|
||||||
|
print("{}: {} {}".format(curef, txt_tv, fhash))
|
||||||
|
except (SystemExit, RequestException, Timeout) as e:
|
||||||
|
continue
|
||||||
|
|
||||||
|
print("Scan complete.")
|
||||||
|
Loading…
Reference in New Issue
Block a user