当前位置: 首页>>代码示例>>Python>>正文


Python xbmcplugin.setResolvedUrl方法代码示例

本文整理汇总了Python中xbmcplugin.setResolvedUrl方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcplugin.setResolvedUrl方法的具体用法?Python xbmcplugin.setResolvedUrl怎么用?Python xbmcplugin.setResolvedUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbmcplugin的用法示例。


在下文中一共展示了xbmcplugin.setResolvedUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: resolve_url

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def resolve_url(self, stream_url):
        '''
        Tell XBMC that you have resolved a URL (or not!).
        
        This method should be called as follows:
        
        #. The user selects a list item that has previously had ``isPlayable``
           set (this is true for items added with :meth:`add_item`, 
           :meth:`add_music_item` or :meth:`add_music_item`)
        #. Your code resolves the item requested by the user to a media URL
        #. Your addon calls this method with the resolved URL
        
        Args:
            stream_url (str or ``False``): If a string, tell XBMC that the 
            media URL ha been successfully resolved to stream_url. If ``False`` 
            or an empty string tell XBMC the resolving failed and pop up an 
            error messsage.
        '''
        if stream_url:
            self.log_debug('resolved to: %s' % stream_url)
            xbmcplugin.setResolvedUrl(self.handle, True, 
                                      xbmcgui.ListItem(path=stream_url))
        else:
            self.show_error_dialog(['sorry, failed to resolve URL :('])
            xbmcplugin.setResolvedUrl(self.handle, False, xbmcgui.ListItem()) 
开发者ID:mrknow,项目名称:filmkodi,代码行数:27,代码来源:addon.py

示例2: play

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play(url, id=0):
	print url
	engine=__settings__.getSetting("Engine")
	if engine=="0":
		play_ace(url, id)
		
	if engine=="1":
		item = xbmcgui.ListItem()#path=url
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
		tthp.play(url, handle, id, __settings__.getSetting("DownloadDirectory"))
		
	if engine=="2":
		purl ="plugin://plugin.video.yatp/?action=play&torrent="+ urllib.quote_plus(url)+"&file_index="+str(id)
		item = xbmcgui.ListItem()#path=purl
		xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
		xbmc.Player().play(purl) 
开发者ID:tdw1980,项目名称:tdw,代码行数:18,代码来源:default.py

示例3: play_video

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_video(video_url = common.args.url):
	hbitrate = -1
	sbitrate = int(addon.getSetting('quality')) * 1024
	closedcaption = None
	video_data = connection.getURL(video_url)
	video_tree = BeautifulSoup(video_data, 'html.parser')
	finalurl = video_tree.video['src']
	try:
		closedcaption = video_tree.find('textstream', type = 'text/vtt')['src']
	except:
		pass
	if (addon.getSetting('enablesubtitles') == 'true') and (closedcaption is not None):
			convert_subtitles(closedcaption)
	xbmcplugin.setResolvedUrl(pluginHandle, True, xbmcgui.ListItem(path = finalurl))
	if (addon.getSetting('enablesubtitles') == 'true') and (closedcaption is not None):
		while not xbmc.Player().isPlaying():
			xbmc.sleep(100)
		xbmc.Player().setSubtitles(ustvpaths.SUBTITLE) 
开发者ID:moneymaker365,项目名称:plugin.video.ustvvod,代码行数:20,代码来源:msnbc.py

示例4: play_video

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_video(video_uri = common.args.url):
	# Handle the poewrnation specific video loading
	if 'powernation' in video_uri:
		video_data = connection.getURL(video_uri)
		video_json = json.loads(video_data)
		video_url = video_json['HLSURL']
		
		item = xbmcgui.ListItem(path = video_url)
		try:
			item.setThumbnailImage(common.args.thumb)
		except:
			pass
		try:
			item.setInfo('Video', {	'title' : common.args.name,
									'season' : common.args.season_number,
									'episode' : common.args.episode_number,
									'TVShowTitle' : common.args.show_title})
		except:
			pass
		xbmcplugin.setResolvedUrl(pluginHandle, True, item)
	else:
		video_data = connection.getURL(video_uri)
		video_url = BeautifulSoup(video_data, 'html5lib').find('div', class_ = 'video_player')['data-mgid']
		main_viacom.play_video(BASE, video_url) 
开发者ID:moneymaker365,项目名称:plugin.video.ustvvod,代码行数:26,代码来源:spike.py

示例5: play_video

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_video(episode_url = common.args.url):
	episode_data = connection.getURL(APIBASE + 'episode-details?episode_id=' + episode_url)
	episode_json = json.loads(episode_data)
	video_url = VIDEOURL % episode_json['data']['Episode']['FullEpisode']['PID']
	print video_url
	video_data = connection.getURL(video_url)
	video_tree = BeautifulSoup(video_data)
	finalurl = video_tree.video['src']
	item = xbmcgui.ListItem(path = finalurl)
	try:
		item.setThumbnailImage(common.args.thumb)
	except:
		pass
	try:
		item.setInfo('Video', {	'title' : common.args.name,
								'season' : common.args.season_number,
								'episode' : common.args.episode_number,
								'TVShowTitle' : common.args.show_title})
	except:
		pass
	xbmcplugin.setResolvedUrl(pluginHandle, True, item) 
开发者ID:moneymaker365,项目名称:plugin.video.ustvvod,代码行数:23,代码来源:amc.py

示例6: play_video

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_video(video_url = common.args.url):
	stored_size = 0
	video_data = connection.getURL(video_url)
	video_model = re.compile('model: *(\[.*\]),\s*videoPlayer: _player,', re.DOTALL).findall(video_data)[0]
	video_model = simplejson.loads(video_model)
	try:
		sbitrate = long(addon.getSetting('quality')) * 1000
	except Exception as e:
		print "Exception: ", e
	hbitrate = -1
	print sbitrate
	for item in video_model[0]['flavors']:
		if item['format'] == 'mp4' and item['security_profile'][0] == 'progressive':
			bitrate = item['bitrate']
			if bitrate > hbitrate and bitrate <= sbitrate:
				hbitrate = bitrate
				url = item['url']
	finalurl = url
	xbmcplugin.setResolvedUrl(pluginHandle, True, xbmcgui.ListItem(path = finalurl)) 
开发者ID:moneymaker365,项目名称:plugin.video.ustvvod,代码行数:21,代码来源:marvelkids.py

示例7: resolve

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def resolve(name, url, iconimage, description):
    host = url
    if host.split('|')[0].endswith('.mp4') and 'clou' in host:
        stream_url = host + '|User-Agent=%s&Referer=%s' % (urllib.quote_plus(client.agent(), ':/'), GAMATO)
        name = name
    elif 'tenies-online' in host:
        stream_url = client.request(host)
        stream_url = client.parseDOM(stream_url, 'a', {'id': 'link'}, ret='href')[0]
        stream_url = evaluate(stream_url)
    else:
        stream_url = evaluate(host)
        name = name.split(' [B]|')[0]
    try:
        liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": description})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(str(stream_url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except BaseException:
        control.infoDialog(Lang(32012), NAME) 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:22,代码来源:default.py

示例8: resolve

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def resolve(name, url, iconimage, description):
    stream_url = evaluate(url)
    name = name.split(' [B]|')[0]
    if stream_url is None:
        control.infoDialog('Prueba otro enlace', NAME, ICON, 4000)
    elif '.mpd|' in stream_url:
        stream_url, headers = stream_url.split('|')
        listitem = xbmcgui.ListItem(path=stream_url)
        listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
        listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
        listitem.setMimeType('application/dash+xml')
        listitem.setProperty('inputstream.adaptive.stream_headers', headers)
        listitem.setContentLookup(False)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
    else:
        try:
            liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
            liz.setInfo(type="Video", infoLabels={ "Title": name, "Plot": description })
            liz.setProperty("IsPlayable", "true")
            liz.setPath(str(stream_url))
            xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
        except:
            control.infoDialog('Prueba otro enlace', NAME, ICON, 4000) 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:25,代码来源:default.py

示例9: play_radio

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_radio(params):
    
    cid = int(params.get('channel_id',None))
    media_url = None
    
    common.plugin.log("play_radio #{0}".format(cid))

    channel = api.get_single_channel(cid)
    
    if channel:
        common.plugin.log(json.dumps(channel))
        stream_node = channel.get('streamurl',None)

        if stream_node:
            media_url = stream_node.get('mp3','').encode('utf-8').strip()
        
    if not media_url:
        common.plugin.log_error("unable to get the radio stream URL.")
        common.popup("Impossible de trouver le flux radio")
        
    #play
    liz = xbmcgui.ListItem(path=media_url)
    return xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=liz) 
开发者ID:rickybiscus,项目名称:plugin.video.auvio,代码行数:25,代码来源:main.py

示例10: next_track

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def next_track(self):
        '''special entry which tells the remote connect player to move to the next track'''
        
        cur_playlist_position = xbmc.PlayList(xbmc.PLAYLIST_MUSIC).getposition()
        # prevent unintentional skipping when Kodi track ends before connect player
        # playlist position will increse only when play next button is pressed
        if cur_playlist_position > self.last_playlist_position:
            # move to next track
            self.sp.next_track()
            # give time for connect player to update info
            xbmc.sleep(100)
            
        self.last_playlist_position = cur_playlist_position
        cur_playback = self.sp.current_playback()
        trackdetails = cur_playback["item"]
        url, li = parse_spotify_track(trackdetails, silenced=True)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, li) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:19,代码来源:plugin_content.py

示例11: play

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play(self, stream, url_main):
        if 'm3u8' in stream:
            print "M3U8"
            url = stream
        else:
            print "RTMP"
            url = stream
            url += " swfUrl=http://tivix.co/templates/Default/style/uppod.swf"
            url += " pageURL=http://tivix.co"
            url += " swfVfy=true live=true"

        try:         
            item = xbmcgui.ListItem(path = url + "|Referer="+url_main)
            xbmcplugin.setResolvedUrl(self.handle, True, item)
        except:
            self.showErrorMessage("The channel is not available") 
开发者ID:dandygithub,项目名称:kodi,代码行数:18,代码来源:default.py

示例12: play

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play(url, direct):
    if (direct != 1) and ("m3u8" in url):
        url = ("http:" if (not (("http://" in url) or ("https://" in url))) else "") + url
        response = common.fetchPage({"link": url})
        if (not (("http://" in response["content"]) or ("https://" in response["content"]))):
            content = response["content"].split("\n")
            name = os.path.join(PATH.decode("utf-8"), 'resources/playlists/') + "temp.m3u8"
            block = url.split("mp4")[0]
            f = open(name, "w+")
            for line in content:
               if "mp4" in line:
                   line = block + "mp4" + line.split("mp4")[-1]
               f.write(line + "\n")
            f.close()
            item = xbmcgui.ListItem(path=name)
        else:
            item = xbmcgui.ListItem(path=url) 
    else:
        item = xbmcgui.ListItem(path=url) 
    xbmcplugin.setResolvedUrl(HANDLE, True, item) 
开发者ID:dandygithub,项目名称:kodi,代码行数:22,代码来源:plugin.py

示例13: play

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play(self, url):
        print "Play media URL: %s" % url

        hd = True if  self.addon.getSetting('hd_youtube_videos') == 'true' else False
        supported_resolutions = ['720p', '1080p'] if hd else ['360p', '480p']
        video_url = ''

        try:
            if 'youtube' in url:
                yt.url = url
                video_url = yt.videos[-1].url
            else:
                video_url = url

            print urllib.unquote(video_url)
            item = xbmcgui.ListItem(path=video_url)
            xbmcplugin.setResolvedUrl(self.handle, True, item)
        except Exception, e:
            self.showErrorMessage(e) 
开发者ID:dandygithub,项目名称:kodi,代码行数:21,代码来源:default.py

示例14: play_item

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_item(self, url, pid = None):
        print "*** play url %s" % url

        if (pid == None) and ("m3u8" in url):
            url = ("http:" if (not ("http://" in url)) else "") + url
            response = common.fetchPage({"link": url})
            if (not (("http://" in response["content"]) or ("https://" in response["content"]))):
                content = response["content"].split("\n")
                name = os.path.join(self.path.decode("utf-8"), 'resources/playlists/') + "temp.m3u8"
                block = url.split("mp4")[0]
                f = open(name, "w+")
                for line in content:
                   if "mp4" in line:
                       line = block + "mp4" + line.split("mp4")[-1]
                   f.write(line + "\n")
                f.close()
                item = xbmcgui.ListItem(path=name)
            else:
                item = xbmcgui.ListItem(path=url) 
        else:
            item = xbmcgui.ListItem(path=url) 
        xbmcplugin.setResolvedUrl(self.handle, True, item) 
开发者ID:dandygithub,项目名称:kodi,代码行数:24,代码来源:default.py

示例15: play_video

# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setResolvedUrl [as 别名]
def play_video(room_id):
    """
    Play a video by the provided path.
    :param path: str
    :return: None
    """
    f = urllib2.urlopen('http://www.zhanqi.tv/api/static/live.roomid/{room_id}.json?sid='.format(room_id=room_id))
    obj = json.loads(f.read())
    #path = 'http://dlhls.cdn.zhanqi.tv/zqlive/{video}.m3u8'.format(video=obj['data']['videoIdKey']);
    #path = 'http://ebithdl.cdn.zhanqi.tv/zqlive/{video}.flv'.format(video=obj['data']['videoIdKey'])
    path = 'rtmp://wsrtmp.load.cdn.zhanqi.tv/zqlive/{video}'.format(video=obj['data']['videoId'])
    play_item = xbmcgui.ListItem(path=path, thumbnailImage=obj['data']['bpic'])
    play_item.setInfo(type="Video", infoLabels={"Title":obj['data']['title']})
    # Pass the item to the Kodi player.
    xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)
    # directly play the item.
    xbmc.Player().play(path, play_item) 
开发者ID:taxigps,项目名称:xbmc-addons-chinese,代码行数:19,代码来源:addon.py


注:本文中的xbmcplugin.setResolvedUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。