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)
def BrowsePlexContent(viewid, mediatype="", folderid=""): """ Browse Plex Photos: viewid: PMS name of the library mediatype: mediatype, 'photos' nodetype: e.g. 'ondeck' (TBD!!) """ log.debug("BrowsePlexContent called with viewid: %s, mediatype: " "%s, folderid: %s" % (viewid, mediatype, folderid)) if not folderid: # Top-level navigation, so get the content of this section # Get all sections xml = GetPlexSectionResults(viewid, containerSize=int(settings('limitindex'))) try: xml.attrib except AttributeError: log.error("Error download section %s" % viewid) return xbmcplugin.endOfDirectory(HANDLE, False) else: # folderid was passed so we can directly access the folder xml = downloadutils.DownloadUtils().downloadUrl("{server}%s" % folderid) try: xml.attrib except AttributeError: log.error("Error downloading %s" % folderid) return xbmcplugin.endOfDirectory(HANDLE, False) # Set the folder's name xbmcplugin.setPluginCategory(HANDLE, xml.attrib.get('librarySectionTitle')) # set the correct params for the content type if mediatype == "photos": xbmcplugin.setContent(HANDLE, 'photos') # process the listing for item in xml: api = API(item) if item.tag == 'Directory': li = ListItem(item.attrib.get('title', 'Missing title')) # for folders we add an additional browse request, passing the # folderId li.setProperty('IsFolder', 'true') li.setProperty('IsPlayable', 'false') path = "%s?id=%s&mode=browseplex&type=%s&folderid=%s" \ % (ARGV_0, viewid, mediatype, api.getKey()) api.set_listitem_artwork(li) xbmcplugin.addDirectoryItem(handle=HANDLE, url=path, listitem=li, isFolder=True) else: li = api.CreateListItemFromPlexItem() api.set_listitem_artwork(li) xbmcplugin.addDirectoryItem(handle=HANDLE, url=li.getProperty("path"), listitem=li) xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_VIDEO_TITLE) xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_VIDEO_RATING) xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_VIDEO_RUNTIME) xbmcplugin.endOfDirectory( handle=HANDLE, cacheToDisc=settings('enableTextureCache') == 'true')