1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-09-20 06:43:26 +01:00
tcl_ota_check/tclcheck_all.py

39 lines
1.1 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=C0111,C0326
import tcllib
import sys
2017-09-07 17:47:13 +01:00
from requests.exceptions import RequestException, Timeout
fc = tcllib.FotaCheck()
fc.serid = "3531510"
fc.fv = "AAM481"
#fc.osvs = "7.1.1"
fc.mode = fc.MODE_FULL
2017-09-12 20:40:40 +01:00
# CLTP = 10 (only show actual updates or HTTP 206) / 2010 (always show latest version for MODE_FULL)
fc.cltp = 10
#fc.cltp = 2010
print("List of latest {} firmware by PRD:".format("FULL" if fc.mode == fc.MODE_FULL else "OTA"))
with open("prds.txt", "r") as afile:
prdx = afile.read()
prds = list(filter(None, prdx.split("\n")))
for prdline in prds:
prd, model = prdline.split(" ", 1)
try:
fc.reset_session()
fc.curef = prd
check_xml = fc.do_check()
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
print("{}: {} {} ({})".format(prd, tv, fhash, model))
2017-09-07 17:47:13 +01:00
except Timeout as e:
print("{} failed. (Connection timed out.)".format(prd))
continue
except (SystemExit, RequestException) as e:
print("{} failed. ({})".format(prd, str(e)))
continue