2017-09-19 16:12:01 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-10-05 22:51:07 +01:00
|
|
|
# pylint: disable=C0111,C0326,C0103
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2017-12-17 02:12:09 +00:00
|
|
|
import json
|
|
|
|
import requests
|
2017-10-04 11:53:04 +01:00
|
|
|
import sys
|
2017-09-19 16:12:01 +01:00
|
|
|
import tcllib
|
2017-10-05 22:51:07 +01:00
|
|
|
from requests.exceptions import RequestException
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2017-09-23 21:17:57 +01:00
|
|
|
tcllib.make_escapes_work()
|
2017-09-19 16:12:01 +01:00
|
|
|
|
|
|
|
fc = tcllib.FotaCheck()
|
|
|
|
fc.serid = "3531510"
|
|
|
|
#fc.osvs = "7.1.1"
|
2017-10-15 00:51:38 +01:00
|
|
|
fc.mode = fc.MODE.OTA
|
|
|
|
fc.cltp = fc.CLTP.MOBILE
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2017-10-10 20:25:38 +01:00
|
|
|
dp = tcllib.DefaultParser(__file__)
|
|
|
|
dp.add_argument("forcever", nargs="?", default=None)
|
2017-10-31 15:41:06 +00:00
|
|
|
dp.add_argument("-p", "--prd", dest="tocheck", nargs="?", default=None)
|
2017-10-10 20:25:38 +01:00
|
|
|
args = dp.parse_args(sys.argv[1:])
|
|
|
|
|
|
|
|
if args.forcever is not None:
|
|
|
|
force_ver_text = " from {}".format(args.forcever)
|
|
|
|
else:
|
|
|
|
force_ver_text = ""
|
2017-10-04 11:53:04 +01:00
|
|
|
|
2017-10-31 15:41:06 +00:00
|
|
|
prdcheck = "" if args.tocheck is None else args.tocheck
|
|
|
|
|
2017-12-19 23:01:55 +00:00
|
|
|
print("Loading list of devices.")
|
2017-12-17 02:12:09 +00:00
|
|
|
prds = tcllib.FotaCheck.get_devicelist()
|
|
|
|
|
2017-10-04 11:53:04 +01:00
|
|
|
print("List of latest OTA firmware{} by PRD:".format(force_ver_text))
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2017-12-17 02:18:55 +00:00
|
|
|
for prd, variant in prds.items():
|
|
|
|
model = variant["variant"]
|
|
|
|
lastver = variant["last_ota"]
|
2017-12-19 15:32:14 +00:00
|
|
|
if lastver is None: lastver = variant["last_full"]
|
2017-12-17 02:12:09 +00:00
|
|
|
if args.forcever is not None:
|
|
|
|
lastver = args.forcever
|
|
|
|
if prdcheck in prd:
|
|
|
|
try:
|
|
|
|
fc.reset_session()
|
|
|
|
fc.curef = prd
|
|
|
|
fc.fv = lastver
|
|
|
|
check_xml = fc.do_check(max_tries=20)
|
|
|
|
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
2017-12-19 23:00:28 +00:00
|
|
|
versioninfo = tcllib.ANSI_YELLOW_DARK + fv + tcllib.ANSI_RESET + " ⇨ " + tcllib.ANSI_YELLOW + tv + tcllib.ANSI_RESET + " (FULL: {})".format(variant["last_full"])
|
2017-12-17 02:12:09 +00:00
|
|
|
print("{}: {} {} ({})".format(prd, versioninfo, fhash, model))
|
|
|
|
except RequestException as e:
|
|
|
|
print("{} ({}): {}".format(prd, lastver, str(e)))
|
|
|
|
continue
|
2017-11-12 21:19:04 +00:00
|
|
|
|
|
|
|
tcllib.FotaCheck.write_info_if_dumps_found()
|