blummat0360 / bluecop-xbmc-repo

Automatically exported from code.google.com/p/bluecop-xbmc-repo
0 stars 0 forks source link

syfy.py -- More Mercury Men issues #121

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Try to play "The First World - Director's Notes Edition"
2.
3.

What is the expected output? What do you see instead?

Should play, gives an error due to a couple of issues.  That page doesn't use 
the <meta><base> headers, and the file format is different than expected.

What version of the product are you using? On what operating system?

Running xbmcbuntu/Eden with latest librtmp

Please provide any additional information below.

I went through a couple of attempted fixes but couldn't find something 
workable.  I refactored play() a bit and got it to work in my test cases but 
again YMMV.  I still have an issue with the video pausing right when it starts, 
but it otherwise appears to work fine.

Here is the refactored play().  Sorry for not submitting it as a patch.

def play():^M
    smilurl=common.args.url^M
    swfUrl = 'http://www.syfy.com/_utils/video/codebase/pdk/swf/flvPlayer.swf'^M
    data = common.getURL(smilurl)^M
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)^M
    print tree.prettify()^M
    items=tree.find('switch').findAll('video')^M
    hbitrate = -1^M
    sbitrate = int(common.settings['quality']) * 1024^M
    for item in items:^M
        bitrate = int(item['system-bitrate'])^M
        if bitrate > hbitrate and bitrate <= sbitrate:^M
            hbitrate = bitrate^M
            playpath = item['src']^M
            if 'http:' in playpath:
                finalurl = playpath
            else:
                # still could fail here, but if it does theres nothing we could do anyway.
                rtmpbase = tree.find('meta')['base']
                if '.mp4' in playpath:^M
                    playpath = 'mp4:'+playpath^M
                else:^M
                    playpath = playpath.replace('.flv','')^M
                finalurl = rtmpbase+' playpath='+playpath + " swfurl=" + swfUrl + " swfvfy=true"^M
    item = xbmcgui.ListItem(path=finalurl)^M
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)^M

Original issue reported on code.google.com by rfdr...@gmail.com on 18 Feb 2012 at 10:04

GoogleCodeExporter commented 8 years ago
Reposting without ^M on each line for clarity:

def play():
    smilurl=common.args.url
    swfUrl = 'http://www.syfy.com/_utils/video/codebase/pdk/swf/flvPlayer.swf'
    data = common.getURL(smilurl)
    tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
    print tree.prettify()
    items=tree.find('switch').findAll('video')
    hbitrate = -1
    sbitrate = int(common.settings['quality']) * 1024
    for item in items:
        bitrate = int(item['system-bitrate'])
        if bitrate > hbitrate and bitrate <= sbitrate:
            hbitrate = bitrate
            playpath = item['src']
            if 'http:' in playpath:
                finalurl = playpath
            else:
                # still could fail here, but if it does theres nothing we could do anyway.
                rtmpbase = tree.find('meta')['base']
                if '.mp4' in playpath:
                    playpath = 'mp4:'+playpath
                else:
                    playpath = playpath.replace('.flv','')
                finalurl = rtmpbase+' playpath='+playpath + " swfurl=" + swfUrl + " swfvfy=true"
    item = xbmcgui.ListItem(path=finalurl)
    xbmcplugin.setResolvedUrl(pluginhandle, True, item)

Original comment by rfdr...@gmail.com on 18 Feb 2012 at 10:05