json has too much output
Opened this issue · 1 comments
I wonder, why the json output prints too much data, although it is NOT repeated in the RDS data.
The attached example is quite short (841 bytes), but json will print the radiotext 4x
$ redsea -E -i hex < /tmp/austria.txt | grep Super
{"pi":"0xA3E0","bler":0,"group":"2A","tp":true,"prog_type":"Pop music","radiotext":"Superstars & Superhits"}
{"pi":"0xA3E0","bler":0,"group":"2A","tp":true,"prog_type":"Pop music","radiotext":"Superstars & Superhits"}
{"pi":"0xA3E0","bler":0,"group":"2A","tp":true,"prog_type":"Pop music","radiotext":"Superstars & Superhits"}
{"pi":"0xA3E0","bler":0,"group":"2A","tp":true,"prog_type":"Pop music","radiotext":"Superstars & Superhits"}
although it is transmitted only once.
Superstars & Superhits
in hex is 53 75 70 65 72 73 74 61 72 73 20 26 61 6D 70 3B 20 53 75 70 65 72 68 69 74 73
which is only transmitted in these lines:
$ cat /tmp/austria.txt | grep 255
A3E0 255B 2020 2020
A3E0 255C 2020 2020
A3E0 255D 2020 2020
A3E0 255E 2020 2020
A3E0 255F 2020 2020
A3E0 2550 5375 7065
A3E0 2551 7273 7461
A3E0 2552 7273 2026
A3E0 2553 2053 7570
A3E0 2554 6572 6869
A3E0 2555 7473 0D20
A3E0 2556 2020 2020
A3E0 2557 2020 2020
A3E0 2558 2020 2020
(remark: in the example 0x2559 and 0x255A are missing but will be ignored because of the 0D
value in 0x2555)
So I propose that redsea
only prints valued that are received. This also will lead to better readable output.
Thanks for the report! You were wondering why: It's because the station sends end-of-string character 0D but keeps adding more 'invisible' characaters to the string nevertheless. I'm sure a workaround can be invented for this corner case, along with a nice little unit test, one day.