當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。