def PLAY_STREAM(name,url,iconimage):
quality = int(__settings__.getSetting('live_stream'))
if len(url)>4:
STREAM=url
else:
SoapMessage=TEMPLATE(url,'itv'+url.replace('sim',''))
headers={'Content-Length':'%d'%len(SoapMessage),'Content-Type':'text/xml; charset=utf-8','Host':'mercury.itv.com','Origin':'http://www.itv.com','Referer':'http://www.itv.com/Mercury/Mercury_VideoPlayer.swf?v=null','SOAPAction':"http://tempuri.org/PlaylistService/GetPlaylist",'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}
res, response = http.request("http://mercury.itv.com/PlaylistService.svc", 'POST', headers=headers, body=SoapMessage)
rtmp=re.compile('<MediaFiles base="(.+?)"').findall(response)[0]
if 'CITV' in name:
r='CDATA\[(citv.+?)\]'
else:
r='CDATA\[(itv.+?)\]'
playpath=re.compile(r,re.DOTALL).findall(response)
if (quality == 0):
playpath = playpath[0]
elif (quality == 1):
playpath = playpath[1]
elif (quality == 2):
playpath = playpath[2]
elif (quality == 3):
playpath = playpath[3]
elif (quality == 4):
playpath = playpath[4]
STREAM=rtmp+' playpath='+playpath+' swfUrl=http://www.itv.com/mediaplayer/ITVMediaPlayer.swf live=true timeout=10 swfvfy=true'
liz = xbmcgui.ListItem(name, iconImage='DefaultVideo.png', thumbnailImage=iconimage)
liz.setInfo(type='Video', infoLabels={'Title':name})
liz.setProperty("IsPlayable","true")
liz.setPath(STREAM)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
评论列表
文章目录