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

add no prefix option for findprd for certain devices

This commit is contained in:
thurask 2018-05-08 00:05:24 -04:00
parent f3aae4ce7f
commit 5f0e334318
No known key found for this signature in database
GPG Key ID: A6CCCDEA29795048

View File

@ -23,6 +23,7 @@ dp.add_argument("tocheck", help="CU Reference # to filter scan results", nargs="
dp.add_argument("-f", "--floor", help="Beginning of scan range", dest="floor", nargs="?", type=int, default=0) 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("-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) dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
dp.add_argument("-np", "--no-prefix", help="Skip 'PRD-' prefix", dest="noprefix", action="store_true", default=False)
args = dp.parse_args(sys.argv[1:]) args = dp.parse_args(sys.argv[1:])
floor = args.floor floor = args.floor
@ -58,6 +59,8 @@ dev = DesktopDevice()
runner = RequestRunner(ServerVoteSelector(), https=False) runner = RequestRunner(ServerVoteSelector(), https=False)
runner.max_tries = 20 runner.max_tries = 20
prefix = "" if args.noprefix else "PRD-"
for center in sorted(prddict.keys()): for center in sorted(prddict.keys()):
tails = [int(i) for i in prddict[center]] tails = [int(i) for i in prddict[center]]
safes = [g for g in range(floor, ceiling) if g not in tails] safes = [g for g in range(floor, ceiling) if g not in tails]
@ -65,7 +68,7 @@ for center in sorted(prddict.keys()):
done_count = 0 done_count = 0
print("Checking {} variant codes for model {}.".format(total_count, center)) print("Checking {} variant codes for model {}.".format(total_count, center))
for j in safes: for j in safes:
curef = "PRD-{}-{:03}".format(center, j) curef = "{}{}-{:03}".format(prefix, center, j)
done_count += 1 done_count += 1
print("Checking {} ({}/{})".format(curef, done_count, total_count)) print("Checking {} ({}/{})".format(curef, done_count, total_count))
print(ansi.UP_DEL, end="") print(ansi.UP_DEL, end="")