Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #FreedoCast.com script for XBMC, by stacked (11/21/09)
- #Input stream name at keyboard prompt
- import xbmc, xbmcgui, urllib2, urllib, re, string
- HEADER = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1'
- searchStr = 'http://www.freedocast.com/'
- keyboard = xbmc.Keyboard(searchStr, "Enter stream name:")
- keyboard.doModal()
- if (keyboard.isConfirmed() == False):
- dialog = xbmcgui.Dialog()
- ok = dialog.ok('FreedoCast.com', 'Error: No stream found.')
- xbmc.executebuiltin( "Container.Refresh" )
- searchstring = keyboard.getText()
- newStr = searchstring.replace(' ','%20')
- if len(newStr) == 0:
- dialog = xbmcgui.Dialog()
- ok = dialog.ok('FreedoCast.com', 'Error: No stream found.')
- xbmc.executebuiltin( "Container.Refresh" )
- url=newStr
- name=url
- req = urllib2.Request(url)
- req.add_header('User-Agent', HEADER)
- content=urllib2.urlopen(req)
- data=content.read()
- content.close()
- freeid=re.compile('fid=\'(.+?)\';ftype').findall(data)[0]
- url='http://www.freedocast.com/forms/watchstream.aspx?sc='+freeid
- req = urllib2.Request(url)
- req.add_header('User-Agent', HEADER)
- req.add_header('Referer', 'http://www.freedocast.com')
- content=urllib2.urlopen(req)
- data=content.read()
- content.close()
- if data.find('rtmp') != -1:
- tcUrl=re.compile('netConnectionUrl:\'(.+?)\'\r\n', re.DOTALL).findall(data)[0]
- swfUrl=re.compile('src:\'(.+?)\'').findall(data)[0]
- playPath=re.compile('url:\'(.+?)\'').findall(data)[0]
- pageUrl='http://www.freedocast.com/forms/PopOut.aspx?sc='+freeid
- thumb = xbmc.getInfoImage( "ListItem.Thumb" )
- item = xbmcgui.ListItem(name, iconImage=thumb, thumbnailImage=thumb)
- item.setInfo( type="Video", infoLabels={ "Title": name, "Director": 'FreedoCast.com', "Studio": 'FreedoCast.com' } )
- item.setProperty("SWFPlayer", swfUrl)
- item.setProperty("PlayPath", playPath)
- item.setProperty("PageURL", pageUrl)
- item.setProperty("IsLive", "true")
- item.setProperty("tcUrl", tcUrl)
- xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(tcUrl, item)
- else:
- dialog = xbmcgui.Dialog()
- ok = dialog.ok('FreedoCast.com', 'Error: Not a live stream.')
- xbmc.executebuiltin( "Container.Refresh" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement