def list_related(epgId, label): xbmcplugin.setPluginCategory(_handle, label) addon = xbmcaddon.Addon(id=plugin_id) channels = Channels() channels_list = channels.get_channels_list() data = call_o2_api(url='https://api.o2tv.cz/unity/api/v1/programs/' + str(epgId) + '/related/?encodedChannels=' + channels.get_encoded_channels() + '&isFuture=false', data=None, header=get_header_unity()) if 'err' in data: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s načtením kategorie', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() if 'result' in data and len(data['result']) > 0: for event in data['result']: if event['channelKey'] in channels_list: startts = event['start'] / 1000 start = datetime.fromtimestamp(event['start'] / 1000) endts = event['end'] / 1000 end = datetime.fromtimestamp(event['end'] / 1000) epgId = event['epgId'] list_item = xbmcgui.ListItem( label=event['name'] + ' (' + channels_list[event['channelKey']]['name'] + ' | ' + decode(utils.day_translation_short[start.strftime('%w')]) + ' ' + start.strftime('%d.%m %H:%M') + ' - ' + end.strftime('%H:%M') + ')') list_item.setInfo( 'video', { 'mediatype': 'movie', 'title': event['name'] + ' (' + channels_list[event['channelKey']]['name'] + ')' }) list_item = get_listitem_epg_details( list_item, str(event['epgId']), channels_list[event['channelKey']]['logo']) list_item.setProperty('IsPlayable', 'true') list_item.setContentLookup(False) if addon.getSetting('download_streams') == 'true': list_item.addContextMenuItems([ ('Stáhnout', 'RunPlugin(plugin://' + plugin_id + '?action=add_to_queue&epgId=' + str(epgId) + ')') ]) url = get_url(action='play_archiv', channelKey=encode(event['channelKey']), start=startts, end=endts, epgId=epgId) xbmcplugin.addDirectoryItem(_handle, url, list_item, False) xbmcplugin.endOfDirectory(_handle) else: xbmcgui.Dialog().notification('Sledování O2TV', 'Žádné pořady nenalezeny', xbmcgui.NOTIFICATION_INFO, 4000)
def list_series(epgId, season, label): xbmcplugin.setPluginCategory(_handle, label) params = '' channels = Channels() channels_list = channels.get_channels_list() if int(season) > 0: params = params + '&seasonNumber=' + str(season) data = call_o2_api( url='https://api.o2tv.cz/unity/api/v1/programs/' + str(epgId) + '/episodes/?containsAllGenres=false&encodedChannels=' + channels.get_encoded_channels() + '&isFuture=false' + params, data=None, header=get_header_unity()) if 'err' in data: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s načtením kategorie', xbmcgui.NOTIFICATION_ERROR, 4000) sys.exit() if 'result' in data and len(data['result']) > 0: for event in data['result']: if event['channelKey'] in channels_list: startts = event['start'] / 1000 start = datetime.fromtimestamp(event['start'] / 1000) endts = event['end'] / 1000 end = datetime.fromtimestamp(event['end'] / 1000) epgId = event['epgId'] list_item = xbmcgui.ListItem( label=event['name'] + ' (' + channels_list[event['channelKey']]['name'] + ' | ' + decode(utils.day_translation_short[start.strftime('%w')]) + ' ' + start.strftime('%d.%m %H:%M') + ' - ' + end.strftime('%H:%M') + ')') list_item.setInfo( 'video', { 'mediatype': 'movie', 'title': event['name'] + ' (' + channels_list[event['channelKey']]['name'] + ')' }) list_item = get_listitem_epg_details( list_item, str(event['epgId']), channels_list[event['channelKey']]['logo']) list_item.setProperty('IsPlayable', 'true') list_item.setContentLookup(False) url = get_url(action='play_archiv', channelKey=encode(event['channelKey']), start=startts, end=endts, epgId=epgId) xbmcplugin.addDirectoryItem(_handle, url, list_item, False) xbmcplugin.endOfDirectory(_handle)
def future_program(channelKey, day, label): label = label.replace('Nahrávky / Plánování /', '') xbmcplugin.setPluginCategory(_handle, label) channels = Channels() channels_list = channels.get_channels_list() channelKey = decode(channelKey) if int(day) == 0: from_datetime = datetime.now() to_datetime = datetime.combine(date.today(), datetime.max.time()) else: from_datetime = datetime.combine( date.today(), datetime.min.time()) + timedelta(days=int(day)) to_datetime = datetime.combine(from_datetime, datetime.max.time()) from_ts = int(time.mktime(from_datetime.timetuple())) to_ts = int(time.mktime(to_datetime.timetuple())) events = get_epg_ts(channelKey, from_ts, to_ts, 5) for key in sorted(events.keys()): epgId = events[key]['epgId'] start = events[key]['start'] end = events[key]['end'] list_item = xbmcgui.ListItem( label=decode(utils.day_translation_short[start.strftime('%w')]) + ' ' + start.strftime('%d.%m %H:%M') + ' - ' + end.strftime('%H:%M') + ' | ' + events[key]['title']) list_item = get_listitem_epg_details(list_item, str(epgId), channels_list[channelKey]['logo']) list_item.setInfo('video', { 'mediatype': 'movie', 'title': events[key]['title'] }) list_item.setProperty('IsPlayable', 'false') list_item.addContextMenuItems([( 'Přidat nahrávku', 'RunPlugin(plugin://' + plugin_id + '?action=add_recording&channelKey=' + channelKey + '&epgId=' + str(epgId) + ')', )]) url = get_url(action='add_recording', channelKey=encode(channelKey), epgId=epgId) xbmcplugin.addDirectoryItem(_handle, url, list_item, False) xbmcplugin.endOfDirectory(_handle)
def list_future_recordings(label): xbmcplugin.setPluginCategory(_handle, label) channels = Channels() channels_list = channels.get_channels_list() session = Session() recordings = {} for serviceid in session.get_services(): data = call_o2_api(url='https://api.o2tv.cz/unity/api/v1/recordings/', data=None, header=get_header_unity( session.services[serviceid])) if 'err' in data: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s načtením nahrávek', xbmcgui.NOTIFICATION_ERROR, 5000) if 'result' in data and len(data['result']) > 0: for program in data['result']: if program['state'] != 'DONE' and program['program'][ 'channelKey'] in channels_list: recordings.update({ program['program']['start'] + random.randint(0, 100): { 'pvrProgramId': program['pvrProgramId'], 'name': program['program']['name'], 'channelKey': program['program']['channelKey'], 'start': decode(utils.day_translation_short[ datetime.fromtimestamp( program['program']['start'] / 1000).strftime('%w')]) + ' ' + datetime.fromtimestamp( program['program']['start'] / 1000).strftime('%d.%m %H:%M'), 'end': datetime.fromtimestamp(program['program']['end'] / 1000).strftime('%H:%M'), 'epgId': program['program']['epgId'] } }) if len(recordings) > 0: for recording in sorted(recordings.keys(), reverse=True): list_item = xbmcgui.ListItem( label=recordings[recording]['name'] + ' (' + recordings[recording]['channelKey'] + ' | ' + recordings[recording]['start'] + ' - ' + recordings[recording]['end'] + ')') list_item.setInfo( 'video', { 'mediatype': 'movie', 'title': recordings[recording]['name'] + ' (' + recordings[recording]['channelKey'] + ')' }) list_item.setProperty('IsPlayable', 'true') list_item = get_listitem_epg_details( list_item, recordings[recording]['epgId'], channels_list[recordings[recording]['channelKey']]['logo']) list_item.addContextMenuItems([( 'Smazat nahrávku', 'RunPlugin(plugin://' + plugin_id + '?action=delete_recording&channelKey=' + recordings[recording]['channelKey'] + '&pvrProgramId=' + str(recordings[recording]['pvrProgramId']) + ')', )]) url = get_url(action='list_future_recordings') xbmcplugin.addDirectoryItem(_handle, url, list_item, True) xbmcplugin.endOfDirectory(_handle, cacheToDisc=False) else: xbmcgui.Dialog().notification('Sledování O2TV', 'Nenalezena žádná nahrávka', xbmcgui.NOTIFICATION_INFO, 5000) sys.exit()
def list_recordings(label): xbmcplugin.setPluginCategory(_handle, label) addon = xbmcaddon.Addon() channels = Channels() channels_list = channels.get_channels_list(visible_filter=False) session = Session() recordings = {} list_item = xbmcgui.ListItem(label='Plánování nahrávek') url = get_url(action='list_planning_recordings', label=label + ' / ' + 'Plánování') xbmcplugin.addDirectoryItem(_handle, url, list_item, True) list_item = xbmcgui.ListItem(label='Naplánované nahrávky') url = get_url(action='list_future_recordings', label=label + ' / ' + 'Naplánované nahrávky') xbmcplugin.addDirectoryItem(_handle, url, list_item, True) for serviceid in session.get_services(): data = call_o2_api(url='https://api.o2tv.cz/unity/api/v1/recordings/', data=None, header=get_header_unity( session.services[serviceid])) if 'err' in data: xbmcgui.Dialog().notification( 'Sledování O2TV', 'Problém s načtením nahrávek, zkuste to znovu', xbmcgui.NOTIFICATION_ERROR, 6000) if 'result' in data and len(data['result']) > 0: for program in data['result']: if program['state'] == 'DONE': recordings.update({ program['program']['start'] + random.randint(0, 100): { 'pvrProgramId': program['pvrProgramId'], 'name': program['program']['name'], 'channelKey': program['program']['channelKey'], 'start': decode(utils.day_translation_short[ datetime.fromtimestamp( program['program']['start'] / 1000).strftime('%w')]) + ' ' + datetime.fromtimestamp( program['program']['start'] / 1000).strftime('%d.%m %H:%M'), 'end': datetime.fromtimestamp(program['program']['end'] / 1000).strftime('%H:%M'), 'epgId': program['program']['epgId'] } }) for recording in sorted(recordings.keys(), reverse=True): if recordings[recording]['channelKey'] in channels_list: list_item = xbmcgui.ListItem( label=recordings[recording]['name'] + ' (' + recordings[recording]['channelKey'] + ' | ' + recordings[recording]['start'] + ' - ' + recordings[recording]['end'] + ')') list_item.setProperty('IsPlayable', 'true') list_item.setInfo( 'video', { 'mediatype': 'movie', 'title': recordings[recording]['name'] + ' (' + recordings[recording]['channelKey'] + ')' }) list_item = get_listitem_epg_details( list_item, recordings[recording]['epgId'], channels_list[recordings[recording]['channelKey']]['logo']) list_item.setContentLookup(False) menus = [('Smazat nahrávku', 'RunPlugin(plugin://' + plugin_id + '?action=delete_recording&channelKey=' + recordings[recording]['channelKey'] + '&pvrProgramId=' + str(recordings[recording]['pvrProgramId']) + ')')] if addon.getSetting('download_streams') == 'true': menus.append( ('Stáhnout', 'RunPlugin(plugin://' + plugin_id + '?action=add_to_queue&epgId=' + str(recordings[recording]['epgId']) + '&pvrProgramId=' + str(recordings[recording]['pvrProgramId']) + ')')) list_item.addContextMenuItems(menus) url = get_url(action='play_recording', channelKey=encode( recordings[recording]['channelKey']), pvrProgramId=recordings[recording]['pvrProgramId'], title=encode(recordings[recording]['name'])) xbmcplugin.addDirectoryItem(_handle, url, list_item, False) xbmcplugin.endOfDirectory(_handle, cacheToDisc=False)
def list_program(channelKey, day_min, label): label = label.replace('Archiv /', '') xbmcplugin.setPluginCategory(_handle, label) addon = xbmcaddon.Addon() channelKey = decode(channelKey) channels = Channels() channels_list = channels.get_channels_list() if int(day_min) == 0: from_datetime = datetime.combine(date.today(), datetime.min.time()) to_datetime = datetime.now() else: from_datetime = datetime.combine( date.today(), datetime.min.time()) - timedelta(days=int(day_min)) to_datetime = datetime.combine(from_datetime, datetime.max.time()) from_ts = int(time.mktime(from_datetime.timetuple())) to_ts = int(time.mktime(to_datetime.timetuple())) events = {} events = get_epg_ts(channelKey, from_ts, to_ts, 8) if addon.getSetting('archive_reverse_sort') == "true": archive_reverse = True else: archive_reverse = False for key in sorted(events.keys(), reverse=archive_reverse): if int(events[key]['endts']) > int( time.mktime(datetime.now().timetuple())) - 60 * 60 * 24 * 7: list_item = xbmcgui.ListItem( label=decode(utils.day_translation_short[ events[key]['start'].strftime('%w')]) + ' ' + events[key]['start'].strftime('%d.%m %H:%M') + ' - ' + events[key]['end'].strftime('%H:%M') + ' | ' + events[key]['title']) list_item.setInfo('video', { 'mediatype': 'movie', 'title': events[key]['title'] }) list_item = get_listitem_epg_details( list_item, str(events[key]['epgId']), channels_list[channelKey]['logo']) list_item.setProperty('IsPlayable', 'true') list_item.setContentLookup(False) menus = [ ('Přidat nahrávku', 'RunPlugin(plugin://' + plugin_id + '?action=add_recording&channelKey=' + channelKey + '&epgId=' + str(events[key]['epgId']) + ')'), ('Související pořady', 'Container.Update(plugin://' + plugin_id + '?action=list_related&epgId=' + str(events[key]['epgId']) + '&label=Související / ' + encode(events[key]['title']) + ')'), ('Vysílání pořadu', 'Container.Update(plugin://' + plugin_id + '?action=list_same&epgId=' + str(events[key]['epgId']) + '&label=' + encode(events[key]['title']) + ')') ] if addon.getSetting('download_streams') == 'true': menus.append(('Stáhnout', 'RunPlugin(plugin://' + plugin_id + '?action=add_to_queue&epgId=' + str(events[key]['epgId']) + ')')) list_item.addContextMenuItems(menus) url = get_url(action='play_archiv', channelKey=encode(channelKey), start=events[key]['startts'], end=events[key]['endts'], epgId=events[key]['epgId']) xbmcplugin.addDirectoryItem(_handle, url, list_item, False) xbmcplugin.endOfDirectory(_handle, cacheToDisc=False)
def play_video(type, channelKey, start, end, epgId, title): addon = xbmcaddon.Addon() session = Session() channelKey = decode(channelKey) channels = Channels() channels_list = channels.get_channels_list(visible_filter=False) header_unity = get_header_unity( session.get_service(channels_list[channelKey]['serviceid'])) header = get_header( session.get_service(channels_list[channelKey]['serviceid'])) if 'serviceid' not in channels_list[channelKey] or len( channels_list[channelKey]['serviceid']) == 0: xbmcgui.Dialog().notification( 'Sledování O2TV', 'Pravděpodobně neaktivní kanál. Zkuste reset kanálů.', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() subscription = session.get_service( channels_list[channelKey]['serviceid'])['subscription'] if addon.getSetting('select_resolution') == 'true' and addon.getSetting( 'stream_type') == 'HLS' and addon.getSetting('only_sd') != 'true': resolution = xbmcgui.Dialog().select('Rozlišení', ['HD', 'SD'], preselect=0) else: resolution = -1 if addon.getSetting('stream_type') == 'MPEG-DASH': stream_type = 'DASH' else: stream_type = 'HLS' force_mpeg_dash = 0 if addon.getSetting('stream_type') == 'HLS' and xbmc.getCondVisibility( 'System.HasAddon(inputstream.adaptive)') and ( type == 'live_iptv' or type == 'live_iptv_epg' ) and addon.getSetting('force_mpeg_dash') == 'true': stream_type = 'DASH' force_mpeg_dash = 1 if type == 'live' or type == 'live_iptv' or type == 'live_iptv_epg': startts = 0 channels_details = get_epg_live(len(channels_list.keys())) if channels_list[channelKey]['name'] in channels_details: without_details = 0 else: without_details = 1 if channelKey in channels_list and without_details == 0: data = channels_details[channels_list[channelKey]['name']] start = data['start'] startts = int(time.mktime(start.timetuple())) end = data['end'] epgId = str(data['epgId']) if addon.getSetting('stream_type') == 'MPEG-DASH-web': if type == 'archiv' or type == 'archiv_iptv': data = call_o2_api( url='https://api.o2tv.cz/unity/api/v1/programs/' + str(epgId) + '/playlist/', data=None, header=header_unity) if type == 'live' or type == 'live_iptv' or type == 'live_iptv_epg': data = call_o2_api( url= 'https://api.o2tv.cz/unity/api/v1/channels/playlist/?channelKey=' + quote(channelKey), data=None, header=header_unity) if type == 'recording': data = call_o2_api( url='https://api.o2tv.cz/unity/api/v1/recordings/' + str(epgId) + '/playlist/', data=None, header=header_unity) if 'err' in data: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s přehráním streamu', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() if 'playlist' in data and len( data['playlist']) > 0 and 'streamUrls' in data['playlist'][ 0] and 'main' in data['playlist'][0]['streamUrls'] and len( data['playlist'][0]['streamUrls']['main']) > 0: if 'timeshift' in data['playlist'][0]['streamUrls']: url = data['playlist'][0]['streamUrls']['timeshift'] else: url = data['playlist'][0]['streamUrls']['main'] request = Request(url=url, data=None, headers=header) response = urlopen(request) url = response.geturl() else: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s přehráním streamu', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() else: if type == 'archiv' or type == 'archiv_iptv': start = int(float(start) * 1000) end = int(float(end) * 1000) post = { 'serviceType': 'TIMESHIFT_TV', 'deviceType': addon.getSetting('devicetype'), 'streamingProtocol': stream_type, 'subscriptionCode': subscription, 'channelKey': encode(channelKey), 'fromTimestamp': str(start), 'toTimestamp': str(end + (int(addon.getSetting('offset')) * 60 * 1000)), 'id': epgId, 'encryptionType': 'NONE' } if type == 'live' or type == 'live_iptv' or type == 'live_iptv_epg': if (addon.getSetting('stream_type') == 'MPEG-DASH' or force_mpeg_dash == 1 ) and startts > 0 and addon.getSetting('startover') == 'true': startts = int(float(startts) * 1000 - 300000) post = { 'serviceType': 'STARTOVER_TV', 'deviceType': addon.getSetting('devicetype'), 'streamingProtocol': stream_type, 'subscriptionCode': subscription, 'channelKey': encode(channelKey), 'fromTimestamp': startts, 'encryptionType': 'NONE' } else: post = { 'serviceType': 'LIVE_TV', 'deviceType': addon.getSetting('devicetype'), 'streamingProtocol': stream_type, 'subscriptionCode': subscription, 'channelKey': encode(channelKey), 'encryptionType': 'NONE' } if type == 'recording': post = { 'serviceType': 'NPVR', 'deviceType': addon.getSetting('devicetype'), 'streamingProtocol': stream_type, 'subscriptionCode': subscription, 'contentId': epgId, 'encryptionType': 'NONE' } if addon.getSetting( 'stream_type') != 'MPEG-DASH' and force_mpeg_dash == 0 and ( addon.getSetting('only_sd') == 'true' or resolution == 1): post.update({'resolution': 'SD'}) data = call_o2_api( url='https://app.o2tv.cz/sws/server/streaming/uris.json', data=post, header=header) if 'err' in data: if data['err'] == 'Not Found': post = { 'serviceType': 'LIVE_TV', 'deviceType': addon.getSetting('devicetype'), 'streamingProtocol': stream_type, 'subscriptionCode': subscription, 'channelKey': encode(channelKey), 'encryptionType': 'NONE' } data = call_o2_api( url='https://app.o2tv.cz/sws/server/streaming/uris.json', data=post, header=header) if 'err' in data: xbmcgui.Dialog().notification( 'Sledování O2TV', 'Problém s přehráním streamu', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() else: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s přehráním streamu', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() url = '' if 'uris' in data and len( data['uris']) > 0 and 'uri' in data['uris'][0] and len( data['uris'][0]['uri']) > 0: for uris in data['uris']: print(uris) if addon.getSetting( 'only_sd' ) != 'true' and resolution != 1 and uris['resolution'] == 'HD': url = uris['uri'] if (addon.getSetting('only_sd') == 'true' or resolution == 1) and uris['resolution'] == 'SD': url = uris['uri'] if url == '': url = data['uris'][0]['uri'] if addon.getSetting( 'stream_type') == 'MPEG-DASH' or force_mpeg_dash == 1: request = Request(url=url, data=None, headers=header) response = urlopen(request) url = response.geturl().replace('http:', 'https:').replace( ':80/', ':443/') else: xbmcgui.Dialog().notification('Sledování O2TV', 'Problém s přehráním streamu', xbmcgui.NOTIFICATION_ERROR, 5000) sys.exit() if type == 'live_iptv' or type == 'live_iptv_epg': list_item = xbmcgui.ListItem(path=url) list_item = get_listitem_epg_details(list_item, str(epgId), '', update_from_api=1) elif type == 'archiv_iptv': list_item = xbmcgui.ListItem(title) list_item = get_listitem_epg_details(list_item, str(epgId), '', update_from_api=1) else: list_item = xbmcgui.ListItem(path=url) if addon.getSetting('stream_type') == 'MPEG-DASH' or addon.getSetting( 'stream_type') == 'MPEG-DASH-web' or force_mpeg_dash == 1: list_item.setProperty('inputstreamaddon', 'inputstream.adaptive') list_item.setProperty('inputstream', 'inputstream.adaptive') list_item.setProperty('inputstream.adaptive.manifest_type', 'mpd') list_item.setMimeType('application/dash+xml') if type == 'archiv_iptv' or (type == 'live_iptv' and (addon.getSetting('stream_type') != 'HLS' or force_mpeg_dash == 1) and addon.getSetting('startover') == 'true') or type == 'live_iptv_epg': playlist = xbmc.PlayList(1) playlist.clear() if epgId is not None: event = get_epg_details([str(epgId)], update_from_api=1) list_item.setInfo('video', {'title': event['title']}) else: list_item.setInfo('video', {'title': channels_list[channelKey]['name']}) xbmc.PlayList(1).add(url, list_item) xbmc.Player().play(playlist) else: list_item.setContentLookup(False) xbmcplugin.setResolvedUrl(_handle, True, list_item)
def list_live(page, label): addon = xbmcaddon.Addon() xbmcplugin.setPluginCategory(_handle, label) channels = Channels() channels_list = channels.get_channels_list('number') num = 0 pagesize = int(addon.getSetting('live_pagesize')) channels_details = get_epg_live(len(channels_list.keys())) color = get_color(addon.getSetting('label_color_live')) startitem = (int(page) - 1) * pagesize i = 0 for num in sorted(channels_list.keys()): if i >= startitem and i < startitem + pagesize: channelName = channels_list[num]['name'] channelKey = channels_list[num]['channelKey'] if channelName in channels_details: title = channels_details[channelName]['title'] start = channels_details[channelName]['start'] end = channels_details[channelName]['end'] live = '[COLOR ' + str( color) + '] | ' + title + ' | ' + start.strftime( '%H:%M') + ' - ' + end.strftime('%H:%M') + '[/COLOR]' live_noncolor = ' | ' + title + ' | ' + start.strftime( '%H:%M') + ' - ' + end.strftime('%H:%M') list_item = xbmcgui.ListItem(label=encode(channelName) + encode(live)) list_item.setInfo( 'video', { 'mediatype': 'movie', 'title': encode(channelName) + ' | ' + encode(title) }) list_item = get_listitem_epg_details( list_item, str(channels_details[channelName]['epgId']), channels_list[num]['logo']) else: live = '' live_noncolor = '' list_item = xbmcgui.ListItem(label=encode(channelName) + encode(live)) list_item.setInfo( 'video', { 'mediatype': 'movie', 'title': encode(channelName) + encode(live) }) list_item.setContentLookup(False) list_item.setProperty('IsPlayable', 'true') if channelName in channels_details: list_item.addContextMenuItems([ ('Související pořady', 'Container.Update(plugin://' + plugin_id + '?action=list_related&epgId=' + str(channels_details[channelName]['epgId']) + '&label=Související / ' + encode(channels_details[channelName]['title']) + ')'), ('Vysílání pořadu', 'Container.Update(plugin://' + plugin_id + '?action=list_same&epgId=' + str(channels_details[channelName]['epgId']) + '&label=' + encode(channels_details[channelName]['title']) + ')') ]) url = get_url(action='play_live', channelKey=encode(channelKey), title=encode(channelName) + encode(live_noncolor)) xbmcplugin.addDirectoryItem(_handle, url, list_item, False) i = i + 1 if int(page) * pagesize <= i: list_item = xbmcgui.ListItem(label='další strana') url = get_url(action='list_live', page=int(page) + 1, label='další strana') list_item.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem(_handle, url, list_item, True) xbmcplugin.endOfDirectory(_handle, cacheToDisc=False)