def listTVShows(path, channel_id=None, letter=None, page=0): selection = '{totalCount,data{id,titles{default},images(subType:"Teaser"){url,subType},shortDescriptions{default}}}' # url = '%s%s?selection=%s&limit=%s&skip=%s&sortBy=titles.default&sortAscending=true' % (serviceUrl, path, selection, videos_per_page, page * videos_per_page) url = '%s%s?selection=%s&sortBy=titles.default&sortAscending=true&limit=5000' % ( serviceUrl, path, selection) if channel_id: url += '&channelId=' + channel_id # if letter: # url += '&search=(^%s)' % (letter) response = seventv.getUrl(url).get('response') content = response.get('data') for item in content: title = item.get('titles').get('default') if letter: if letter != '\d' and re.search( '(^[' + letter.lower() + letter.title() + '])', title) is None: continue elif letter == '\d' and re.search('(^' + letter + ')', title) is None: continue iconImage = getIcon(item) infoLabels = getInfoLabel(item, 'tvshow', channel_id) parameter = { 'action': 'getTVShow', 'tvshow_id': item.get('id'), 'iconImage': iconImage, 'infoLabels': infoLabels } if channel_id: parameter['channel_id'] = channel_id url = common.build_url(parameter) addDir(title, url, iconImage, iconImage, infoLabels) xbmcplugin.setContent(addon_handle, 'tvshows') # if response.get('totalCount') > ((page + 1) * videos_per_page): # page += 1 # # parameter = {'action': 'listTVShows', 'path': path, 'letter': letter if letter != '#' else '\d', 'page': page} # if channel_id: # parameter['channel_id'] = channel_id # # url = common.build_url(parameter) # addDir('Nächste Seite', url) xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
def showLiveChannels(): selection = '{totalCount,data{title,tvShow{title},season{number},episode{number},images(subType:"cover"){url,subType},tvChannelName,description,productionYear,startTime,endTime}}' url = '%s/epg/now?selection=%s' % ('https://middleware.p7s1.io/joyn/v1', selection) response = seventv.getUrl( url, key='1ec991118fe49ca44c185ee6a86354ef').get('response') content = response.get('data') addDir('Aktualisieren', 'xbmc.executebuiltin("container.refresh")', infoLabels={'plot': 'Aktualisieren'}) for channel in channels: infoLabels = {} thumbnailImage = None if channel.get('property_name', None): for channel_content in content: if channel_content.get('tvChannelName').lower() == channel.get( 'label').lower(): infoLabels = getInfoLabel(channel_content, 'live', channel.get('id')) thumbnailImage = getIcon(channel_content) url = common.build_url({ 'action': 'playLiveTV', 'property_name': channel.get('property_name'), 'client_location': channel.get('client_location'), 'access_token': channel.get('access_token'), 'client_token': channel.get('client_token'), 'callback': channel.get('callback'), 'infoLables': infoLabels }) title = infoLabels.get('title').capitalize() if infoLabels.get( 'tvshowtitle', None) is None or infoLabels.get( 'tvshowtitle') == infoLabels.get( 'title') else infoLabels.get('tvshowtitle').capitalize( ) + ': ' + infoLabels.get('title').capitalize() title = '[B] %s [/B] - %s' % (channel.get('label'), title) addFile(title, url, icon_path + channel.get('icon'), thumbnailImage, infoLabels) xbmcplugin.setContent(addon_handle, 'files') xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
def showLiveChannels(): selection = '{totalCount,data{title,tvShow{title},season{number},episode{number},images(subType:"cover"){url,subType},tvChannelName,description,productionYear,startTime,endTime}}' url = serviceUrl + '/epg/now?selection=' + selection response = seventv.getUrl(url).get('response') content = response.get('data') addDir('Aktualisieren', 'xbmc.executebuiltin("XBMC.Container.Refresh")', infoLabels={'plot': 'Aktualisieren'}) for channel in channels: infoLabels = {} thumbnailImage = None if channel.get('property_name', None) is not None: for channel_content in content: if channel_content.get('tvChannelName').lower() == channel.get( 'label').lower(): infoLabels = getInfoLabel(channel_content, 'live', channel.get('id')) thumbnailImage = getIcon(channel_content) url = common.build_url({ 'action': 'playLiveTV', 'property_name': channel.get('property_name'), 'client_location': channel.get('client_location'), 'access_token': channel.get('access_token'), 'client_token': channel.get('client_token'), 'callback': channel.get('callback'), 'infoLables': infoLabels }) title = infoLabels.get('title') if infoLabels.get( 'tvshowtitle', None ) is None or infoLabels.get('tvshowtitle') == infoLabels.get( 'title') else '[COLOR blue]' + infoLabels.get( 'tvshowtitle') + ' |[/COLOR] ' + infoLabels.get('title') title = '[COLOR orange][' + channel.get( 'label') + '][/COLOR] ' + str(title) addVideo(title, url, icon_path + channel.get('icon'), thumbnailImage, infoLabels) xbmcplugin.setContent(addon_handle, 'files') xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
def listVideos(path, channel_id=None, tvshow_id=None, video_type=None, page=0): selection = '{totalCount,data{id,type,titles{default},images(subType:"Teaser"){url,subType},shortDescriptions{default},links,duration, subType,productionYear,createdAt,tvShow{titles{default}},season{number},episode{number,titles{default},metaDescriptions{default},productionYear,createdAt,modifiedAt,airdates}}}' url = '%s%s?selection=%s&limit=%d&skip=%d&sortBy=%s&sortAscending=%s' % ( serviceUrl, path, selection, videos_per_page, page * videos_per_page, 'seasonsOrder' if tvshow_id else 'airdate', 'true' if tvshow_id else 'false') if channel_id: url += '&channelId=%s' % (channel_id) if tvshow_id: url += '&tvShowId=%s' % format(tvshow_id) if video_type == tvShowDirs[0]: url += '&subType=!Hauptfilm' elif video_type == tvShowDirs[1]: url += '&subType=Hauptfilm' response = seventv.getUrl(url).get('response') content = response.get('data') for item in content: if len(item.get('links')) == 0: continue iconImage = getIcon(item) infoLabels = getInfoLabel(item, 'video', channel_id) title = infoLabels[ 'title'] if tvshow_id else '[COLOR orange][%s][/COLOR] [COLOR blue]%s |[/COLOR] %s' % ( item.get('links')[0].get('brand'), item.get('tvShow', {}).get('titles', {}).get('default', ''), item.get('titles').get('default')) if tvshow_id and infoLabels.get('season', None) and infoLabels.get( 'episode', None): title = '%02dx%02d. %s' % (infoLabels.get('season'), infoLabels.get('episode'), infoLabels.get('title')) url = common.build_url({ 'action': 'playVideo', 'video_id': item.get('id'), 'video_url': item.get('links')[0].get('url'), 'infoLabels': infoLabels }) addFile(title, url, iconImage, iconImage, infoLabels) xbmcplugin.setContent(addon_handle, 'episode') if response.get('totalCount') > ((page + 1) * videos_per_page): page += 1 parameter = { 'action': 'listVideos', 'path': path, 'tvshow_id': tvshow_id, 'video_type': video_type, 'page': page } if channel_id: parameter['channel_id'] = channel_id if tvshow_id: parameter['tvshow_id'] = tvshow_id if video_type: parameter['video_type'] = video_type url = common.build_url(parameter) addDir('Nächste Seite', url) xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
def listVideos(path, channel_id=None, tvshow_id=None, video_type=None, page=0): selection = '{totalCount,data{id,type,titles{default},images(subType:"Teaser"){url,subType},shortDescriptions{default},links,duration, subType,productionYear,createdAt,tvShow{titles{default}},season{number},episode{number,titles{default},metaDescriptions{default},productionYear,createdAt,modifiedAt,airdates}}}' url = serviceUrl + path + '?selection=' + selection + '&limit=' + str( videos_per_page) + '&skip=' + str( page * videos_per_page) + '&sortBy=airdate&sortAscending=false' if channel_id is not None: url += '&channelId=' + channel_id if tvshow_id is not None: url += '&tvShowId=' + tvshow_id if video_type == tvShowDirs[0]: url += '&subType=!Hauptfilm' elif video_type == tvShowDirs[1]: url += '&subType=Hauptfilm' response = seventv.getUrl(url).get('response') content = response.get('data') for item in content: title = item.get('titles').get( 'default') if not tvshow_id == None else '[COLOR blue]' + item.get( 'tvShow', {}).get('titles', {}).get( 'default', '') + ' |[/COLOR] ' + item.get('titles').get('default') iconImage = getIcon(item) infoLabels = getInfoLabel(item, 'video', channel_id) url = common.build_url({ 'action': 'playVideo', 'video_id': item.get('id'), 'video_url': item.get('links')[0].get('url') if len(item.get('links')) > 0 else None, 'infoLabels': infoLabels }) addVideo(title, url, iconImage, iconImage, infoLabels) xbmcplugin.setContent(addon_handle, 'episode') if response.get('totalCount') > ((page + 1) * videos_per_page): page += 1 parameter = { 'action': 'listVideos', 'path': path, 'tvshow_id': tvshow_id, 'video_type': video_type, 'page': page } if channel_id is not None: parameter['channel_id'] = channel_id if tvshow_id is not None: parameter['tvshow_id'] = tvshow_id if video_type is not None: parameter['video_type'] = video_type url = common.build_url(parameter) addDir('Nächste Seite', url) xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)