A little help on Addon would be appreciated

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #1
Hey guys,

So first let me say I'm not familiar how to setup RTMP video addons and I believe that is what this is (coming from my Wireshark output), but here goes nothing.

I just started working on a Futurama Addon for Comedy Central, this is a very rough draft and does not have any fine visual and performance tweaks yet:

https://github.com/jness/plugin.video.fu...default.py

The issue I'm having is pulling on the Stream which I believe to be in this blob of HTML (from Comedy Central site):

[HTML]
<object id="full_ep_video_player" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="768" height="432" xmlns:media="http://search.yahoo.com/searchmonkey/media/" rel="media:video" resource="http://media.mtvnservices.com/mgid:cms:fullepisode:comedycentral.com:343175" xmlnsBig Grinc="http://purl.org/dc/terms/">
<param name="movie" value="http://media.mtvnservices.com/mgid:cms:fullepisode:comedycentral.com:343175"/>
<param name="wmode" value="opaque"/>
<param name="bgcolor" value="#000000"/>
<param name="seamlesstabbing" value="true"/>
<param name="swliveconnect" value="true"/>
<param name="allowscriptaccess" value="always"/>
<param name="allownetworking" value="all"/>
<param name="allowfullscreen" value="true"/>
<param name="flashvars" value="page not found&amp;autoPlay=true&amp;configParams=site%3Dcomedycentral.com"/>
[/HTML]

I've been able to download the resource (http://media.mtvnservices.com/mgid:cms:f...com:343175) using wget and a proper user-agent and it appears to be a valid Flash content (most likely partial as I did not use rtmp functions):

Code:
$ file tmp.movie
tmp.movie: Macromedia Flash data (compressed), version 10

However when I run this addon I get the following in my xbmc.log:

Code:
09:27:16 T:2957742080 M:651608064  NOTICE: -->Python Interpreter Initialized<--
09:27:16 T:2957742080 M:650354688  NOTICE: Mode: None
09:27:16 T:2957742080 M:650354688  NOTICE: URL: None
09:27:16 T:2957742080 M:650354688  NOTICE: Name: None
09:27:18 T:2957209600 M:649023488  NOTICE: -->Python Interpreter Initialized<--
09:27:18 T:2957209600 M:649007104  NOTICE: Mode: 1
09:27:18 T:2957209600 M:649007104  NOTICE: URL: http://www.comedycentral.com/full-episodes/futurama
09:27:18 T:2957209600 M:649007104  NOTICE: Name: Futurama
09:27:18 T:2957209600 M:649007104  NOTICE: http://www.comedycentral.com/full-episodes/futurama
09:27:20 T:2957209600 M:648720384  NOTICE: -->Python Interpreter Initialized<--
09:27:21 T:2957209600 M:648630272  NOTICE: Mode: 2
09:27:21 T:2957209600 M:648630272  NOTICE: URL: http://www.comedycentral.com/full-episodes/futurama/607-the-late-philip-j--fry
09:27:21 T:2957209600 M:648630272  NOTICE: Name: 607-the-late-philip-j--fry
09:27:21 T:2957209600 M:648630272  NOTICE: http://www.comedycentral.com/full-episodes/futurama/607-the-late-philip-j--fry
09:27:21 T:2957209600 M:648630272   ERROR:  EndOfDirectory - called with an invalid handle.
09:27:21 T:2689963328 M:648695808  NOTICE: DVDPlayer: Opening: http://media.mtvnservices.com/mgid:cms:fullepisode:comedycentral.com:343175
09:27:21 T:2689963328 M:648695808 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
09:27:21 T:2955046912 M:648687616  NOTICE: Creating InputStream
09:27:22 T:2955046912 M:648302592  NOTICE: Creating Demuxer
09:27:22 T:2955046912 M:647643136   ERROR: Open - Error, could not open file http://media.mtvnservices.com/mgid:cms:fullepisode:comedycentral.com:343175
09:27:22 T:2955046912 M:647643136   ERROR: OpenDemuxStream - Error creating demuxer
09:27:22 T:2955046912 M:647643136  NOTICE: CDVDPlayer::OnExit()
09:27:22 T:2955046912 M:647639040  NOTICE: CDVDPlayer::OnExit() deleting input stream
09:27:22 T:2689963328 M:648077312  NOTICE: CDVDPlayer::CloseFile()
09:27:22 T:2689963328 M:648077312 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
09:27:22 T:2689963328 M:648077312  NOTICE: DVDPlayer: waiting for threads to exit
09:27:22 T:2689963328 M:648126464  NOTICE: DVDPlayer: finished waiting

Anyone got thoughts?
find quote
jbel Offline
Senior Member
Posts: 109
Joined: Apr 2009
Reputation: 5
Location: nyc
Post: #2
You have a little more work to do, it's not gonna be that easy Wink

The comedy central site uses RTMP streaming. At some point your browser will make a request to this url:

Code:
http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?uri=mgid%3Acms%3Afullepisode%3Acomedycentral.com%3A3​89806

It should return an XML document like this:

Code:
<package version="1.4">

<video>    
<item startTime="0">

<rendition cdn="akamai" duration="521" width="512" height="288" type="video/mp4" bitrate="450">
<src>rtmpe://cp9950.edgefcs.net/ondemand/mtvnorigin/gsp.comedystor/com/futurama/full_episodes/futurama_607_act2_rev_512x288_450.mp4</src>
</rendition>

<rendition cdn="akamai" duration="521" width="768" height="432" type="video/mp4" bitrate="640">
<src>rtmpe://cp9950.edgefcs.net/ondemand/mtvnorigin/gsp.comedystor/com/futurama/full_episodes/futurama_607_act2_rev_768x432_640.mp4</src>
</rendition>

<rendition cdn="akamai" duration="521" width="768" height="432" type="video/mp4" bitrate="960">
<src>rtmpe://cp9950.edgefcs.net/ondemand/mtvnorigin/gsp.comedystor/com/futurama/full_episodes/futurama_607_act2_rev_768x432_960.mp4</src>
</rendition>

<rendition cdn="akamai" duration="521" width="768" height="432" type="video/mp4" bitrate="1300">
<src>rtmpe://cp9950.edgefcs.net/ondemand/mtvnorigin/gsp.comedystor/com/futurama/full_episodes/futurama_607_act2_rev_768x432_1300.mp4</src>
</rendition>

<rendition cdn="akamai" duration="521" width="768" height="432" type="video/mp4" bitrate="1720">
<src>rtmpe://cp9950.edgefcs.net/ondemand/mtvnorigin/gsp.comedystor/com/futurama/full_episodes/futurama_607_act2_rev_768x432_1720.mp4</src>
</rendition>

<beacons>

<beacon url="http://imx.comedycentral.com/sitewide/droplets/view_gen.jhtml?itemUrl=cms_item%3A%2F%2Fwww.comedycentral.com%2F389806&amp;tagParams=tag_action%3Dviewed%26" startTime="0" />

</beacons>

<action onEvent="viewed">    
<makeRequest url="http://t.flux.com/tracking.gif?CMU=4CFAFFFF009922C10002FFFFFA4C&amp;CUR=mgid:cms:fullepisode:comedycentral.com:389806&amp;WN=MTVNVideoPlayer&amp;ftg=1"/>
</action>    

</item>

</video>
</package>

You'll have to then pass the RTMP parameters to XBMC to play it. Hope this points you in the right direction.
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #3
Wow jbel,

This certainly helps out!, only question I have is where did you happen to find the URL to that XML (cant seem to find it from the source):

Code:
http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?uri=mgid%3Acms%3Afullepisode%3Acomedycentral.com%3A3​89806

Thanks for the help, and going easy on some of my lacking XBMC knowledge.
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #4
flip387 Wrote:Wow jbel,

This certainly helps out!, only question I have is where did you happen to find the URL to that XML (cant seem to find it from the source):

Code:
http://www.comedycentral.com/global/feeds/entertainment/media/mediaGenEntertainment.jhtml?uri=mgid%3Acms%3Afullepisode%3Acomedycentral.com%3A3​89806

Thanks for the help, and going easy on some of my lacking XBMC knowledge.

Ah ok, I see this is an example not related to the above. I'll do some more digging and find some sort of XML (maybe this one):

Code:
http://repo.comedycentral.com/feeds/init/comedycentral.com?url=/full-episodes/futurama/610-the-prisoner-of-benda&cmsPageId=
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #5
Think I'm making a bit of progress.

I've found Bluecop's Python source which pulls the same XML from media.mtvnservices.com:

Code:
def PLAYEPISODE(name,url):
        data = getURL(url)
        uri=re.compile('<param name="movie" value="http://media.mtvnservices.com/(.+?)"').findall(data)[0]
        url = 'http://media.mtvnservices.com/player/config.jhtml?uri='+uri+'&group=entertainment&type=network&site=thedailyshow.com'
        data = getURL(url)
        uris=re.compile('<guid isPermaLink="false">(.+?)</guid>').findall(data)
        playlist = xbmc.PlayList(1)
        playlist.clear()
        for uri in uris:
            rtmp = GRAB_RTMP(uri)
            item = xbmcgui.ListItem(name)
            playlist.add(rtmp, item)
        xbmc.Player().play(playlist)
        xbmc.executebuiltin('XBMC.ActivateWindow(fullscreenvideo)')

The URL he is building looks something like:

Code:
http://media.mtvnservices.com/player/config.jhtml?uri=mgid:cms:fullepisode:comedycentral.com:359623&group=entertainment&type=network&site=thedailyshow.com

Seems I'm having issues generating a similar URL.....

I've been trying links similar to the below:

Code:
http://media.mtvnservices.com/player/config.jhtml?uri=mgid:cms:fullepisode:comedycentral.com:351726&group=entertainment&type=normal&site=comedycentral.com
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #6
Getting a bit closer:

Code:
http://media.mtvnservices.com/pmt/e1/players/mgid:cms:fullepisode:comedycentral.com:/context4/config.xml?uri=mgid:cms:fullepisode:comedycentral.com:351726&type=normal&ref=None&geo=US&group=entertainment&
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #7
Bam!! I tracked it down:

http://www.comedycentral.com/global/feed...com:388022

Now just to reproduce these number of steps haha
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #8
Think I got it working:

https://github.com/jness/plugin.video.futurama

I'll have to wait till I get home to test it as it does not seem my Mac XBMC install likes RTMP streams...

If anyone wants to try it out and give some feedback I would appreciate it.
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #9
Ok, so I've done some testing from my home XBMC box and everything works great... Until RTMP tries to communicate:

Code:
17:24:29 T:3079337856 M:1266855936  NOTICE: Created m_glPixmapTexture (49)
17:25:29 T:2911894384 M:1264631808   ERROR: RTMP_ReadPacket, failed to read RTMP packet header
17:25:34 T:2791660400 M:1264275456 WARNING: CDVDMessageQueue(audio)::Get - asked for new data packet, with nothing available
17:25:34 T:2802150256 M:1264332800 WARNING: CDVDMessageQueue(video)::Get - asked for new data packet, with nothing available
17:25:34 T:2911894384 M:1264332800  NOTICE: CDVDPlayer::OnExit()
17:25:34 T:2911894384 M:1264332800  NOTICE: DVDPlayer: eof, waiting for queues to empty

I'm going to do some research on this, but if anyone has some quick answers I would appreciate it Smile

A little more to go on, I was replacing rtmpe to rtmp, but when reverting back to rtmpe I receive:

Code:
17:29:44 T:3079337856 M:1283801088 WARNING: HandShake: Type mismatch: client sent 6, server answered 9
17:29:44 T:3079337856 M:1283903488 WARNING: HandShake: Server not genuine Adobe!
17:29:44 T:3079337856 M:1283903488   ERROR: RTMP_Connect1, handshake failed.

Found this.... http://forum.xbmc.org/showpost.php?p=735...stcount=88
(This post was last modified: 2011-06-25 00:31 by flip387.)
find quote
flip387 Offline
Junior Member
Posts: 36
Joined: Jul 2010
Reputation: 0
Post: #10
Tried rebuilding the latest librtmp trunk but still getting an error:

Code:
17:56:18 T:2911894384 M:1250398208   ERROR: WriteN, RTMP send error 32 (42 bytes)
17:56:18 T:2911894384 M:1250398208   ERROR: RTMP_ReadPacket, failed to read RTMP packet header
17:56:26 T:2812640112 M:1250635776 WARNING: CDVDMessageQueue(audio)::Get - asked for new data packet, with nothing available
17:56:26 T:2802150256 M:1250635776 WARNING: CDVDMessageQueue(video)::Get - asked for new data packet, with nothing available

Rebuilding was suggested http://code.google.com/p/bluecop-xbmc-re...?id=28#c13
find quote
Post Reply