def add_list_items(self, items, content=None, end=True, withNextPage=False):
if content:
xbmcplugin.setContent(plugin.handle, content)
list_items = []
for item in items:
if isinstance(item, Category):
category_items = item.getListItems()
for url, li, isFolder in category_items:
if url and li:
list_items.append((url, li, isFolder))
elif isinstance(item, BrowsableMedia):
url, li, isFolder = item.getListItem()
if url and li:
list_items.append((url, li, isFolder))
if withNextPage and len(items) > 0:
# Add folder for next page
try:
totalNumberOfItems = items[0]._totalNumberOfItems
nextOffset = items[0]._offset + self._config.pageSize
if nextOffset < totalNumberOfItems and len(items) >= self._config.pageSize:
path = urlsplit(sys.argv[0]).path or '/'
path = path.split('/')[:-1]
path.append(str(nextOffset))
url = '/'.join(path)
self.add_directory_item(_T(30244).format(pos1=nextOffset, pos2=min(nextOffset+self._config.pageSize, totalNumberOfItems)), plugin.url_for_path(url))
except:
log('Next Page for URL %s not set' % sys.argv[0], xbmc.LOGERROR)
if len(list_items) > 0:
xbmcplugin.addDirectoryItems(plugin.handle, list_items)
if end:
xbmcplugin.endOfDirectory(plugin.handle)
评论列表
文章目录