mkrufky / libdvbtee

dvbtee: a digital television streamer / parser / service information aggregator supporting various interfaces including telnet CLI & http control
GNU Lesser General Public License v2.1
79 stars 31 forks source link

double quotes not escaped in JSON string values #50

Closed grkblood13 closed 3 years ago

grkblood13 commented 5 years ago

double quotes not escaped in JSON string values causing invalid JSON output

mkrufky commented 5 years ago

I'd love to fix this if you can show me an example of the issue. Otherwise, patches are welcome :-)

grkblood13 commented 5 years ago

Sure, check out this pastebin. Line 62 shows the EPG data breaking in the JSON output. The JSON is at the bottom. https://pastebin.com/jXQS26A3

mkrufky commented 5 years ago

I believe that this will work properly if you use the node.js module, node-dvbtee ... I don't recall why it was fixed there but not in the CLI app, but if using the node.js module is an option for you, it may be a better route.

grkblood13 commented 5 years ago

Any chance this will be fixed in the cli version? I would contribute but I'm not all that experienced with C++ programming.

grkblood13 commented 5 years ago

Is there any way to associate the EIT and ETT tables printed from the node-dvbtee packaged you mentioned with the virtual channel it's meant for? I can't seem to find any field to make the correlation.

mkrufky commented 5 years ago

Any chance this will be fixed in the cli version? I would contribute but I'm not all that experienced with C++ programming.

Not likely to happen immediately. It needs to be done in such a way that preserves the original behavior by default -- others use the software to extract binary blobs from the streams as-is, and any escaping must be optional.

This was done in node-dvbtee and it works properly there. If you'd like to see this logic brought to the CLI, please confirm that the way it's done in node-dvbtee works for you.

mkrufky commented 5 years ago

Is there any way to associate the EIT and ETT tables printed from the node-dvbtee packaged you mentioned with the virtual channel it's meant for? I can't seem to find any field to make the correlation.

When using node-dvbtee, you will have to associate the data from the related tables to each other yourself. I had planned on adding such utility natively to node-dvbtee but hadn't gotten around to it yet.

grkblood13 commented 5 years ago

What's the significance of the etmid thats in the ett tables? I've figured out how to pair the eit tables with the proper virtual channel but not how to match up the ett tables with their corresponding eit programme event. Im thinking maybe I can use this "etmId" somehow? My main problem is that I can't find anywhere in the parsed data where these etmIds are referenced anywhere.

grkblood13 commented 5 years ago

Nevermind, I figured it out after some decimal to binary conversions. I'm going to leave this open though since the original issue remains unresolved. Thanks for the suggestions!

bkoehm commented 3 years ago

I opened pull request #60 to escape double quotes and backslashes in JSON values. I tested this with a local ATSC .ts file using the -F, -j and -e options. I wanted to test the web server output, but I was unable to figure out how to get the web server to output as JSON (only as HTML). If someone tells me how to do that, I can test the web server output too.