def index(router, params): handle = router.session.handle limit = utils.addon.getSettingInt('page_limit') offset = params.get('offset', 0) resp = api.serials(router.session.token['token'], limit, offset) serials = [] for srl in resp['serials']: li = xbmcgui.ListItem(label=srl['title'], label2=srl['description']) li.setArt({'poster': api.art_url(srl['poster_id'])}) if srl['fanart_id']: li.setArt({'fanart': api.art_url(srl['fanart_id'], 630, 354)}) li.setInfo('video', dict(title=srl['title'], plot=srl['description'])) url = router.serials_url('seasons', id=srl['id'], serials_offset=offset) serials.append((url, li, True)) # Next page if resp['offset'] < resp['total']: label = _('li.next_page_left') % (resp['total'] - resp['offset']) li = xbmcgui.ListItem(label=label) url = router.serials_url('index', offset=resp['offset']) serials.append((url, li, True)) xbmcplugin.addDirectoryItems(handle, serials, len(serials)) xbmcplugin.endOfDirectory(handle, updateListing=router.session.is_redirect) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TITLE)
def index(router, params): handle = router.session.handle limit = utils.addon.getSettingInt('page_limit') offset = params.get('offset', 0) free = utils.addon.getSettingBool('free_movies_only') resp = api.movies(router.session.token['token'], limit, offset, free) movies = [] for mov in resp['movies']: li = xbmcgui.ListItem(label=mov['title'], label2=mov['description']) li.setArt({'poster': api.art_url(mov['poster_id'])}) if mov['fanart_id']: li.setArt({'fanart': api.art_url(mov['fanart_id'], 630, 354)}) li.setInfo('video', dict( title=mov['title'], plot=mov['description'] )) li.setProperty('IsPlayable', 'true') url = router.root_url('play', id=mov['id'], hls_id=mov['hls_id']) movies.append((url, li, False)) # Next page if resp['offset'] < resp['total']: label = _('li.next_page_left') % (resp['total'] - resp['offset']) li = xbmcgui.ListItem(label=label) url = router.movies_url('index', offset=resp['offset']) movies.append((url, li, True)) xbmcplugin.addDirectoryItems(handle, movies, len(movies)) xbmcplugin.endOfDirectory(handle) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TITLE)
def index(router, params): handle = router.session.handle limit = utils.addon.getSettingInt('page_limit') page = params.get('page', 1) resp = api.channel_packages(router.session.token['token'], limit, page) packages = [] for pkg in resp['packages']: li = xbmcgui.ListItem(label=pkg['title'], label2=pkg['description']) li.setArt(dict( poster=api.art_url(pkg['poster_id']), fanart=api.art_url(pkg['fanart_id']) )) li.setInfo('video', dict(title=pkg['title'], plot=pkg['description'])) adult = {'adult': 1} if pkg['adult'] == 'adult' else {} url = router.channel_packages_url('channels', id=pkg['id'], packages_page=page, **adult) packages.append((url, li, True)) # Next page if page < resp['pages']: url = router.channel_packages_url('index', page=page + 1) label = _('li.next_page_number') % (page + 1, resp['pages']) li = xbmcgui.ListItem(label=label) packages.append((url, li, True)) xbmcplugin.addDirectoryItems(handle, packages, len(packages)) xbmcplugin.endOfDirectory(handle, updateListing=router.session.is_redirect)
def channels(router, params): handle = router.session.handle resp = api.package_channels(router.session.token['token'], params['id'], params.get('adult')) items = [] for ch in resp['channels']: li = xbmcgui.ListItem(label=ch['title'], label2=ch['description']) li.setArt({'poster': api.art_url(ch['poster_id'])}) li.setInfo('video', dict( title=ch['title'], plot=ch['description'], tracknumber=ch['lcn'] )) li.setProperty('IsPlayable', 'true') url = router.root_url('play', id=ch['id'], hls_id=ch['hls_id']) items.append((url, li, False)) xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TRACKNUM) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TITLE)
def seasons(router, params): handle = router.session.handle resp = api.seasons(router.session.token['token'], params['id']) items = [] for sn in resp['seasons']: li = xbmcgui.ListItem(label=sn['title'], label2=sn['description']) li.setArt({'poster': api.art_url(sn['poster_id'])}) li.setInfo( 'video', dict(title=sn['title'], plot=sn['description'], tracknumber=sn['number'])) url = router.serials_url('episodes', id=sn['id'], serial_id=params['id']) items.append((url, li, True)) xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle, updateListing=router.session.is_redirect) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TRACKNUM) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TITLE)
def index(router, params): handle = router.session.handle token = router.session.token paginate = utils.addon.getSettingBool('channels_pagination') if token['is_bound'] and paginate: limit = utils.addon.getSettingInt('page_limit') page = params.get('page', 1) resp = api.channels(token['token'], limit, page) else: resp = api.channels_all(token['token'], not token['is_bound']) channels = [] for ch in resp['channels']: li = xbmcgui.ListItem(label=ch['title'], label2=ch['description']) li.setArt({'poster': api.art_url(ch['poster_id'])}) li.setInfo( 'video', dict(title=ch['title'], plot=ch['description'], tracknumber=ch['lcn'])) li.setProperty('IsPlayable', 'true') url = router.root_url('play', id=ch['id'], hls_id=ch['hls_id']) channels.append((url, li, False)) # Next page if paginate and page < resp['pages']: url = router.channels_url('index', page=page + 1) label = _('li.next_page_number') % (page + 1, resp['pages']) li = xbmcgui.ListItem(label=label) channels.append((url, li, True)) xbmcplugin.addDirectoryItems(handle, channels, len(channels)) xbmcplugin.endOfDirectory(handle) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TRACKNUM) xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_TITLE)