Skip to content

Commit a4b7883

Browse files
committed
Simplify Python CLI output
Print just the names of enums instead of class+name.
1 parent b6da02d commit a4b7883

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

support/cli.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -250,31 +250,31 @@ def callback(self, evt_type, evt):
250250
logging.info("Unique file identifier: %s %s", evt.ufid.owner, evt.ufid.id)
251251
if evt.xhdr:
252252
logging.info("XHDR: param=%s mime=%s lot=%s",
253-
evt.xhdr.param, evt.xhdr.mime, evt.xhdr.lot)
253+
evt.xhdr.param, evt.xhdr.mime.name, evt.xhdr.lot)
254254
elif evt_type == nrsc5.EventType.SIG:
255255
for service in evt:
256256
logging.info("SIG Service: type=%s number=%s name=%s",
257-
service.type, service.number, service.name)
257+
service.type.name, service.number, service.name)
258258
for component in service.components:
259259
if component.type == nrsc5.ComponentType.AUDIO:
260260
logging.info(" Audio component: id=%s port=%04X type=%s mime=%s",
261261
component.id, component.audio.port,
262-
component.audio.type, component.audio.mime)
262+
component.audio.type.name, component.audio.mime.name)
263263
elif component.type == nrsc5.ComponentType.DATA:
264264
logging.info(" Data component: id=%s port=%04X service_data_type=%s type=%s mime=%s",
265265
component.id, component.data.port,
266-
component.data.service_data_type,
267-
component.data.type, component.data.mime)
266+
component.data.service_data_type.name,
267+
component.data.type, component.data.mime.name)
268268
elif evt_type == nrsc5.EventType.STREAM:
269269
logging.info("Stream data: port=%04X seq=%04X mime=%s size=%s",
270-
evt.port, evt.seq, evt.mime, len(evt.data))
270+
evt.port, evt.seq, evt.mime.name, len(evt.data))
271271
elif evt_type == nrsc5.EventType.PACKET:
272272
logging.info("Packet data: port=%04X seq=%04X mime=%s size=%s",
273-
evt.port, evt.seq, evt.mime, len(evt.data))
273+
evt.port, evt.seq, evt.mime.name, len(evt.data))
274274
elif evt_type == nrsc5.EventType.LOT:
275275
time_str = evt.expiry_utc.strftime("%Y-%m-%dT%H:%M:%SZ")
276276
logging.info("LOT file: port=%04X lot=%s name=%s size=%s mime=%s expiry=%s",
277-
evt.port, evt.lot, evt.name, len(evt.data), evt.mime, time_str)
277+
evt.port, evt.lot, evt.name, len(evt.data), evt.mime.name, time_str)
278278
if self.args.dump_aas_files:
279279
path = os.path.join(self.args.dump_aas_files, evt.name)
280280
with open(path, "wb") as file:
@@ -297,12 +297,12 @@ def callback(self, evt_type, evt):
297297
for audio_service in evt.audio_services:
298298
logging.info("Audio program %s: %s, type: %s, sound experience %s",
299299
audio_service.program,
300-
"public" if audio_service.access == nrsc5.Access.PUBLIC else "restricted",
300+
audio_service.access.name,
301301
self.radio.program_type_name(audio_service.type),
302302
audio_service.sound_exp)
303303
for data_service in evt.data_services:
304304
logging.info("Data service: %s, type: %s, MIME type %03x",
305-
"public" if data_service.access == nrsc5.Access.PUBLIC else "restricted",
305+
data_service.access.name,
306306
self.radio.service_data_type_name(data_service.type),
307307
data_service.mime_type)
308308

0 commit comments

Comments
 (0)