Support multiple SKUs in one call.
This commit is contained in:
parent
70457ff70a
commit
56c5774556
@ -9,23 +9,23 @@ from grmn import updateserver, devices
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Syntax: {} DEVICESKU".format(sys.argv[0]))
|
print("Syntax: {} DEVICESKU1 [DEVICESKU2..n]".format(sys.argv[0]))
|
||||||
print("Examples:")
|
print("Examples:")
|
||||||
print(" {} 3196 - Query update info for 006-B3196-00".format(sys.argv[0]))
|
print(" {} 3196 - Query update info for 006-B3196-00".format(sys.argv[0]))
|
||||||
print(" {} 006-B3196-00 - Query update info for given SKU".format(sys.argv[0]))
|
print(" {} 006-B3196-00 - Query update info for given SKU".format(sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
DEVICE = sys.argv[1]
|
device_skus = sys.argv[1:]
|
||||||
|
|
||||||
us = updateserver.UpdateServer()
|
us = updateserver.UpdateServer()
|
||||||
|
|
||||||
device_sku = DEVICE
|
for i, sku in enumerate(device_skus):
|
||||||
if len(device_sku) <= 4:
|
if len(sku) <= 4:
|
||||||
device_sku = "006-B{:>04}-00".format(device_sku)
|
device_skus[i] = "006-B{:>04}-00".format(sku)
|
||||||
|
|
||||||
hwid = int(device_sku[5:9])
|
primary_hwid = int(device_skus[0][5:9])
|
||||||
device_name = devices.DEVICES.get(hwid, "Unknown device")
|
device_name = devices.DEVICES.get(primary_hwid, "Unknown device")
|
||||||
|
|
||||||
print("Device: {}".format(device_name))
|
print("Device: {}".format(device_name))
|
||||||
|
|
||||||
us.query_updates([device_sku])
|
us.query_updates(device_skus)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user