Calculate and show largest gap in list_missing_hwids.py.

This commit is contained in:
Markus Birth 2020-01-21 16:26:42 +01:00
parent 8437981e20
commit cc9cd320c7
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A

View File

@ -6,13 +6,19 @@
from grmn import devices from grmn import devices
import sys import sys
largest_gap = -1
gap_counter = 0
last_id = 0 last_id = 0
missing = [] missing = []
for i in range(0, 9999): for i in range(0, 9999):
if i in devices.DEVICES: if i in devices.DEVICES:
last_id = i last_id = i
if gap_counter > largest_gap:
largest_gap = gap_counter
gap_counter = 0
continue continue
missing.append(i) missing.append(i)
gap_counter += 1
missing_count = 0 missing_count = 0
cur_line = [] cur_line = []
@ -37,6 +43,7 @@ if len(cur_line) > 0:
print() print()
print("{} unknown ids.".format(missing_count)) print("{} unknown ids.".format(missing_count))
print("Last known id is: {:04}".format(last_id)) print("Last known id is: {:04}".format(last_id))
print("Largest gap is: {}".format(largest_gap))
if len(sys.argv) > 1: if len(sys.argv) > 1:
@ -46,7 +53,7 @@ if len(sys.argv) > 1:
print("./get_updates.py", end="") print("./get_updates.py", end="")
cur_line = 0 cur_line = 0
for i in range(last_id + 1, last_id + 200): for i in range(last_id + 1, last_id + 300):
if i % 10 == 0 and cur_line > 5: if i % 10 == 0 and cur_line > 5:
print() print()
print("./get_updates.py", end="") print("./get_updates.py", end="")