mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
Updated tclcheck_gapfill.py to new style.
This commit is contained in:
parent
dfe366dd7c
commit
bbc1b6644e
@ -6,20 +6,18 @@
|
|||||||
"""Query existence of missing OTAs."""
|
"""Query existence of missing OTAs."""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from requests.exceptions import RequestException
|
|
||||||
|
|
||||||
import tcllib
|
from tcllib import ansi
|
||||||
from tcllib.devices import DesktopDevice, MobileDevice
|
from tcllib.devices import MobileDevice
|
||||||
|
from tcllib.requests import RequestRunner, CheckRequest, ServerVoteSelector, \
|
||||||
|
write_info_if_dumps_found
|
||||||
|
|
||||||
|
|
||||||
# 1. Fetch list of missing OTAs (e.g. from ancient versions to current)
|
# 1. Fetch list of missing OTAs (e.g. from ancient versions to current)
|
||||||
# 2. Query updates from FOTA servers (and store XML)
|
# 2. Query updates from FOTA servers (and store XML)
|
||||||
# (3. Upload will be done manually with upload_logs.py)
|
# (3. Upload will be done manually with upload_logs.py)
|
||||||
|
|
||||||
dev = MobileDevice()
|
|
||||||
fc = tcllib.FotaCheck()
|
|
||||||
|
|
||||||
print("Loading list of missing OTAs.")
|
print("Loading list of missing OTAs.")
|
||||||
versions_json = requests.get("https://tclota.birth-online.de/json_otaversions.php").text
|
versions_json = requests.get("https://tclota.birth-online.de/json_otaversions.php").text
|
||||||
@ -30,22 +28,25 @@ for i in versions:
|
|||||||
|
|
||||||
print("Got {} devices and a total of {} missing OTAs.".format(len(versions), num_versions))
|
print("Got {} devices and a total of {} missing OTAs.".format(len(versions), num_versions))
|
||||||
|
|
||||||
|
dev = MobileDevice()
|
||||||
|
|
||||||
|
runner = RequestRunner(ServerVoteSelector())
|
||||||
|
runner.max_tries = 20
|
||||||
|
|
||||||
num_item = 1
|
num_item = 1
|
||||||
for prd, data in versions.items():
|
for prd, data in versions.items():
|
||||||
print("{}:".format(prd), end="", flush=True)
|
print("{}:".format(prd), end="", flush=True)
|
||||||
for ver in data["missing_froms"]:
|
for ver in data["missing_froms"]:
|
||||||
print(" {}".format(ver), end="", flush=True)
|
print(" {}".format(ver), end="", flush=True)
|
||||||
try:
|
|
||||||
dev.curef = prd
|
dev.curef = prd
|
||||||
dev.fwver = ver
|
dev.fwver = ver
|
||||||
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:
|
||||||
print("✔", end="", flush=True)
|
print("✔", end="", flush=True)
|
||||||
except RequestException as e:
|
|
||||||
print("✖", end="", flush=True)
|
|
||||||
continue
|
|
||||||
num_item += 1
|
num_item += 1
|
||||||
|
else:
|
||||||
|
print("✖", end="", flush=True)
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
tcllib.FotaCheck.write_info_if_dumps_found()
|
write_info_if_dumps_found()
|
||||||
|
Loading…
Reference in New Issue
Block a user