コード例 #1
0
def make_list(round_id, match_id):

	__addon__ = xbmcaddon.Addon()
	quality = __addon__.getSetting('QUALITY')

	utils.log("Fetching video list for %s..." % match_id)

	# Show a dialog
	pDialog = xbmcgui.DialogProgress()
	pDialog.create(config.NAME, 'Fetching video list...')

	try:
		# fill media list
		videos = comm.get_match_video(round_id, match_id, quality)
		if videos:
			ok = True
			for v in videos:
				listitem = xbmcgui.ListItem(label=v['name'])	
				# I think this might help prevent the stream from closing early
				url = v['url'] + '?start=0'
				xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False)
			xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok)
		else:
			d = xbmcgui.Dialog()
			msg = utils.dialog_message("No videos found. Replays are only available 24-48 hours after match has been played. Please try again later.")
			d.ok(*msg)
	except:
		# user cancelled dialog or an error occurred
		d = xbmcgui.Dialog()
		msg = utils.dialog_error("Unable to fetch video list")
		d.ok(*msg)
		utils.log_error();
コード例 #2
0
def get_videos(channel_id):
    videos = []
    client = RemotingService(
        'http://nrl.bigpondvideo.com/App/AmfPhp/gateway.php')
    service = client.getService('Miscellaneous')
    params = {
        'navId': channel_id,
        'startRecord': '0',
        'howMany': '50',
        'platformId': '1',
        'phpFunction': 'getClipList',
        'asFunction': 'publishClipList'
    }

    videos_list = service.getClipList(params)
    if videos_list:
        for video_item in videos_list[0]['items']:
            video = parse_video(video_item)
            videos.append(video)
        return videos
    else:
        d = xbmcgui.Dialog()
        msg = utils.dialog_message("Video list returned no results.")
        d.ok(*msg)
        return
コード例 #3
0
def list_stations():

    __addon__ = xbmcaddon.Addon()

    # Show a dialog
    pDialog = xbmcgui.DialogProgress()
    pDialog.create(config.NAME, 'Fetching station list...')

    try:
        stations = comm.get_stations()

        if not stations:
            d = xbmcgui.Dialog()
            msg = utils.dialog_message(
                "No stations found. This is usually because no matches are currently being played. Please try again later."
            )
            d.ok(*msg)
            return

        utils.log("Found %s stations" % len(stations))

        ok = True
        for s in stations:

            station_name = utils.get_station_name(s['id'])

            thumb = os.path.join(__addon__.getAddonInfo('path'), "resources",
                                 "img", "%s.jpg" % s['id'])

            listitem = xbmcgui.ListItem(station_name)
            labels = {"title": station_name, "genre": "Sport"}

            listitem.setInfo(type='music', infoLabels=labels)
            listitem.setThumbnailImage(thumb)

            params = utils.make_url({
                "id": s['id'],
                "name": station_name,
                "url": s['streamURL']
            })

            url = "%s?%s" % (sys.argv[0], params)

            # Add the item to the list
            ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                             url=url,
                                             listitem=listitem,
                                             isFolder=True,
                                             totalItems=len(stations))

        xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok)
    except:
        # user cancelled dialog or an error occurred
        d = xbmcgui.Dialog()
        msg = utils.dialog_error("Unable to fetch station list")
        d.ok(*msg)
        utils.log_error()
コード例 #4
0
def play(url):
    params = utils.get_url(url)

    p = classes.Program()
    p.parse_xbmc_url(url)

    program_id = comm.get_program_id(params['url_path'])
    stream = comm.get_stream(program_id)

    # Plus7 has returned a specific error
    if stream.has_key('error'):
        d = xbmcgui.Dialog()
        msg = utils.dialog_message("Unable to play video:\n%s" %
                                   stream['error'])
        d.ok(*msg)
        return

    try:
        # RTMP URL isn't available
        if stream.has_key('rtmp_host'):
            # Build the final RTMP Url. New syntax for external librtmp
            # http://trac.xbmc.org/ticket/8971
            rtmp_url = "%s playpath=%s swfurl=%s swfvfy=true" % (
                stream['rtmp_host'], stream['rtmp_path'], config.swf_url)
            listitem = xbmcgui.ListItem(label=p.title,
                                        iconImage=p.thumbnail,
                                        thumbnailImage=p.thumbnail)
            listitem.setInfo('video', p.get_xbmc_list_item())
            xbmc.Player().play(rtmp_url, listitem)
        else:
            d = xbmcgui.Dialog()
            msg = utils.dialog_message(
                "Unable to play video:\nStream URL not found.")
            d.ok(*msg)
            return
    except:
        # oops print error message
        d = xbmcgui.Dialog()
        message = utils.dialog_error("Unable to play video")
        d.ok(*message)
        utils.log_error()
コード例 #5
0
ファイル: play.py プロジェクト: illawarrior/xbmc-addon-plus7
def play(url):
	params = utils.get_url(url)	

	p = classes.Program()
	p.parse_xbmc_url(url)

	program_id = comm.get_program_id(params['url_path'])
	stream = comm.get_stream(program_id)

	# Plus7 has returned a specific error
	if stream.has_key('error'):
		d = xbmcgui.Dialog()
		msg = utils.dialog_message("Unable to play video:\n%s" % stream['error'])
		d.ok(*msg)
		return

	try:
		# RTMP URL isn't available
		if stream.has_key('rtmp_host'):
			# Build the final RTMP Url. New syntax for external librtmp
			# http://trac.xbmc.org/ticket/8971
			rtmp_url = "%s playpath=%s" % (stream['rtmp_host'], stream['rtmp_path'])
			listitem=xbmcgui.ListItem(label=p.title, iconImage=p.thumbnail, thumbnailImage=p.thumbnail)
			listitem.setInfo('video', p.get_xbmc_list_item())
			xbmc.Player().play(rtmp_url, listitem)
		else:
			d = xbmcgui.Dialog()
			msg = utils.dialog_message("Unable to play video:\nStream URL not found.")
			d.ok(*msg)
			return
	except:
		# oops print error message
		d = xbmcgui.Dialog()
		message = utils.dialog_error("Unable to play video")
		d.ok(*message)
		utils.log_error();
コード例 #6
0
def get_videos(channel_id):
	videos = []
	client = RemotingService('http://nrl.bigpondvideo.com/App/AmfPhp/gateway.php')
	service = client.getService('Miscellaneous')
	params = {
		'navId': channel_id, 
		'startRecord': '0', 
		'howMany': '50', 
		'platformId': '1', 
		'phpFunction': 'getClipList', 
		'asFunction': 'publishClipList'
	}
	
	videos_list = service.getClipList(params)
	if videos_list:
		for video_item in videos_list[0]['items']:
			video = parse_video(video_item)
			videos.append(video)
		return videos
	else:
		d = xbmcgui.Dialog()
		msg = utils.dialog_message("Video list returned no results.")
		d.ok(*msg)
		return