Started support for querying update servers.

This commit is contained in:
2019-09-10 05:00:35 +02:00
parent 912dc50ff4
commit b5b6038849
5 changed files with 523 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Queries the updateserver for given device's updates.
"""
from grmn import updateserver, devices
import sys
if len(sys.argv) < 2:
print("Syntax: {} DEVICESKU".format(sys.argv[0]))
print("Examples:")
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]))
sys.exit(1)
DEVICE = sys.argv[1]
us = updateserver.UpdateServer()
device_sku = DEVICE
if len(device_sku) <= 4:
device_sku = "006-B{:>04}-00".format(device_sku)
hwid = int(device_sku[5:9])
device_name = devices.DEVICES.get(hwid, "Unknown device")
print("Device: {}".format(device_name))
us.query_updates([device_sku])