Need a second set of eyes, passing Youtube video to the plugin
#1
Hi all,

Apologies for the no doubt stupid question, but I'm hoping someone can tell me what I'm doing wrong here. For now I'm just sending the following url through my browser in an attempt to play the specified youtube video in the youtube plugin. I have grander plans if I can actually get this to work Wink :

Code:
http://192.168.1.23:3142/jsonrpc?request={"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"plugin://plugin.video.youtube/?action=play_video&videoid='ngElkyQ6Rhs'"}},"id":1}
This gives me {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}

I've been googling around and trying various things for the past hour or so but I think it's time to ask the experts as I'm likely missing something stupid. For reference, I'm able to pause/resume with
Code:
http://192.168.1.23:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Player.PlayPause","params":{"playerid":1},"id":1}
, so the commands are getting through at least.

Any help appreciated, thanks!!!
Reply
#2
It looks valid to me and JSONlint says it's valid JSON as well. But it could be that there's an issue with the apostrophs in the URL. Could you try escaping them either with a backslash or even better URL encode the whole JSON-RPC request.
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
(2015-05-04, 08:53)Montellese Wrote: It looks valid to me and JSONlint says it's valid JSON as well. But it could be that there's an issue with the apostrophs in the URL. Could you try escaping them either with a backslash or even better URL encode the whole JSON-RPC request.

Hi, thanks for the response. I've tried encoding it:
Code:
http://192.168.1.23:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Player.Open%22,%22params%22:{%22item%22:{%22file%22:%22plugin://plugin.video.youtube/?action=play_video&videoid=%27ngElkyQ6Rhs%27%22}},%22id%22:1}
But it doesn't seem to matter (I assume the browser is doing that for me anyway).

I wasn't sure if I have the syntax right (for talking to the plugin)? Is it happy with just the youtube ID (though I get the same error with the full url Big Grin)?
Reply
#4
I don't know how the youtube plugin works internally so you need to figure out how the URL schema works by playing a youtube video from within Kodi and check the log for the path being used. But the plugin://plugin.video.youtube/ approach certainly looks like the correct approach.

But the parse error comes from JSON-RPC and says that something is wrong with the syntax of the JSON-RPC request so it doesn't even get to the youtube plugin.

As mentioned before I would try to play around with the apostrophes i.e. drop them or escape them.
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
#5
If you remove the apostrophes, it plays fine (Star Wars trailer).
Code:
{"jsonrpc": "2.0", "params": {"item": {"file": "plugin://plugin.video.youtube/?action=play_video&videoid=ngElkyQ6Rhs"}}, "method": "Player.Open", "id": "libPlayer"}
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#6
For information : https://github.com/bromix/plugin.video.y...dpoints.md

Bromix is changing calling way and will deprecate this way for next release Wink
Reply
#7
(2015-05-04, 09:13)Milhouse Wrote: If you remove the apostrophes, it plays fine (Star Wars trailer).
Code:
{"jsonrpc": "2.0", "params": {"item": {"file": "plugin://plugin.video.youtube/?action=play_video&videoid=ngElkyQ6Rhs"}}, "method": "Player.Open", "id": "libPlayer"}

Hmm, it still gives me a parse error. I tried switching around the "method" as you did there as well.

It's weird, as jsonlint says that {"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"plugin://plugin.video.youtube/?action=play_video&videoid=ngElkyQ6Rhs"}},"id":1} is perfectly fine (it parses), but my browser rejects it.
Reply
#8
I checked the Kodi log and it says:

JSONRPC: Failed to parse '{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"plugin://plugin.video.youtube/?action=play_video'

Not sure why it stops there...
Reply
#9
Because you need to url encode the query as Montellese told you earlier Wink & is a reserved character in url ...
Reply
#10
Got it Smile

Grabbed the debug logs and pushed a file from Constelation to see what it was doing. Turns out I needed:

Code:
http://192.168.1.23:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Player.Open%22,%22params%22:{%22item%22:{%22file%22:%22plugin://plugin.video.youtube/play/?video_id=ngElkyQ6Rhs%22}},%22id%22:1}

The log entry that did the trick was:


18:33:06 T:140438023423744 WARNING: [plugin.video.youtube] DEPRECATED "plugin://plugin.video.youtube/?action=play_video&videoid=L8nTcqwqdU4"
18:33:06 T:140438023423744 WARNING: [plugin.video.youtube] USE INSTEAD "plugin://plugin.video.youtube/play/?video_id=L8nTcqwqdU4"

Thanks for the help everyone Smile

EDIT: Ah, Tolriq, I see what he meant now Big Grin Dammit...
Reply

Logout Mark Read Team Forum Stats Members Help
Need a second set of eyes, passing Youtube video to the plugin0