Posts: 24
Joined: Aug 2014
Reputation:
1
Hi all,
I may be doing the wrong queries but I didn't find anything on this topic.
I want my python video plugin to receive the 'Play on XBMC' event, when you send something to XBMC with your device.
Just like the Youtube plugin does it. You can share to xbmc a youtube video and the plugin will make its stuff to play it on XBMC.
Can someone show me how to do it, or point me to the right direction, please.
Posts: 24
Joined: Aug 2014
Reputation:
1
Thanks for the reply tria.
By looking into the xbmc.log file, and using the Yatse remote app to send a video to my XBMC I realized the app is in deed parsing the youtube URL itself, calling the Youtube plugin with the correct URL through a Player.Open JSONRPC request just like you said.
For my application, what I would like to do is. Make my video plugin intercept any JSONRPC Player.Open request, check if the URL is from a website I want extract the video from, then change the URL and let XBMC play the correct video URL. I searched for ways to "intercept" a JSONRPC request. What I got is, to extend the xbmc.Monitor class and override the onNotification method to get the JSONRPC. But then came my doubts.
I just need to create a class in my video plugin that extends xbmc.Monitor, leave the code there, and xbmc will always call it upon receiving a JSONRPC request? Just by letting my video plugin Active?
Or maybe I need to create a python script, keep it alive with a 'while' loop so it can intercept the JSONRPC request.
And another one. Is it possible to change the URL in the request and let XBMC do it's thing to play the video, or I'll have to get the JSONRPC, stop XBMC from processing it and calling xbmc.Player().play myself to finally play the video?
Posts: 108
Joined: Jan 2012
Reputation:
2
tria
Senior Member
Posts: 108
I think you can only intercept, but you cannot prevent an event from occurring. Even when you intercept, you still need to parse the URLs (and the possible Script/Plugin URLs).
Extending xbmc.Monitor is a good start. Extending xbmc.Player, will give you the direct resolved link regardless of which plugin handled it (you can get the same information from xbmc.Monitor but with less details).
You shouldn't create a video plugin, but rather a script/service addon. Of course, you can have another video add-on to go with it, but generally the Monitor part should be in a service looping forever until it receives xbmc.abortRequested.
You cannot change or prevent any request as far as I know. As you suggested, you can intercept, parse/modify, and replay (stop-play).
Good Luck.