1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00

add force local db switches

This commit is contained in:
thurask 2018-02-09 15:41:12 -05:00
parent 28ed2365ab
commit 2adcb68a80
No known key found for this signature in database
GPG Key ID: A6CCCDEA29795048
5 changed files with 12 additions and 5 deletions

View File

@ -24,12 +24,13 @@ dpdesc = """
"""
dp = tcllib.argparser.DefaultParser(__file__, dpdesc)
dp.add_argument("-p", "--prd", help="CU Reference # to filter scan results", dest="tocheck", nargs="?", default=None, metavar="PRD")
dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
args = dp.parse_args(sys.argv[1:])
prdcheck = "" if args.tocheck is None else args.tocheck
print("Loading list of devices.")
prds = devlist.get_devicelist()
prds = devlist.get_devicelist(local=args.local)
print("List of latest FULL firmware by PRD:")

View File

@ -25,6 +25,7 @@ dpdesc = """
dp = tcllib.argparser.DefaultParser(__file__, dpdesc)
dp.add_argument("forcever", help="Initial software version to check for OTA updates, e.g. AAM481", nargs="?", default=None)
dp.add_argument("-p", "--prd", help="CU Reference # to filter scan results", dest="tocheck", nargs="?", default=None, metavar="PRD")
dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
args = dp.parse_args(sys.argv[1:])
if args.forcever is not None:
@ -35,7 +36,7 @@ else:
prdcheck = "" if args.tocheck is None else args.tocheck
print("Loading list of devices.")
prds = devlist.get_devicelist()
prds = devlist.get_devicelist(local=args.local)
print("List of latest OTA firmware{} by PRD:".format(force_ver_text))

View File

@ -27,6 +27,7 @@ dp = tcllib.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)
dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
args = dp.parse_args(sys.argv[1:])
floor = args.floor
@ -36,7 +37,7 @@ if ceiling < floor:
raise SystemExit
print("Loading list of devices...", end="", flush=True)
prd_db = devlist.get_devicelist()
prd_db = devlist.get_devicelist(local=args.local)
print(" OK")
print("Valid PRDs not already in database:")

View File

@ -28,6 +28,7 @@ dpdesc = """
dp = tcllib.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)
args = dp.parse_args(sys.argv[1:])
floor = args.floor
@ -37,7 +38,7 @@ if ceiling < floor:
raise SystemExit
print("Loading list of known devices...", end="", flush=True)
prd_db = devlist.get_devicelist()
prd_db = devlist.get_devicelist(local=args.local)
print(" OK")
print("Valid PRDs not already in database:")

View File

@ -33,10 +33,13 @@ def load_local_devicelist():
return None, True
def get_devicelist(force=False, output_diff=True):
def get_devicelist(force=False, output_diff=True, local=False):
"""Return device list from saved database."""
old_prds, need_download = load_local_devicelist()
if local:
return old_prds
if need_download or force:
prds_json = requests.get(DEVICELIST_URL).text
with open(DEVICELIST_FILE, "wt") as dlfile: