Commit 8b40c213 by Oleksandr Barabash

better filtering by station_ids

parent 1e905c5f
......@@ -22,6 +22,7 @@ logger = logging.getLogger(__name__)
flags.DEFINE_string('station_id', None, "Station Id")
flags.DEFINE_list('station_ids', [], 'Station IDs')
flags.DEFINE_string('file', None, "File where to save the history")
......@@ -123,6 +124,14 @@ def on_data_handler(packet_logger: PacketLogger):
# noinspection PyBroadException
try:
kr_packet = KrPacketV2.load(message, unknown=EXCLUDE)
station_ids = flags.FLAGS.station_ids
if len(station_ids) > 0:
for station_id in station_ids:
if station_id is None or \
station_id.lower() == kr_packet.station_id.lower():
logger.info(f"{kr_packet}")
packet_logger.log(kr_packet)
else:
station_id = flags.FLAGS.station_id
if station_id is None or \
station_id.lower() == kr_packet.station_id.lower():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment