Converted tclcheck_findprd2.py
This commit is contained in:
parent
dd8be7be3b
commit
072644a089
@ -8,10 +8,7 @@
|
||||
import collections
|
||||
import sys
|
||||
|
||||
from requests.exceptions import RequestException, Timeout
|
||||
|
||||
import tcllib.argparser
|
||||
from tcllib import ansi, devlist
|
||||
from tcllib import ansi, argparser, devlist
|
||||
from tcllib.devices import DesktopDevice
|
||||
from tcllib.requests import RequestRunner, CheckRequest, ServerVoteSelector, \
|
||||
write_info_if_dumps_found
|
||||
@ -21,7 +18,7 @@ dpdesc = """
|
||||
Finds new PRD numbers for all known variants, or specified variants with tocheck. Scan range
|
||||
can be set by floor and ceiling switches.
|
||||
"""
|
||||
dp = tcllib.argparser.DefaultParser(__file__, dpdesc)
|
||||
dp = argparser.DefaultParser(__file__, dpdesc)
|
||||
dp.add_argument("tocheck", help="CU Reference # to filter scan results", nargs="?", default=None)
|
||||
dp.add_argument("-f", "--floor", help="Beginning of scan range", dest="floor", nargs="?", type=int, default=0)
|
||||
dp.add_argument("-c", "--ceiling", help="End of scan range", dest="ceiling", nargs="?", type=int, default=999)
|
||||
|
@ -7,25 +7,20 @@
|
||||
|
||||
import sys
|
||||
|
||||
from requests.exceptions import RequestException, Timeout
|
||||
|
||||
import tcllib
|
||||
import tcllib.argparser
|
||||
from tcllib import ansi, devlist
|
||||
from tcllib.devices import DesktopDevice, MobileDevice
|
||||
from tcllib import ansi, argparser, devlist
|
||||
from tcllib.devices import DesktopDevice
|
||||
from tcllib.requests import RequestRunner, CheckRequest, ServerVoteSelector, \
|
||||
write_info_if_dumps_found
|
||||
|
||||
|
||||
# Variants to scan for
|
||||
SCAN_VARIANTS = ["001", "003", "009", "010", "700"]
|
||||
|
||||
dev = DesktopDevice()
|
||||
fc = tcllib.FotaCheck()
|
||||
|
||||
dpdesc = """
|
||||
Finds new PRD numbers for a range of variants. Scan range can be set by
|
||||
floor and ceiling switches.
|
||||
"""
|
||||
dp = tcllib.argparser.DefaultParser(__file__, dpdesc)
|
||||
dp = argparser.DefaultParser(__file__, dpdesc)
|
||||
dp.add_argument("floor", nargs="?", help="Model number to start with", type=int, default=63116)
|
||||
dp.add_argument("ceiling", nargs="?", help="Model number to end with", type=int, default=99999)
|
||||
dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
|
||||
@ -50,21 +45,24 @@ to_scan = scan_list - known_centers
|
||||
total_count = len(to_scan) * len(SCAN_VARIANTS)
|
||||
done_count = 0
|
||||
|
||||
dev = DesktopDevice()
|
||||
|
||||
runner = RequestRunner(ServerVoteSelector(), https=False)
|
||||
runner.max_tries = 20
|
||||
|
||||
for center in to_scan:
|
||||
for j in SCAN_VARIANTS:
|
||||
curef = "PRD-{:05}-{:3}".format(center, j)
|
||||
done_count += 1
|
||||
print("Checking {} ({}/{})".format(curef, done_count, total_count))
|
||||
print(ansi.UP_DEL, end="")
|
||||
try:
|
||||
dev.curef = curef
|
||||
fc.reset_session(dev)
|
||||
check_xml = fc.do_check(dev, https=False, max_tries=20)
|
||||
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
|
||||
dev.curef = curef
|
||||
chk = CheckRequest(dev)
|
||||
runner.run(chk)
|
||||
if chk.success:
|
||||
chkres = chk.get_result()
|
||||
txt_tv = chkres.tvver
|
||||
print("{}: {} {}".format(curef, txt_tv, chkres.filehash))
|
||||
|
||||
print("Scan complete.")
|
||||
tcllib.FotaCheck.write_info_if_dumps_found()
|
||||
write_info_if_dumps_found()
|
||||
|
Reference in New Issue
Block a user