예제 #1
0
def add(title, url, mimetype, thumb=""):
  if thumb:
    img_path = os.path.join(plugin.path, "resources/images")
    thumb = os.path.join(img_path, thumb)
  li =  ListItem(title, thumbnailImage=thumb)
  li.setProperty('mimetype', mimetype)
  addDirectoryItem(plugin.handle, url, li, False)
예제 #2
0
def show_categories(section_id):
    """
    Categories page
    :param section_id: Selected section ID
    :return:
    """
    api = API()

    for item in api.get_categories(int(section_id)):
        # list item:
        li = ListItem(item['name'].capitalize(),
                      iconImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']),
                      thumbnailImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']))
        li.setArt({
            'fanart': '{0}{1}'.format(config['urls']['calm_blurred_arts_host'], item['image'])
        })
        # directory item:
        addDirectoryItem(
                PLUGIN.handle,
                PLUGIN.url_for(show_channels, section_id=section_id, category_id=item['id']),
                li,
                True
        )
    # end of directory:
    endOfDirectory(PLUGIN.handle)
    executebuiltin('Container.SetViewMode({0})'.format(
            config['viewmodes']['thumbnail'][getSkinDir()
            if getSkinDir() in config['viewmodes']['thumbnail'] else 'skin.confluence']
    ))
예제 #3
0
def show_episodes(url,offset,show_fanart):
	items = []
	url = urllib.unquote(url)
	url_offset = url+'&offset='+str(offset)
	data = get_page(url_offset)
	total = 0

	if data["content"]:
		content = json.loads(data["content"])
		if "total" in content.keys(): total = content["total"]
		for episode in content["episodes"]:
			liz = build_episode_item(episode,show_fanart)
			if liz:
				items.append((liz.getPath(), liz, False))
	if items:
		totalItems = len(items)
		addDirectoryItems(plugin.handle, items, totalItems=totalItems)
		
		#sort methods
		for method in [SORT_METHOD_UNSORTED,SORT_METHOD_LABEL,SORT_METHOD_EPISODE,SORT_METHOD_VIDEO_RUNTIME]:
			addSortMethod(plugin.handle, sortMethod=method ) 
		
		#next page
		if total and (int(total) - ((int(offset) + 1) * 25)) > 0:
			liz = ListItem(kodiutils.get_string(32016) + " (" + str(int(offset)+2) + ")")
			liz.setInfo( type="Video", infoLabels={"plot":kodiutils.get_string(32016)})
			liz.setArt({"thumb":next_thumb, "fanart": fanart_bg})
			addDirectoryItem(plugin.handle, plugin.url_for(show_episodes, urllib.quote(url, safe=''), int(offset)+1,  urllib.quote(show_fanart, safe='')), liz, True)

		setContent(plugin.handle, 'episodes')
	endOfDirectory(plugin.handle)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    videoborderbox = common.parseDOM(data, "div", attrs={ "id": "videoarea" })[0]
    Title = common.parseDOM(videoborderbox, "div", {"id": "videotitle"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    videoplayer = common.parseDOM(videoborderbox, "div", attrs={ "id": "videodisplay"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(videoplayer)
    #videoUrl = None 
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return                
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', { 'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.fetch(url)
    panel = common.parseDOM(data, "div", attrs={"class": "panel"})[0]
    Title = re.compile("<h3>Daily Link : (.+?) on").findall(data)
    if Title:
        Title = Title[0]
        Title = common.replaceHTMLCodes(Title)
        Title = Title.encode("utf-8")
    else:
        Title = "Video"
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(panel)
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok("Nothing to play", "A playable url could not be found.")
        return
    else:
        # print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + " Part " + str(count)
            listitem = ListItem(Title, iconImage="", thumbnailImage="")
            listitem.setInfo("video", {"Title": Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    if 'nayakhabar' in url:
        travlink = re.compile('a href="(http://www.canadanepal.+?)".+?<strong>').findall(data)
        if travlink:
            travlink = travlink[0]
            data = Common.getURL(travlink)
    post = common.parseDOM(data, "div", attrs={ "class": "post" })[0]
    Title = common.parseDOM(post, "h2", attrs={ "class": "title"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    entry = common.parseDOM(post, "div", attrs={ "class": "entry"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(entry)
     
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return                
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', { 'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
예제 #7
0
def show_live():
    quality = get_set_quality()
    format = get_set_format()

    data = None
    try:
        data = http.fetch_live(wants_insecure())
    except http.FetchError:
        return

    if len(data.conferences) == 0:
        entry = ListItem('No live event currently, go watch some recordings!')
        addDirectoryItem(plugin.handle, plugin.url_for(show_dir), entry, True)

    for conference in data.conferences:
        for room in conference.rooms:
            want = room.streams_sorted(quality, format)

            # Assumption: want now starts with the "best" alternative,
            # followed by an arbitrary number of translations, after which
            # the first "worse" non-translated stream follows.

            for id, stream in enumerate(want):
                if id > 0 and not stream.translated:
                    break
                extra = ''
                if stream.translated:
                    extra = ' (Translated %i)' % id if id > 1 else ' (Translated)'
                item = ListItem(conference.name + ': ' + room.display + extra)
                item.setProperty('IsPlayable', 'true')
                addDirectoryItem(plugin.handle, stream.url, item, False)

    endOfDirectory(plugin.handle)
예제 #8
0
def show_dir(subdir = ''):
    try:
        data = get_index_data()
    except http.FetchError:
        return

    subdirs = set()
    if subdir == '':
        depth = 0

        addDirectoryItem(plugin.handle, plugin.url_for(show_live), ListItem('Live Streaming'), True)
    else:
        depth = len(subdir.split('/'))


    for event in sorted(data, key=operator.itemgetter('title')):
        top, down, children = split_pathname(event['webgen_location'], depth)

        if top != subdir or down in subdirs:
            continue
        if children:
            addDirectoryItem(plugin.handle, plugin.url_for(show_dir, subdir = build_path(top, down)),
                    ListItem(down.title()), True)
            subdirs.add(down)
        else:
            item = ListItem(event['title'])
            item.setLabel2(event['acronym'])
            item.setThumbnailImage(event['logo_url'])
            addDirectoryItem(plugin.handle, plugin.url_for(show_conference, conf = event['url'].rsplit('/', 1)[1]),
                    item, True)

    endOfDirectory(plugin.handle)
예제 #9
0
def yoga_class_play_video(rtmp_url, play_path, swf_url, xbmc_handle):
    """
    Sets an xbmc ListItem so that it can play the video associated with that selection.

    """
    li = ListItem(path=rtmp_url)
    li.setProperty('PlayPath', play_path);
    li.setProperty('SWFPlayer', swf_url);
    setResolvedUrl(xbmc_handle, True, li)
예제 #10
0
def play(track_id):
    media_url = wimp.get_media_url(track_id)
    if not media_url.startswith('http://') and not media_url.startswith('https://'):
        log("media url: %s" % media_url)
        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)
    mimetype = 'audio/flac' if config.quality == Quality.lossless else 'audio/mpeg'
    li.setProperty('mimetype', mimetype)
    xbmcplugin.setResolvedUrl(plugin.handle, True, li)
예제 #11
0
def view_dir(handle, base_url, nodes, args, titles, thumbs=repeat(''), bgs=repeat('')):
  total = len(titles)
  for node, arg, title, thumb, bg in zip(nodes, args, titles, thumbs, bgs):
    thumb = thumb() if callable(thumb) else thumb
    bg = bg() if callable(bg) else bg
    li = ListItem(title, thumbnailImage=thumb)
    url = "%s?node=%s&arg=%s" % (base_url, node, arg)
    isdir = node != 'play'
    li.setProperty('isplayable', str(not isdir))
    li.setProperty('fanart_image', bg)
    addDirectoryItem(handle, url, li, isdir, total)
  endOfDirectory(handle)
def _subreddit_item(title, subreddit_name=None):
    """Return ListItem for given subreddit name with context menu."""
    listitem = ListItem(title)

    if subreddit_name is None:
        subreddit_name = title
    listitem.addContextMenuItems([
        (_('Remove'), 'RunPlugin(%sremove_subreddit/%s/)' % (
            addon.base_url, subreddit_name
        ))
    ])
    return listitem
예제 #13
0
def createItem(title, thumb):
    li = ListItem(title)
    try:
        li.setThumbnailImage(thumb)
    except: pass
    li.setProperty('IsPlayable', 'true')
    li.setProperty('Music', 'true')
    li.setProperty('mimetype', 'audio/mpeg')
    return li
예제 #14
0
 def add(self, label, prefix, type, id=None, img='', icon='', isdir=True, commands=None):
 
     # Make full path for where to look for specified image
     if img != '':
         img = os.path.join(self.rpath, img)
         
     url = Key.build_url(prefix, type=type, id=id)
     li  = ListItem(label, iconImage=icon, thumbnailImage=img)
     if commands:
         li.addContextMenuItems( commands, True )
     ok  = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
     
     return ok
예제 #15
0
def show_category(category_id):
	try:
		req = requests.get('{}/{}'.format(BANCA_SAPO_URL, category_id)).text
	except:
		Dialog().ok(translate(32000), translate(32001))
		sys.exit(0)
	match = re.findall('data-original-src="(.+?)".+?data-share-url=.+?title="(.+?)".+?source data-srcset="(.+?)" srcset', req, re.DOTALL)
	for cover, newspapper, thumb in match:
		if thumb.startswith('//'): thumb = '{}{}'.format('http:', thumb) 
		liz = ListItem(newspapper)
		liz.setArt({"thumb":thumb, "fanart": GLOBAL_FANART})
		addDirectoryItem(plugin.handle, cover, liz)
	endOfDirectory(plugin.handle)
예제 #16
0
def wrapper_endOfDirectory(handle, succeeded = True, updateListing = False, cacheToDisc = True):
    global allowedItems
    url = sys.argv[0] + sys.argv[2] + overridemarker + "=true"
    if (getBlocked() > 0):
        title="Blocked %s (%s)" % (getBlockedRatingsString(),getBlocked())
        item = ListItem(title,"",common.__icon__, common.__icon__)
        info={
            "Title":title,
            "Plot":"Some content has been blocked by the Parental Controls addon.  Click to unblock."
            }
        item.setInfo("video",info)
        addDirectoryItem(handle, url, item, False, allowedItems+1)
    return endOfDirectory(handle,succeeded,updateListing,cacheToDisc)
예제 #17
0
def categories():
	try:
		req = requests.get(BANCA_SAPO_URL).text
	except:
		Dialog().ok(translate(32000), translate(32001))
		sys.exit(0)

	categories_regex = re.findall('<a href="/jornais/(.+?)" class="\[  \]">(.+?)</a>',req)
	for uri,category in categories_regex:
		liz = ListItem(category)
		liz.setArt({"thumb":GLOBAL_NEWSPAPPER_ICON, "fanart": GLOBAL_FANART})
		addDirectoryItem(plugin.handle, plugin.url_for(show_category, uri), liz, True)
	endOfDirectory(plugin.handle)
예제 #18
0
def view(items, update_listing=False, urls=None):
    total = len(items)
    for i, (item, url) in enumerate(zip(items, urls)):
        if not getattr(item, 'available', True):
            continue
        li = ListItem(item.title)
        set_common_properties(item, li)
        playable = plugin.route_for(url) == play
        if playable:
            set_steam_details(item, li)
        li.setInfo('video', {'count': i, 'title': item.title, 'mediatype': 'video'})
        addDirectoryItem(plugin.handle, url, li, not playable, total)
    endOfDirectory(plugin.handle, updateListing=update_listing)
예제 #19
0
def show_favorites():
    """
    User's favorite channels list
    :return:
    """
    api = API()
    user = User()
    is_authenticated = user.authenticate()

    if is_authenticated:
        favorites = api.get_favorites(user.username, user.token)
        if len(favorites) > 0:
            for item in favorites:
                # list item:
                li = ListItem(u'{0} {1}'.format(item['title'].replace('CALM RADIO -', '').title(),
                                                '(VIP)' if 'free' not in item['streams'] else '',
                                                item['description']),
                              iconImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']),
                              thumbnailImage='{0}/{1}'.format(config['urls']['calm_arts_host'], item['image']))
                li.setArt({
                    'fanart': '{0}{1}'.format(config['urls']['calm_blurred_arts_host'], item['image'])
                })
                li.addContextMenuItems(
                        [(ADDON.getLocalizedString(32301), 'RunPlugin(plugin://{0}/favorites/remove/{1})'
                          .format(ADDON_ID, item['id']))]
                )
                # directory item:
                addDirectoryItem(
                        PLUGIN.handle,
                        PLUGIN.url_for(play_channel,
                                       category_id=item['category'],
                                       channel_id=item['id']),
                        li
                )
            # set the content of the directory
            setContent(ADDON_HANDLE, 'songs')
            # end of directory:
            endOfDirectory(PLUGIN.handle)
            executebuiltin('Container.SetViewMode({0})'.format(
                    config['viewmodes']['thumbnail'][getSkinDir()
                    if getSkinDir() in config['viewmodes']['thumbnail'] else 'skin.confluence']
            ))
        # favorites list is empty:
        else:
            executebuiltin('Notification("{0}", "{1}")'
                           .format(ADDON.getLocalizedString(30000), ADDON.getLocalizedString(32306)))
    # user is not authenticated:
    else:
        executebuiltin('Notification("{0}", "{1}")'
                       .format(ADDON.getLocalizedString(30000), ADDON.getLocalizedString(32110)))
예제 #20
0
def show_episode_list(episodes):
    episodes = filter(lambda ep: getattr(ep, 'available', True), episodes)
    for i, item in enumerate(episodes):
        li = ListItem(item.episode)
        set_common_properties(item, li)
        set_steam_details(item, li)
        li.setInfo('video', {
            'title': item.episode,
            'count': i,
            'mediatype': 'episode',
            'tvshowtitle': item.title})

        url = plugin.url_for(play, item.id)
        addDirectoryItem(plugin.handle, url, li, False)
    endOfDirectory(plugin.handle)
예제 #21
0
    def answer_request(self, sendData):
        try:
            request_path = self.path[1:]
            urllib.quote_plus(request_path)
            extensions = ['.Vprj', '.edl', '.txt', '.chapters.xml']
            for extension in extensions:
                if request_path.endswith(extension):
                    self.send_response(404)
                    request_path = ''      
            request_path = re.sub(r"\?.*", "", request_path)
            if request_path == "stop":
                infoDialog('request Stopping ...', 'Server Stop', time=1000)
                xbmc.sleep(5)
                sys.exit()
            elif request_path == "version":
                infoDialog('msg version ...', 'Check version', time=1000)
                self.send_response(200)
                self.end_headers()
                self.wfile.write("Livestreamer Proxy: Running - Pac-12 Network\r\n")
                self.wfile.write("Version: 0.1")
            elif request_path[0:13] == "livestreamer/":
                infoDialog('Process livestreamer', '[COLOR aqua]answer_request[/COLOR]', time=3000)
                realpath = request_path[13:]
                infoDialog('process decrypting..', 'onetv decrypt', time=1000)
                if "hls://" not in base64.b64decode(realpath):
					realpath = onetv_decrypt(realpath)
                infoDialog('process sendData..', 'streamer service', time=1000)
                fURL = base64.b64decode(realpath)
                self.serveFile(fURL, sendData)
                infoDialog('[COLOR lime]Done sendData..ready streamer[/COLOR]', 'sendData', time=1000)
            elif request_path[0:13] == "youtubevideo/" or request_path[0:13] == "vodstreamers/" or request_path[0:13] == "f4mstreamers/": 
                infoDialog('Process Video streamers', '[COLOR aqua]answer_request[/COLOR]', time=3000)
                url = self.path[14:]
                urllib.quote_plus(url)
                listitem = ListItem(path=url)
                listitem.setInfo(type="Video", infoLabels={"mediatype": "movie", "title": "LiveTV_VOD"})
                Player().play(url, listitem)
                return
            else:
                self.send_response(403)
        except:
                traceback.print_exc()
                self.wfile.close()
                return
        try:
            self.wfile.close()
        except:
            pass
예제 #22
0
def build_dir(streams, prefix=None):
    for stream in streams:
        if prefix is None:
            url = stream['url_id']
            folder = False
        else:
            url = prefix % stream['url_id']
            folder = True
        li = ListItem(label=stream['title'])
        li.setArt({'thumb': get_logo(stream['logo']), 'icon': get_logo(stream['logo']), 'fanart': get_logo(stream['fanart'])})
        addDirectoryItem(
            plugin.handle,
            url,
            li,
            folder
        )
예제 #23
0
def view(data_items, urls, end=True):
    list_items = []
    for item, url in zip(data_items, urls):
        li = ListItem(item.name)
        info = {'title': item.name}
        if isinstance(item, Album):
            info.update({'album': item.name, 'artist': item.artist.name})
        elif isinstance(item, Artist):
            info.update({'artist': item.name})
        li.setInfo('music', info)
        if getattr(item, 'image', None):
            li.setThumbnailImage(item.image)
        list_items.append((url, li, True))
    xbmcplugin.addDirectoryItems(plugin.handle, list_items)
    if end:
        xbmcplugin.endOfDirectory(plugin.handle)
예제 #24
0
def get_playlists(params):
    client = SoundCloudClient(username)
    playlists = client.get_playlists()
    for playlist in playlists:
        artwork = playlist.get_artwork_url() if playlist.get_artwork_url() else ""
        li = ListItem(label=playlist.get_title())
        li.setInfo("music", { "title": playlist.get_title(), "genre": playlist.get_genre() })
        li.setIconImage(artwork)
        li.setThumbnailImage(artwork)
        li.setProperty("IsPlayable", "false")
        url = "%s%d/" % (URL, playlist.get_id())
        xbmcplugin.addDirectoryItem(handle=HANDLE, url=url, listitem=li, isFolder=True)
    xbmcplugin.endOfDirectory(handle=HANDLE, succeeded=True)
예제 #25
0
def createListItem(label, thumbnailImage, isPlayable, plot, duration):
    li = ListItem(
        label=label,
        thumbnailImage=thumbnailImage
    )
        
    if isPlayable:
        infoLabels = {}
        infoLabels['plot'] = plot

        if duration > 0:
            infoLabels['duration'] = duration

        li.setInfo(type=u'video', infoLabels=infoLabels)
        li.setProperty('isPlayable', 'true')

    return li
예제 #26
0
def __build_folder(xml_element, plex_section_id=None):
    url = "plugin://%s/" % v.ADDON_ID
    key = xml_element.attrib.get('fastKey', xml_element.attrib.get('key'))
    if not key.startswith('/'):
        key = '/library/sections/%s/%s' % (plex_section_id, key)
    params = {
        'mode': "browseplex",
        'key': key,
        'id': plex_section_id
    }
    listitem = ListItem(xml_element.attrib.get('title'))
    listitem.setArt({'thumb': xml_element.attrib.get('thumb'),
                     'poster': xml_element.attrib.get('art')})
    xbmcplugin.addDirectoryItem(handle=HANDLE,
                                url="%s?%s" % (url, urlencode(params)),
                                isFolder=True,
                                listitem=listitem)
예제 #27
0
def index():
	# Request dvr
    try:
		req = requests.get("http://www.rtp.pt/play/", headers=HEADERS).text
    except:
		pass

    match=re.compile('<a\s*title=".+?direto\s*(.+?)"\s*href="/play/direto/(.+?)".+?img.+?src="(.+?)"\s*class="img-responsive">.+?<span class="small"><b>(.+?)</b>').findall(req)
    
    for rtp_channel in RTP_CHANNELS:
		dvr = "Not available"
		progimg = ""
		for _, key, img, prog in match:
			if key.lower() == rtp_channel["id"]:
				dvr = prog
				if img.startswith("/"):
					img = "http:{}".format(img)
				progimg = img
				break

		liz = ListItem("[B][COLOR blue]{}[/B][/COLOR] ({})".format(kodiutils.smart_str(rtp_channel["name"]), kodiutils.smart_str(dvr)))
		liz.setArt({"thumb": progimg, "icon": progimg, "fanart": kodiutils.FANART})
		liz.setProperty('IsPlayable', 'true')
		liz.setInfo("Video", infoLabels={"plot": kodiutils.smart_str(dvr)})
		addDirectoryItem(plugin.handle, plugin.url_for(play, label=kodiutils.smart_str(rtp_channel["name"]), channel=kodiutils.smart_str(rtp_channel["id"]), img=kodiutils.smart_str(progimg), prog=kodiutils.smart_str(dvr) ), liz, False)

    endOfDirectory(plugin.handle)
예제 #28
0
def build_tvshow_item(show):
	#Create listitem
	liz = ListItem(show["name"])
	#Listitem infolabels
	infolabels = { "title": show["name"], "originaltitle": show["name"] }
	if "summary" in show.keys():
		infolabels["plot"] = show["summary"]
	if "tagline" in show.keys():
		infolabels["tagline"] = show["tagline"]
	if "debut" in show.keys():
		infolabels["premiered"] = show["debut"]
	#Art
	art = {}
	if "images" in show.keys():
		images = show["images"]
		if "logo" in images.keys():
			art["icon"] = images["logo"]; art["thumb"] = images["logo"]; art["poster"] = images["logo"]
		if "promo" in images.keys():
			art["fanart"] = images["promo"]
		else:
			art["fanart"] = os.path.join( ADDON.getAddonInfo( 'path' ), 'resources', 'fanart.jpg' )
		if "banner" in images.keys():
			art["banner"] = images["banner"]

	liz.setInfo( type="Video", infoLabels=infolabels)
	liz.setArt(art)
	liz.setUniqueIDs({"revision3id":show["id"]})
	return liz
예제 #29
0
def yoga_class_list_item(class_info):
    """
    Takes a yogaglo class information dictionary, populating and returning
    an xbmc ListItem from that information.

    """
    li = ListItem(label=class_info['title'],
                          label2=class_info['secondLabel'],
                          iconImage=class_info['coverPicUrl'])
    li.setInfo('video', {'title': class_info['title'],
                         'plot': class_info['plot'],
                         'Duration': class_info['duration'],
                         'plotoutline': class_info['secondLabel'],
                         'tagline': class_info['teacher'],
                         'genre': "Yoga"
                     })
    li.setProperty('IsPlayable', 'true')
    return li
예제 #30
0
def get_playlists():
    api_endpoint = 'https://www.googleapis.com/youtube/v3/playlists?part=snippet,contentDetails&channelId=%s&maxResults=50&key=%s' % (CHANNEL_ID,YOUTUBE_API_KEY)
    try:
        resp = requests.get(api_endpoint).json()
    except ValueError:
        kodiutils.log(kodiutils.get_string(32003), xbmc.LOGERROR)
    if "items" in resp.keys():
        for playlist in resp["items"]:
            liz = ListItem(playlist["snippet"]["title"])
            infolabels = {"plot": playlist["snippet"]["localized"]["description"]}
            liz.setInfo(type="video", infoLabels=infolabels)
            liz.setArt({"thumb": playlist["snippet"]["thumbnails"]["high"]["url"], "fanart": xbmcaddon.Addon().getAddonInfo("fanart")})
            liz.setProperty("type","playlist")
            liz.setProperty("playlist_id", playlist["id"])
            yield liz
예제 #31
0
파일: addon.py 프로젝트: dilipbm/TamilRepo
def channel_view(site_name, url):
    url = utils.decode_url(url)

    if site_name == "yupptv":
        channels = ytv.get_channels(url)
        for channel in channels:
            listitem = ListItem(channel["name"])
            listitem.setArt(channel["image"])
            if url == "live":
                addDirectoryItem(
                    plugin.handle,
                    plugin.url_for(
                        episode_view,
                        site_name=site_name,
                        url=utils.encode_url(channel["url"]),
                    ),
                    listitem,
                    True,
                )
                # plugin.redirect(
                #    "/playable/{}/{}".format(channel["name"], utils.encode_url(url))
                # )

            elif url == "catchup":
                addDirectoryItem(
                    plugin.handle,
                    plugin.url_for(
                        day_view,
                        site_name=site_name,
                        url=utils.encode_url(channel["url"]),
                    ),
                    listitem,
                    True,
                )

    endOfDirectory(plugin.handle)
예제 #32
0
def list_channels(cat_id=None):
    list_items = []
    r = s.post(list_url, headers={'app-token': '9120163167c05aed85f30bf88495bd89'}, data={'username': '******'}, timeout=15)
    ch = r.json()

    for c in ch['msg']['channels']:
        if c['cat_id'] == cat_id:
            image = "http://uktvnow.net/uktvnow8/{0}|User-Agent={1}".format(urllib.quote(c['img'].encode('utf-8')), quote(user_agent))
            li = ListItem(c['channel_name'].rstrip('.'))
            li.setProperty("IsPlayable", "true")
            li.setArt({'thumb': image, 'icon': image})
            li.setInfo(type='Video', infoLabels={'Title': c['channel_name'].rstrip('.'),
                                                 'mediatype': 'video',
                                                 'PlayCount': 0})
            try:
                li.setContentLookup(False)
            except:
                pass
            url = plugin.url_for(play, ch_id=c['pk_id'])
            list_items.append((url, li, False))

    xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_LABEL)
    xbmcplugin.addDirectoryItems(plugin.handle, list_items)
    xbmcplugin.endOfDirectory(plugin.handle)
def show_favorites():
    """
    User's favorite channels list
    :return:
    """
    api = API()
    user = User()
    is_authenticated = user.authenticate()

    if is_authenticated:
        favorites = api.get_favorites(user.username, user.token)
        if len(favorites) > 0:
            for item in favorites:
                # list item:
                li = ListItem(u'{0} {1}'.format(
                    item['title'].replace('CALM RADIO -', '').title(),
                    '(VIP)' if 'free' not in item['streams'] else '',
                    item['description']),
                              iconImage='{0}/{1}'.format(
                                  config['urls']['calm_arts_host'],
                                  item['image']),
                              thumbnailImage='{0}/{1}'.format(
                                  config['urls']['calm_arts_host'],
                                  item['image']))
                li.setArt({
                    'fanart':
                    '{0}{1}'.format(config['urls']['calm_blurred_arts_host'],
                                    item['image'])
                })
                li.addContextMenuItems([
                    (ADDON.getLocalizedString(32301),
                     'RunPlugin(plugin://{0}/favorites/remove/{1})'.format(
                         ADDON_ID, item['id']))
                ])
                # directory item:
                addDirectoryItem(
                    PLUGIN.handle,
                    PLUGIN.url_for(play_channel,
                                   category_id=item['category'],
                                   channel_id=item['id']), li)
            # set the content of the directory
            setContent(ADDON_HANDLE, 'songs')
            # end of directory:
            endOfDirectory(PLUGIN.handle)
            executebuiltin('Container.SetViewMode({0})'.format(
                config['viewmodes']['thumbnail'][getSkinDir() if getSkinDir(
                ) in config['viewmodes']['thumbnail'] else 'skin.confluence']))
        # favorites list is empty:
        else:
            executebuiltin('Notification("{0}", "{1}")'.format(
                ADDON.getLocalizedString(30000),
                ADDON.getLocalizedString(32306)))
    # user is not authenticated:
    else:
        executebuiltin('Notification("{0}", "{1}")'.format(
            ADDON.getLocalizedString(30000), ADDON.getLocalizedString(32110)))
예제 #34
0
def anime_list():
    plugin = get_router_instance()

    params = {
        "page": "1",
        "limit": "15",
        "year": "2018",
        "season": "Summer",
        "genres": "",
        "sort": "1",
        "sort2": "",
        "website": ""
    }
    params.update(_get_current_params(plugin))

    int_fields = ["sort", "year", "page", "limit"]
    mapped_ints = {}
    for x in int_fields:
        mapped_ints[x] = int(params.get(x))

    params.update(mapped_ints)

    res = requests.get(BASE_URL + LIST_PATH, params=params)
    json_data = res.json()
    for anime in json_data["data"]["list"]:
        image = anime['backgroundSrc'] if anime['backgroundSrc'] else None
        info = anime['animeSynopsis'] if anime['animeSynopsis'] else ''

        li = ListItem(anime["animeName"])
        li.setArt({'icon': image})
        li.setInfo(type='video', infoLabels={'plot': info})

        addDirectoryItem(
            plugin.handle,
            plugin.url_for(episode_list,
                           id=anime["animeID"],
                           listId=anime["animeListID"],
                           episode_count=anime["animeEpisode"]), li, True)

    are_pages_remaining = math.ceil(
        float(json_data["data"]["count"]) / float(params["limit"])) > int(
            params.get("page"))
    if (are_pages_remaining):
        next_page_params = params.copy()
        next_page_params.update({"page": str(int(params.get("page")) + 1)})

        addDirectoryItem(plugin.handle,
                         plugin.url_for(anime_list, **next_page_params),
                         ListItem('Next Page'), True)

    endOfDirectory(plugin.handle)
예제 #35
0
def play(item_to_play):
    channel_data = fetch_channel_data(fetch_local_channel_data,
                                      fetch_remote_channel_data)
    xml_data = ET.fromstring(channel_data)
    try:
        channel_data = xml_data.find(".//channel[@id='" + item_to_play + "']")
        channel = Channel(handle, tempdir, channel_data, quality_priority(),
                          format_priority())
    except:
        for element in xml_data.findall(".//channel"):
            channel = Channel(handle, tempdir, element, quality_priority(),
                              format_priority())
            if channel.getid() == item_to_play:
                break

    list_item = ListItem(channel.get_simple_element('title'),
                         channel.get_simple_element('description'),
                         channel.geticon(), channel.getthumbnail(),
                         channel.get_content_url())
    list_item.setArt({
        "fanart":
        xbmc.translatePath("special://home/addons/%s/fanart.jpg" % __addonid__)
    })
    xbmcplugin.setResolvedUrl(handle, True, list_item)
예제 #36
0
def video_list(addon_handle, videos):
    xbmcplugin.setContent(addon_handle, 'videos')

    for video in videos:
        li = ListItem(video.name)
        li.setArt({'icon': video.large_thumbnail_url})
        li.setProperty('IsPlayable', 'true')
        # See https://mirrors.kodi.tv/docs/python-docs/16.x-jarvis/xbmcgui.html#ListItem
        info = {
            'mediatype': 'video',
            'plot': video.header,
            'duration': video.duration,
            'studio': video.organization,
        }
        li.setInfo('video', info)
        addDirectoryItem(handle=addon_handle, url=video.ogv_url, listitem=li)
    endOfDirectory(addon_handle)
예제 #37
0
def all():
    sre = SubRedditEvents()
    for sr in streaming_subreddits:
        for s in sre.get_events(sr['url']):
            # Get the number of acestreams available for this event
            # Don't include it if there arent any available
            events = sre.get_event_links(s['submission_id'])
            if events and len(events) > 0:
                title = "[{}] {} ({} Streams)".format(sr['name'], s['title'],
                                                      len(events))
                addDirectoryItem(
                    plugin.handle,
                    plugin.url_for(show_event, s['submission_id']),
                    ListItem(title), True)
    endOfDirectory(plugin.handle)
def show_channels(section_id, category_id):
    """
    Channels page (playable)
    :param section_id: Selected section ID
    :param category_id: Selected category ID
    :return:
    """
    api = API()

    for item in api.get_channels(int(category_id)):
        # list item:
        li = ListItem(
            u'{0} {1}'.format(
                item['title'].replace('CALM RADIO -', '').title(),
                ADDON.getLocalizedString(322023)
                if 'free' not in item['streams'] else '', item['description']),
            iconImage='{0}/{1}'.format(config['urls']['calm_arts_host'],
                                       item['image']),
            thumbnailImage='{0}/{1}'.format(config['urls']['calm_arts_host'],
                                            item['image']))
        li.setArt({
            'fanart':
            '{0}{1}'.format(config['urls']['calm_blurred_arts_host'],
                            item['image'])
        })
        li.addContextMenuItems([
            (ADDON.getLocalizedString(32300),
             'RunPlugin(plugin://{0}/favorites/add/{1})'.format(
                 ADDON_ID, item['id']))
        ])
        li.setInfo(
            'music',
            {'Title': item['title'].replace('CALM RADIO -', '').title()})
        # directory item:
        addDirectoryItem(
            PLUGIN.handle,
            PLUGIN.url_for(play_channel,
                           category_id=category_id,
                           channel_id=item['id']), li)
    # set the content of the directory
    setContent(ADDON_HANDLE, 'songs')
    # end of directory:
    endOfDirectory(PLUGIN.handle)
    executebuiltin('Container.SetViewMode({0})'.format(
        config['viewmodes']['thumbnail'][getSkinDir() if getSkinDir(
        ) in config['viewmodes']['thumbnail'] else 'skin.confluence']))
예제 #39
0
	def addPlaylistItem(self, name, playlist_id, icon, fanart):
		try:
			work_url = "plugin://plugin.video.youtube/playlist/%s/" % playlist_id
			liz = ListItem(name)
			liz.setInfo( type='video', infoLabels={'title': name})
			liz.setArt({'thumb': icon, 'banner': 'DefaultVideo.png', 'fanart': fanart})
			addDirectoryItem(handle=int(argv[1]), url=work_url, listitem=liz, isFolder=True)
		except:
			from resources.lib.modules import log_utils
			log_utils.error()
예제 #40
0
def _():
    items = []

    for (path, title) in request.parse(plugin.path, 'EpisodeListParser'):
        item = ListItem(title)
        item.setInfo('video', {})
        item.setProperty('IsPlayable', 'true')
        items.append((url_for(path), item, False))

    show(items, 'episodes')
예제 #41
0
	def addSectionItem(self, name, iconimage, fanart):
		try:
			url = '%s?action=sectionItem' % argv[0]
			liz = ListItem(label=name, offscreen=True)
			liz.setArt({'icon': 'DefaultFolder.png', 'thumb': iconimage, 'fanart': fanart})
			liz.setInfo(type='video', infoLabels={'title': name, 'plot': description})
			addDirectoryItem(handle=int(argv[1]), url=url, listitem=liz, isFolder=False)
		except:
			from resources.lib.modules import log_utils
			log_utils.error()
예제 #42
0
def show_trailer(category_id):
    urllib3.disable_warnings()
    path = ""
    listitem = ListItem(path=simple.trailerLink(category_id.replace('_','/')))
    logger.log(0,path)
    logger.log(1,path)
    logger.log(2,path)
    listitem.setInfo('video',infoLabels={ "Title": "title" , "Plot" : "plot" })
    listitem.setProperty('IsPlayable', 'true')
    setResolvedUrl(plugin.handle, True, listitem)
예제 #43
0
파일: addon.py 프로젝트: peiit/kodi_plugins
def list_playsource(episode, name):
    html = get_html(_meijumao + episode, headers={'Host': 'www.meijumao.net'})
    soup_source = BeautifulSoup(html, "html.parser")
    listing = []
    for source in soup_source.find_all(
            "a", attrs={"class": "button button-small button-rounded"}):
        list_item = ListItem(label=source.get_text())
        if source.get("href").startswith("http"):
            continue
        # url = '{0}?action=play_video&episode={1}&name={2}'.format(_url, source.get("href"),name)
        listing.append((source.get("href"), name))
    if len(listing) == 0:
        Dialog().ok(__addonname__, '没有找到视频源')
        return
    else:
        play_video(listing[0])
예제 #44
0
def play_film():
    # type: () -> None
    """Attempts to find the m3u8 file for a give href and play it"""
    url = bfis.get_page_url(get_arg("href"))
    video_id = get_arg("video_id")
    target = get_arg("target")
    soup = bfis.get_html(url)
    if not video_id:
        video_id = soup.find(id=target).get(PLAYER_ID_ATTR) \
            if target \
            else soup.find(True, attrs={PLAYER_ID_ATTR: True})[PLAYER_ID_ATTR]
    if video_id:
        if bfis.RECENT_SAVED:
            bfis.recents.append((url, video_id))
        m3u8 = bfis.get_m3u8_url(video_id)
        xbmcplugin.setResolvedUrl(plugin.handle, True, ListItem(path=m3u8))
예제 #45
0
def resolve_event(event, quality=None, format=None):
    if quality not in QUALITY:
        quality = get_set_quality()
    if format not in FORMATS:
        format = get_set_format()

    data = None
    try:
        data = http.fetch_recordings(event, wants_insecure())
    except http.FetchError:
        return
    want = data.recordings_sorted(quality, format)

    if len(want) > 0:
        http.count_view(event, want[0].url, wants_insecure())
        setResolvedUrl(plugin.handle, True, ListItem(path=want[0].url))
예제 #46
0
def index():
    # Request dvr
    try:
        req = requests.get("http://www.rtp.pt/play/direto",
                           headers=HEADERS).text
    except:
        raise_notification()

    match = re.compile(
        r'<a title=".+? - (.+?)" href="/play/direto/(.+?)".*?\n.*?\n.*?<img alt=".+?" src ="(.+?)"'
    ).findall(
        req
    )  #class="item">\n.+?<div class="img-holder">\n.+?<img alt=".+?" src ="(.+?)" class="img-responsive">').findall(req)

    for rtp_channel in RTP_CHANNELS:
        dvr = "Not available"
        progimg = ""
        for prog, key, img in match:
            if key.lower() == rtp_channel["id"]:
                dvr = prog
                if img.startswith("/"):
                    img = "http:{}".format(img)
                progimg = img
                break

        liz = ListItem("[B][COLOR blue]{}[/B][/COLOR] ({})".format(
            kodiutils.compat_py23str(rtp_channel["name"]),
            kodiutils.compat_py23str(dvr)))
        liz.setArt({
            "thumb": progimg,
            "icon": progimg,
            "fanart": kodiutils.FANART
        })
        liz.setProperty('IsPlayable', 'true')
        liz.setInfo("Video",
                    infoLabels={"plot": kodiutils.compat_py23str(dvr)})
        addDirectoryItem(
            plugin.handle,
            plugin.url_for(play,
                           label=kodiutils.compat_py23str(rtp_channel["name"]),
                           channel=kodiutils.compat_py23str(rtp_channel["id"]),
                           img=kodiutils.compat_py23str(progimg),
                           prog=kodiutils.compat_py23str(dvr)), liz, False)

    endOfDirectory(plugin.handle)
예제 #47
0
    def getItemIdFromListItem(listItem: ListItem) -> int:
        """Get the item ID from a ListItem object

        :param listItem: ListItem object to get the ID of
        :type listItem: :class:`ListItem`
        :return: ID of the item
        :rtype: int
        """
        if not listItem:
            raise ValueError('invalid listItem')

        videoInfoTag = listItem.getVideoInfoTag()
        if not videoInfoTag:
            return None

        return Api.getItemIdFromVideoInfoTag(videoInfoTag)
예제 #48
0
    def getPlexMediaClassFromListItem(item: ListItem) -> video.Video:
        """Get the plexapi video obejct type matching the provided ListItem

        :param item: ListItem
        :type item: :class:`xbmcgui.ListItem`
        :return: Plex media class obejct matching the provided media type
        :rtype: :class:`video.Video`
        """
        if not item:
            raise ValueError('invalid item')

        videoInfoTag = item.getVideoInfoTag()
        if not videoInfoTag:
            return None

        return Api.getPlexMediaClassFromVideoInfoTag(videoInfoTag)
    def _find_import_for_item(
            self, item: xbmcgui.ListItem) -> xbmcmediaimport.MediaImport:
        video_info_tag = item.getVideoInfoTag()
        if not video_info_tag:
            return None

        item_media_type = video_info_tag.getMediaType()

        matching_imports = [
            media_import for media_import in self._imports
            if item_media_type in media_import.getMediaTypes()
        ]
        if not matching_imports:
            return None

        return matching_imports[0]
예제 #50
0
파일: addon.py 프로젝트: peiit/kodi_plugins
def list_categories(article):
    html = get_html(_meijumao + article, headers={'Host': 'www.meijumao.net'})
    soup = BeautifulSoup(html, "html.parser")
    is_folder = True
    listing = []
    for urls in soup.find_all("a", attrs={"data-remote": "true"}):
        list_item = ListItem(label=urls.div.get_text())
        url = '{0}?action=list_sections&section={1}'.format(
            _url,
            urls.get("href").replace(_meijumao, ""))
        listing.append((url, list_item, is_folder))

    xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
    #xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
예제 #51
0
def index():
    rows = session.get(tvf_api_url + '/v2/api/v2/home/w/rows')
    itmes = []
    if rows.status_code == 200:
        rows = rows.json()['data']['rows']
        for row in rows:
            # path = row['web_api'][7:].replace(
            #     '/{{page}}/{{limit}}', '').replace('/w', '')
            # log(path, LOGNOTICE)
            # r = path.split('/')
            itmes.append(
                (plugin.url_for(show_handle,
                                row['web_api']), ListItem(row['name']), True))
            # args = {"handle": r[0], "category": r[1], "number": r[2]}
    addDirectoryItems(plugin.handle, itmes)
    endOfDirectory(plugin.handle)
예제 #52
0
def show_tv_series_list():
    xbmcplugin.setContent(_handle, 'tvshows')

    try:
        for item in zalukaj.fetch_tv_series_list():
            addDirectoryItem(
                plugin.handle,
                plugin.url_for(show_tv_series_seasons_list,
                               b64encode(item['url'])),
                ListItem(item['title']), True)
    except ZalukajError as e:
        notification(header='[COLOR red]Błąd[/COLOR]',
                     message=e.message,
                     time=5000)

    endOfDirectory(plugin.handle)
예제 #53
0
def show_group(group_name):
    # on/off button
    addDirectoryItem(plugin.handle, plugin.url_for(toggle_group, group_name),
                     ListItem("Toggle %s on/off" % group_name))
    # applicable scenes
    for scene in bridge.scenes:
        if scene.group == str(bridge.get_group_id_by_name(group_name)):
            li = ListItem("Set scene %s" % scene.name)
            li.addContextMenuItems([
                ('Set on Playback start/resume',
                 'RunPlugin(plugin://plugin.program.hue.controller/setSetting/playback_start/%s/%s)'
                 % (group_name, scene.name)),
                ('Set on Playback paused',
                 'RunPlugin(plugin://plugin.program.hue.controller/setSetting/playback_paused/%s/%s)'
                 % (group_name, scene.name)),
                ('Set on Playback stopped',
                 'RunPlugin(plugin://plugin.program.hue.controller/setSetting/playback_end/%s/%s)'
                 % (group_name, scene.name))
            ])
            addDirectoryItem(
                plugin.handle,
                plugin.url_for(scene_group, group_name, scene.name), li)
    # add a special "lights off" scene
    li = ListItem("Set scene Lights Off")
    li.addContextMenuItems([
        ('Set on Playback start/resume',
         'RunPlugin(plugin://plugin.program.hue.controller/setSetting/playback_start/%s/%s)'
         % (group_name, 'HueControllerLightsOff')),
        ('Set on Playback paused',
         'RunPlugin(plugin://plugin.program.hue.controller/setSetting/playback_paused/%s/%s)'
         % (group_name, 'HueControllerLightsOff')),
        ('Set on Playback stopped',
         'RunPlugin(plugin://plugin.program.hue.controller/setSetting/playback_end/%s/%s)'
         % (group_name, 'HueControllerLightsOff'))
    ])
    addDirectoryItem(
        plugin.handle,
        plugin.url_for(scene_group, group_name, 'HueControllerLightsOff'), li)

    endOfDirectory(plugin.handle)
예제 #54
0
def show_search():
    xbmcplugin.setContent(_handle, 'movies')
    try:
        search_phrase = xbmcgui.Dialog().input('Szukaj filmu',
                                               type=xbmcgui.INPUT_ALPHANUM)
        if search_phrase:
            for item in zalukaj.search_movies(search_phrase):
                list_item = ListItem(item['title'])
                if 'img' in item:
                    list_item.setArt({
                        "thumb": item['img'],
                        "poster": item['img'],
                        "banner": item['img'],
                        "icon": item['img'],
                        "landscape": item['img'],
                        "clearlogo": item['img'],
                        "fanart": item['img']
                    })

                list_item.setInfo(
                    'video', {
                        "year": item.get('year', None),
                        "plot": item.get('description', ''),
                        "plotoutline": item.get('description', ''),
                        "title": item['title'],
                    })

                if item.get('tv_series') is True:
                    addDirectoryItem(
                        plugin.handle,
                        plugin.url_for(show_tv_series_seasons_list,
                                       b64encode(item['url'])), list_item,
                        True)
                else:
                    list_item.setProperty('IsPlayable', 'true')
                    addDirectoryItem(
                        plugin.handle,
                        plugin.url_for(play_movie, b64encode(item['url'])),
                        list_item)

    except ZalukajError as e:
        notification(header='[COLOR red]Błąd[/COLOR]',
                     message=e.message,
                     time=5000)
    endOfDirectory(plugin.handle)
예제 #55
0
def search():

    input_text = Dialog().input(kodiutils.get_string(32007), "",
                                INPUT_ALPHANUM)

    try:
        req = requests.get(
            "https://www.rtp.pt/play/pesquisa?q={}".format(input_text),
            headers=HEADERS_VOD).text
    except:
        raise_notification()

    pagei = ListItem("{} [B]{}[/B]".format(kodiutils.get_string(32008),
                                           input_text))
    addDirectoryItem(handle=plugin.handle,
                     listitem=pagei,
                     isFolder=False,
                     url="")

    soup = BeautifulSoup(req, 'html.parser')

    for a in soup.find('section').find_all('a'):
        url = a.get('href')
        title = a.get('title')
        img = a.find('img').get('src')
        metas = a.find_next_sibling('i').find_all('meta')
        description = metas[1].get('content')

        liz = ListItem("{}".format(kodiutils.compat_py23str(title)))
        liz.setArt({"thumb": img, "icon": img, "fanart": kodiutils.FANART})
        liz.setInfo("Video",
                    infoLabels={
                        "plot":
                        kodiutils.strip_html_tags(
                            kodiutils.compat_py23str(description)),
                        "title":
                        kodiutils.compat_py23str(title)
                    })

        addDirectoryItem(
            plugin.handle,
            plugin.url_for(programs_episodes,
                           title=kodiutils.compat_py23str(title),
                           ep=kodiutils.compat_py23str(title),
                           img=kodiutils.compat_py23str(img),
                           description=kodiutils.compat_py23str(description),
                           url=kodiutils.compat_py23str(url),
                           page=1), liz, True)
    endOfDirectory(plugin.handle)
예제 #56
0
def list_playlist(channelID):
    xbmcgui.Window(10138).setProperty('isShowAD', "false")
    playlists = _channels[channelID]['playlists']
    for playlistID in playlists:
        metadata = playlists[playlistID]["metadata"]
        xbmc.log(str(metadata), 2)
        liz = ListItem(label=metadata["title"])
        infolabels = {"plot": metadata["description"], "Genre":"Genre Here"}
        liz.setInfo(type="video", infoLabels=infolabels)
        liz.setArt({"thumb": metadata["thumb"], "fanart": metadata["thumb"]})
        addDirectoryItem(plugin.handle, plugin.url_for(all_videos, playlistID=playlistID), liz, True)    
예제 #57
0
def all_videos():
    playlistID = plugin.args["playlistID"][0] if "playlistID" in plugin.args.keys() else ""

    liz = ListItem(label="Play All")
    liz.setInfo(type="video", infoLabels={"plot": "", "Genre":""})
    liz.setProperty('IsPlayable', 'true')
    addDirectoryItem(plugin.handle, plugin.url_for(play_playlist, playlistID=playlistID), liz, False)
    list_videos(playlistID)
    xbmcplugin.setContent(plugin.handle, 'episodes')
    xbmc.executebuiltin("Container.SetViewMode(502)")
    endOfDirectory(plugin.handle)
예제 #58
0
 def createFolder(self,
                  name,
                  params,
                  contextMenu=[],
                  arturl='',
                  name2='*',
                  fanarturl=utils.addon.getAddonInfo('fanart')):
     li = ListItem(label=name, label2=name2)
     li.setArt({'thumb': arturl, 'fanart': fanarturl})
     li.addContextMenuItems(contextMenu)
     return "?".join([utils.addon_url, urlencode(params)]), li, "true"
예제 #59
0
def root():
    items = [
        (plugin.url_for(live), ListItem("Direkte"), True),
        (plugin.url_for(recommended), ListItem("Anbefalt"), True),
        (plugin.url_for(popular), ListItem("Mest sett"), True),
        (plugin.url_for(mostrecent), ListItem("Sist sendt"), True),
        (plugin.url_for(browse), ListItem("Kategorier"), True),
        (plugin.url_for(search), ListItem("Søk"), True),
    ]
    addDirectoryItems(plugin.handle, items)
    endOfDirectory(plugin.handle)
def index():
    #All videos
    liz = ListItem("[I]%s[/I]" % (kodiutils.get_string(32000)))
    liz.setInfo(type="video", infoLabels={"plot": kodiutils.get_string(32001)})
    liz.setArt({"thumb": ICON, "icon": ICON, "fanart": FANART})
    addDirectoryItem(plugin.handle, plugin.url_for(all_videos, playlist="all"),
                     liz, True)
    #Playlists
    for liz in youtubelib.get_playlists():
        addDirectoryItem(
            plugin.handle,
            plugin.url_for(all_videos,
                           playlist=liz.getProperty("playlist_id")), liz, True)
    xbmcplugin.setContent(plugin.handle, 'tvshows')
    endOfDirectory(plugin.handle)