def addPager(title, url, thumb, total): li = xbmcgui.ListItem(title, thumbnailImage=thumb) playable = plugin.route_for(url) == play li.setProperty('isplayable', str(playable)) if playable: li.setInfo('video', {'plot':descr}) xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for(url), li, not playable, total)
def view(elements, next_url=None): if not elements: error_title = __translation(30002) error_message1 = __translation(30003) error_message2 = __translation(30004) dialog = xbmcgui.Dialog() dialog.ok(error_title, error_message1, error_message2) return total = len(elements) for title, url, descr, thumb in elements: descr = descr() if callable(descr) else descr thumb = thumb() if callable(thumb) else thumb li = xbmcgui.ListItem(title, thumbnailImage=thumb) playable = plugin.route_for(url) == play li.setProperty('isplayable', str(playable)) if playable: li.setInfo('video', {'plot':descr}) xbmcplugin.addDirectoryItem(plugin.handle, plugin.url_for(url), li, not playable, total) if next_url: text_next_page = __translation(30001) addPager(text_next_page, next_url, '', total) xbmcplugin.endOfDirectory(plugin.handle)
def view(titles, urls, thumbs=repeat(""), bgs=repeat(""), descr=repeat("")): total = len(titles) for title, url, descr, thumb, bg in zip(titles, urls, descr, thumbs, bgs): descr = descr() if callable(descr) else descr thumb = thumb() if callable(thumb) else thumb bg = bg() if callable(bg) else bg li = ListItem(title, thumbnailImage=thumb) playable = plugin.route_for(url) == play li.setProperty("isplayable", str(playable)) li.setProperty("fanart_image", bg) if playable: li.setInfo("video", {"plot": descr}) addDirectoryItem(plugin.handle, plugin.url_for(url), li, not playable, total) endOfDirectory(plugin.handle)