Solved JSON LiveTV channel switching parse error
#1
Hi,

Krypton is still in heavy development but couldn't find big changes regarding the API that has impact on my question and that is how to properly switch LiveTV channels using JSONRPC?
I also know the channelid's don't match the ID's returned by PVR backend so first i'll grab the channel ID's like this
{"jsonrpc":"2.0","method":"PVR.GetChannels","params":{"channelgroupid":2},"id":1}

Results:
{"id":1,"jsonrpc":"2.0","result":{"channels":[{"channelid":1059,"label":"NPO Radio 1"},{"channelid":1029,"label":"NPO Radio 2"}, etc, etc

This works perfect and returns all the information i want for specific channelgroups
Then i'm trying to switch channels like this but it only returns a Parse error. (found several similar examples on the forum)
{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"channelid":1059},"id":1}

Results:
{"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}

What am I doing wrong?

I also understand (if i get above working) that Player.Open always stops current playback and then starts new playback, is this still the case ?
Otherwise i was playing to build a check to check if LiveTV is playing and based on those results use Player.Open (if not playing) or just send channel number followed by OK (if possible, need to check first)
Reply
#2
You are missing a closing curly brace for the "params" object. You open one for "params" and one for "item" but you only close the one for "item" and are missing the one for "params".

If you get a parsing error the first thing you should do is head over to http://jsonlint.com/ and use it to validate your JSON-RCP request. It will tell you if it's valid JSON and if not it often helps you to figure out what is wrong.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
Serious, how could i have missed that. Sad

Thanks for helping and the useful tip Wink
Reply
#4
(2016-05-11, 11:17)schumi2004 Wrote: Serious, how could i have missed that. Sad

Thanks for helping and the useful tip Wink
Is this still working for you?

i get the TV PVR channels regardless of whether i specify channelgroupid as 1 or 2.
Im running the latest nightly on mac OS.
Reply

Logout Mark Read Team Forum Stats Members Help
JSON LiveTV channel switching parse error0