Call a script from HTTP/JSON
#1
Question 
is it possible to call a script URL from the HTTP or JSON API?

My example is I want to access the iPlayer plugin to play an iPlayer file.

From looking in the iPlayerv2 plugin I think that the URL would be:

plugin://plugin.video.iplayer/?pid=b00jz2t4

which would cause it to start showing an iPlayer episode. However I don't know how to call this from a remote API.

Whether this is the right way to do it is another question. I was looking into whether the iPlayer plugin could define it's own protocol handler e.g.
iplayer://b00jz2t4/ and translate it into a rtmp:// url for the playlist handler to handle. However I doubt it's possible to create python protocol handler translators (something to add to the 'to-do in the far future' list?)

I'll keep looking, but if anyone familiar with this has an answer that would be great. Thanks!
Reply
#2
you can send a play call on url plugin://plugin.video.iplayer/?pid=b00jz2t4 if that is correct url.

Code:
{ "jsonrpc": "2.0", "method": "XBMC.Play", "params": "plugin://plugin.video.iplayer/?pid=b00jz2t4", "id": 1 }

IIRC
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#3
Interesting, I tried that with curl, and it shows the first frame of the video, and then exits. Looking through the debug block shows this is where it stops:

Code:
6:44:11 T:3021797248 M:3696136192  NOTICE: Created m_glPixmapTexture (1)
16:44:11 T:3021797248 M:3696136192   DEBUG: ------ Window Deinit (DialogBusy.xml) ------
16:44:11 T:2713684848 M:3696136192    INFO: Scriptresult: Success
16:44:11 T:2713684848 M:3696136192    INFO: Python script stopped
16:44:11 T:2713684848 M:3696136192   DEBUG: Thread 2713684848 terminating
16:44:11 T:3021797248 M:3696136192   DEBUG:  WaitOnScriptResult - plugin exited prematurely - terminating
16:44:11 T:3021797248 M:3696136192   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.iplayer/?pid=b00jz2t4]
16:44:11 T:3021797248 M:3696136192   DEBUG: Playlist Player: no more playable items... aborting playback

This appears to mean the script passes off the RTMP stream to the DVD player, and then exits (without giving the right error code). The player catches the exiting of the script as the end of the video (beliveing it to be unplayable?).

Has this usage of a python script to handle a video been thought about, or is this new? Should the script stay running until the program completes (what happens if we exit ourselves) or does it just need to pass the correct return code?

More worryingly. If i run the command again XBMC hangs. the last stuff in xbmc.log is


Code:
16:57:24 T:2785151856 M:3672379392  NOTICE: iplayer2.py: INFO Reusing existing thumbfile =/home/alex/.xbmc/userdata/Thumbnails/Video/f/f91ae172.tbn for url plugin://plugin.video.iplayer/?pid=b00jz2t4
16:57:24 T:2785151856 M:3672379392  NOTICE: .
16:57:24 T:2785151856 M:3672379392  NOTICE: iplayer2.py: INFO Stream XML URL: http://www.bbc.co.uk/mediaselector/4/mtis/stream/b00jz2mx
16:57:24 T:2785151856 M:3672379392  NOTICE: .
16:57:24 T:2785151856 M:3672379392  NOTICE: iplayer2.py: INFO URL Fetch took 0.00 sec for http://www.bbc.co.uk/mediaselector/4/mtis/stream/b00jz2mx
16:57:24 T:2785151856 M:3672379392  NOTICE: .
16:57:24 T:2785151856 M:3672379392  NOTICE: iplayer2.py: INFO watching url=rtmp://bbcmedia.fcod.llnwd.net:1935/ app=a1414/e3?as=adobe-hmac-sha256&av=1&te=connect&mp=iplayerstream/secure_auth/1500kbps/MP/b00jz2mx_1293729314.mp4,iplayerstream/secure_auth/800kbps/MP/b00jz2mx_1293728993.mp4,iplayerstream/secure_auth/480kbps/MP/b00jz2mx_1293729314.mp4,iplayerstream/secure_auth/400kbps/b00jz2mx_1293729311.mp4&et=1294079791&fmta-token=80cea546e3d874d1288ccbed7d986222a2d6d214d23a7575d833eb6b73773972 tcurl=rtmp://bbcmedia.fcod.llnwd.net:1935/a1414/e3?as=adobe-hmac-sha256&av=1&te=connect&mp=iplayerstream/secure_auth/1500kbps/MP/b00jz2mx_1293729314.mp4,iplayerstream/secure_auth/800kbps/MP/b00jz2mx_1293728993.mp4,iplayerstream/secure_auth/480kbps/MP/b00jz2mx_1293729314.mp4,iplayerstream/secure_auth/400kbps/b00jz2mx_1293729311.mp4&et=1294079791&fmta-token=80cea546e3d874d1288ccbed7d986222a2d6d214d23a7575d833eb6b73773972 playpath=mp4:iplayerstream/secure_auth/800kbps/MP/b00jz2mx_1293728993.mp4 swfurl=http://www.bbc.co.uk/emp/10player.swf swfvfy=true timeout=600
16:57:24 T:2785151856 M:3672379392  NOTICE: .
16:57:24 T:2785151856 M:3672379392  NOTICE: iplayer2.py: INFO Playing preference h264 800
16:57:24 T:2785151856 M:3672379392  NOTICE: .

it stops on the
player.play(play)
line in default.py
Reply

Logout Mark Read Team Forum Stats Members Help
Call a script from HTTP/JSON0