diff --git a/tclcheck_allfull.py b/tclcheck_allfull.py index 6911d0b..3b4d86a 100644 --- a/tclcheck_allfull.py +++ b/tclcheck_allfull.py @@ -22,12 +22,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:") diff --git a/tclcheck_allota.py b/tclcheck_allota.py index 6636750..bb04bc1 100644 --- a/tclcheck_allota.py +++ b/tclcheck_allota.py @@ -23,6 +23,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: @@ -33,7 +34,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)) diff --git a/tclcheck_findprd.py b/tclcheck_findprd.py index 8e066f3..46950e4 100755 --- a/tclcheck_findprd.py +++ b/tclcheck_findprd.py @@ -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:") diff --git a/tclcheck_findprd2.py b/tclcheck_findprd2.py index 423110c..194d0ec 100644 --- a/tclcheck_findprd2.py +++ b/tclcheck_findprd2.py @@ -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:") diff --git a/tcllib/devlist.py b/tcllib/devlist.py index 75dbaa0..2a31a31 100644 --- a/tcllib/devlist.py +++ b/tcllib/devlist.py @@ -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: