From a2ea4754571c80c9525ea3e5e2aa9ff86c1b3408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Chac=C3=B3n?= Date: Wed, 7 Sep 2022 08:35:00 -0600 Subject: [PATCH] Check for # comments at the beginning of lines in ShapedDevices.csv --- v1.2/LibreQoS.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/v1.2/LibreQoS.py b/v1.2/LibreQoS.py index 97ca4890..8ab8bbaa 100644 --- a/v1.2/LibreQoS.py +++ b/v1.2/LibreQoS.py @@ -46,9 +46,15 @@ def refreshShapers(): rowNum = 2 with open('ShapedDevices.csv') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') - next(csv_reader) + #Remove comments if any + commentsRemoved = [] for row in csv_reader: - circuitID, circuitName, deviceID, deviceName, ParentNode, mac, ipv4_input, ipv6_input, downloadMin, uploadMin, downloadMax, uploadMax = row + if not row[0].startswith('#'): + commentsRemoved.append(row) + #Remove header + commentsRemoved.pop(0) + for row in commentsRemoved: + circuitID, circuitName, deviceID, deviceName, ParentNode, mac, ipv4_input, ipv6_input, downloadMin, uploadMin, downloadMax, uploadMax, comment = row ipv4_hosts = [] if ipv4_input != "": try: @@ -107,9 +113,15 @@ def refreshShapers(): knownCircuitIDs = [] with open('ShapedDevices.csv') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') - next(csv_reader) + #Remove comments if any + commentsRemoved = [] for row in csv_reader: - circuitID, circuitName, deviceID, deviceName, ParentNode, mac, ipv4_input, ipv6_input, downloadMin, uploadMin, downloadMax, uploadMax = row + if not row[0].startswith('#'): + commentsRemoved.append(row) + #Remove header + commentsRemoved.pop(0) + for row in commentsRemoved: + circuitID, circuitName, deviceID, deviceName, ParentNode, mac, ipv4_input, ipv6_input, downloadMin, uploadMin, downloadMax, uploadMax, comment = row ipv4_hosts = [] if ipv4_input != "": ipv4_input = ipv4_input.replace(' ','')