Python源码示例:xbmcplugin.setResolvedUrl()

示例1
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()) 
示例2
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) 
示例3
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) 
示例4
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) 
示例5
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) 
示例6
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)) 
示例7
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) 
示例8
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) 
示例9
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()) 
示例10
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) 
示例11
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) 
示例12
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") 
示例13
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) 
示例14
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) 
示例15
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) 
示例16
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) 
示例17
def tvcsam(params):
    #http://www.tvc.ru/video/iframe/id/101797/isPlay/true/id_stat/channel/?acc_video_id=/channel/brand/id/2723/show/episodes/episode_id/47027
    #print "%s: url=%s"%(params['title'],params['flink'])
    #print "http://www.tvc.ru/"+params['flink']
    http=GET("http://www.tvc.ru/"+params['flink'])
    ll=re.compile('video/iframe/id/([0-9]+)/').findall(http)
    #print ll[0]
    #print http
    #window.pl.data.dataUrl = 'http://www.tvc.ru/video/json/id/102174';
    #lnk=re.compile('//www.tvc.ru/video/json/id/([0-9]+)').findall(http)
    #print lnk
    #print lnk[0]
    jso=json.loads(GET('http://www.tvc.ru/video/json/id/'+ll[0]))
    url=jso['path']['quality'][0]['url']
    item = xbmcgui.ListItem(path=url)
    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) 
示例18
def play_track(track_id, album_id):
    media_url = session.get_media_url(track_id, album_id=album_id)
    log("Playing: %s" % media_url)
    disableInputstreamAddon = False
    if not media_url.startswith('http://') and not media_url.startswith('https://') and \
        not 'app=' in media_url.lower() and not 'playpath=' in media_url.lower():
        # Rebuild RTMP URL
        if KODI_VERSION >= (17, 0):
            media_url = 'rtmp://%s' % media_url
            disableInputstreamAddon = True
        else:
            host, tail = media_url.split('/', 1)
            app, playpath = tail.split('/mp4:', 1)
            media_url = 'rtmp://%s app=%s playpath=mp4:%s' % (host, app, playpath)
    li = ListItem(path=media_url)
    if disableInputstreamAddon:
        # Krypton can play RTMP Audio Streams without inputstream.rtmp Addon
        li.setProperty('inputstreamaddon', '')
    mimetype = 'audio/flac' if session._config.quality == Quality.lossless and session.is_logged_in else 'audio/mpeg'
    li.setProperty('mimetype', mimetype)
    xbmcplugin.setResolvedUrl(plugin.handle, True, li) 
示例19
def play_track_cut(track_id, cut_id, album_id):
    media_url = session.get_media_url(track_id, cut_id=cut_id, album_id=album_id)
    log("Playing Cut %s: %s" % (cut_id, media_url))
    disableInputstreamAddon = False
    if not media_url.startswith('http://') and not media_url.startswith('https://') and \
        not 'app=' in media_url.lower() and not 'playpath=' in media_url.lower():
        # Rebuild RTMP URL
        if KODI_VERSION >= (17, 0):
            media_url = 'rtmp://%s' % media_url
            disableInputstreamAddon = True
        else:
            host, tail = media_url.split('/', 1)
            app, playpath = tail.split('/mp4:', 1)
            media_url = 'rtmp://%s app=%s playpath=mp4:%s' % (host, app, playpath)
    li = ListItem(path=media_url)
    if disableInputstreamAddon:
        # Krypton can play RTMP Audio Streams without inputstream.rtmp Addon
        li.setProperty('inputstreamaddon', '')
    mimetype = 'audio/flac' if session._config.quality == Quality.lossless and session.is_logged_in else 'audio/mpeg'
    li.setProperty('mimetype', mimetype)
    xbmcplugin.setResolvedUrl(plugin.handle, True, li) 
示例20
def _set_resolved_url(self, context, base_item, succeeded=True):
        item = xbmc_items.to_item(context, base_item)
        item.setPath(base_item.get_uri())
        xbmcplugin.setResolvedUrl(context.get_handle(), succeeded=succeeded, listitem=item)

        """
        # just to be sure :)
        if not isLiveStream:
            tries = 100
            while tries>0:
                xbmc.sleep(50)
                if xbmc.Player().isPlaying() and xbmc.getCondVisibility("Player.Paused"):
                    xbmc.Player().pause()
                    break
                tries-=1
        """ 
示例21
def set_resolved_url(self, item=None, subtitles=None):
		if self._end_of_directory:
			raise Exception('Current Kodi handle has been removed. Either set_resolved_url(), end_of_directory(), or finish() has already been called.')
		self._end_of_directory = True
		succeeded = True
		if item is None:
			item = {}
			succeeded = False
		if isinstance(item, basestring):
			item = {'path': item}
		item = self._listitemify(item)
		item.set_played(True)
		xbmcplugin.setResolvedUrl(self.handle, succeeded, item.as_xbmc_listitem())
		if subtitles:
			self._add_subtitles(subtitles)
		return [item] 
示例22
def __LOAD_AND_PLAY_WATCHED(self, url,
                                pType='video'):  # NOWE wersja używa xbmcplugin.setResolvedUrl wspiera status "watched"
        if url == '':
            d = xbmcgui.Dialog()
            d.ok('Nie znaleziono streamingu', 'Może to chwilowa awaria.', 'Spróbuj ponownie za jakiś czas')
            return False
        liz = xbmcgui.ListItem(path=url)
        try:
            return xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
        except:
            d = self.dialog()
            if pType == "video":
                d.ok('Wystąpił błąd!', 'Błąd przy przetwarzaniu, lub wyczerpany limit czasowy oglądania.',
                     'Zarejestruj się i opłać abonament.', 'Aby oglądać za darmo spróbuj ponownie za jakiś czas.')
            elif pType == "music":
                d.ok('Wystąpił błąd!', 'Błąd przy przetwarzaniu.', 'Aby wysłuchać spróbuj ponownie za jakiś czas.')
            return False 
示例23
def play_video(video_url = common.args.url):
	hbitrate = -1
	sbitrate = int(addon.getSetting('quality')) * 1024
	closedcaption = None
	video_url2 = None
	finalurl = ''
	try:
		closedcaption = simplejson.loads(connection.getURL(CLOSEDCAPTION % video_url).replace('video_info(', '').replace(')', ''))['closed_captions_url']
	except:
		pass
	if (addon.getSetting('enablesubtitles') == 'true') and (closedcaption is not None) and (closedcaption != ''):
		convert_subtitles(closedcaption.replace(' ', '+'))
	video_data = cove.videos.filter(fields = 'mediafiles', filter_tp_media_object_id = video_url)
	video_menu = video_data['results'][0]['mediafiles']
	for video_item in video_menu:
		if video_item['video_encoding']['eeid'] == 'ipad-16x9':
			video_url2 = video_item['video_data_url']
		elif video_item['video_encoding']['eeid'] == 'hls-2500k-16x9':
			video_url2 = video_item['video_data_url']
		else:
			pass
	if video_url2 is None:
		video_url2 = video_item['video_data_url']
	video_data2 = connection.getURL(video_url2 + '?format=jsonp&callback=jQuery18303874830141490152_1377946043740')
	video_url3 = simplejson.loads(video_data2.replace('jQuery18303874830141490152_1377946043740(', '').replace(')', ''))['url']
	if '.mp4' in video_url3:
		base_url, playpath_url = video_url3.split('mp4:')
		finalurl = base_url +' playpath=mp4:' + playpath_url + '?player= swfurl=' + SWFURL % video_data['results'][0]['guid'] + ' swfvfy=true'
	else:
		video_data3 = connection.getURL(video_url3)
		video_url4 = m3u8.parse(video_data3)
		for video_index in video_url4.get('playlists'):
			bitrate = int(video_index.get('stream_info')['bandwidth'])
			if bitrate > hbitrate and bitrate <= sbitrate:
				hbitrate = bitrate
				finalurl = video_url3.rsplit('/', 1)[0] + '/' + video_index.get('uri')
	xbmcplugin.setResolvedUrl(pluginHandle, True, xbmcgui.ListItem(path = finalurl))
	if (addon.getSetting('enablesubtitles') == 'true') and (closedcaption is not None) and (closedcaption != ''):
		while not xbmc.Player().isPlaying():
			xbmc.sleep(100)
		xbmc.Player().setSubtitles(ustvpaths.SUBTITLE) 
示例24
def play_video(video_url = common.args.url):
	if 'mp4' in video_url:
		finalurl = video_url
		item = xbmcgui.ListItem(path = finalurl)
		xbmcplugin.setResolvedUrl(pluginHandle, True, item)
	else:
		main_turner.play_video(SITE, EPISODE, HLSPATH) 
示例25
def play_video(video_url = common.args.url):
	video_data = connection.getURL(VIDEOURL % video_url.split('/')[-1])
	video_tree = simplejson.loads(video_data)['videos']['limelight700']['uri']
	rtmpsplit = video_tree.split('mp4:')
	finalurl = rtmpsplit[0] + ' playpath=mp4:' + rtmpsplit[1]
	xbmcplugin.setResolvedUrl(pluginHandle, True, xbmcgui.ListItem(path = finalurl)) 
示例26
def play(sys, params):
    log('Setting resolving property')
    xbmcgui.Window(10000).setProperty(RESOLVING, RESOLVING)

    title    = urllib.unquote_plus(params['title'])
    artist   = urllib.unquote_plus(params['artist'])
    album    = urllib.unquote_plus(params['album'])
    track    = urllib.unquote_plus(params['track'])
    image    = urllib.unquote_plus(params['image'])
    duration = urllib.unquote_plus(params['duration'])
    filename = urllib.unquote_plus(params['filename'])
    url      = urllib.unquote_plus(params['url'])

    log('**** In playFile ****')
    log(title)
    log(url)
    log(filename)

    playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
    posn     = playlist.getposition()
    next     = posn+1

    fetchFile(title, artist, album, track, url, filename)
    fetchNext(next)

    log('**** FILE %s NOW AVAILABLE ****' % filename)
    liz = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image, path=filename)

    liz.setInfo('music', {'Title':title, 'Artist':artist, 'Album':album, 'Duration':duration})
    liz.setProperty('mimetype', 'audio/mpeg')
    liz.setProperty('IsPlayable','true')

    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)

    log('Clearing resolving property')
    xbmcgui.Window(10000).clearProperty(RESOLVING)


#------------------------------------------------------------------------ 
示例27
def resolve(name, url, iconimage, description):
    host = url
    xbmc.log('@#@#HOST:%s' % host, xbmc.LOGNOTICE)
    stream_url = evaluate(host)
    xbmc.log('@#@#STREAM:%s' % stream_url, xbmc.LOGNOTICE)
    name = name.split(' [B]|')[0]
    try:
        liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo(type="Video", infoLabels={"Title": description})
        liz.setProperty("IsPlayable","true")
        liz.setPath(str(stream_url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except:
        control.infoDialog("[COLOR red]Dead Link[/COLOR]!\n[COLOR white]Please Try Another[/COLOR]", NAME, '') 
示例28
def PlayVideo(url, title, img, plot):
    try:
        import resolveurl
        stream_url = resolveurl.resolve(url)
        liz = xbmcgui.ListItem(title, iconImage="DefaultVideo.png", thumbnailImage=img)
        liz.setInfo(type="Video", infoLabels={"Title": title, "Plot": plot})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(str(stream_url))
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
    except BaseException:
        control.infoDialog(
            '[COLOR red][B]Probably your service doesn\'t support this provider![/B][/COLOR]\n'
            '[COLOR lime][B]Please try a different link!![/B][/COLOR]', NAME, ICON, 5000) 
示例29
def _set_resolved_url(self, context):
        """
        Resolve a playable URL

        :param context: context object
        :type context: PlayContext
        """
        self.log_debug('Resolving URL from {0}'.format(str(context)))
        if context.play_item is None:
            list_item = xbmcgui.ListItem(path=context.path)
        else:
            list_item = self.create_list_item(context.play_item)
        xbmcplugin.setResolvedUrl(self._handle, context.succeeded, list_item) 
示例30
def trailer(item_id):
    response = plugin.client("items/trailer").get(data={"id": item_id})
    url = response["trailer"][0]["url"]
    li = plugin.list_item("Трейлер", path=url)
    xbmcplugin.setResolvedUrl(plugin.handle, True, li)