Ejemplo n.º 1
0
def rootDir():
    for dir in rootDirs:
        url = common.build_url({
            'action': dir.get('action'),
            'path': dir.get('path')
        })
        addDir(dir.get('label'), url)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
Ejemplo n.º 2
0
def list_series(series_id):
    series = skygo.getSeriesInfo(series_id)
    xbmcplugin.setContent(addon_handle, 'movies')

    for season in series['seasons']['season']:
        print season

        for episode in season['episodes']['episode']:
            url = common.build_url({
                'action': 'playVod',
                'vod_id': episode['id']
            })

            print episode['id']

            # Try to find images
            heroImg = ''
            videoWallImg = ''
            cover = ''

            for image in episode['main_picture']['picture']:
                if image['type'] == 'hero_img':
                    heroImg = skygo.baseUrl + image['path'] + '/' + image[
                        'file']
                if image['type'] == 'videowall_home':
                    videoWallImg = skygo.baseUrl + image['path'] + '/' + image[
                        'file']
                if image['type'] == 'gallery':
                    cover = skygo.baseUrl + image['path'] + '/' + image['file']

            if episode['dvd_cover']:
                cover = skygo.baseUrl + episode['dvd_cover'][
                    'path'] + '/' + episode['dvd_cover']['file']

            if 'season_nr' not in episode:
                episode['season_nr'] = '??'
            label = episode['serie_title'] + ' S' + str(
                episode['season_nr']) + 'E' + str(episode['episode_nr'])
            info = {
                'genre': episode['category']['main']['content'],
                'mpaa': episode['parental_rating']['value'],
                'title':
                episode['serie_title'] + ' E' + str(episode['episode_nr']),
                'mediatype': 'movie',
            }
            li = xbmcgui.ListItem(label=label)
            li.setArt({'thumb': cover, 'poster': cover, 'fanart': heroImg})

            li.setProperty('IsPlayable', 'true')

            li.setInfo('video', info)

            xbmcplugin.addDirectoryItem(handle=addon_handle,
                                        url=url,
                                        listitem=li)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
Ejemplo n.º 3
0
def showChannels():
    for channel in channels:
        parameter = {'action': 'listLetters'}
        if channel.get('id', None):
            parameter['channel_id'] = channel.get('id')

        url = common.build_url(parameter)
        addDir(channel.get('label'), url, icon_path + channel.get('icon'))

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
def listLetters(channel_id):
    for letter in letters:
        parameter = {
            'action': 'listTVShows',
            'path': '/tvshows',
            'letter': letter if letter != '#' else '\d',
            'page': 0
        }
        if channel_id:
            parameter['channel_id'] = channel_id

        url = common.build_url(parameter)
        addDir(letter.title(), url)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
Ejemplo n.º 7
0
def list_series(series_id):
    series = skygo.getSeriesInfo(series_id)
    xbmcplugin.setContent(addon_handle, 'movies')

    for season in series['seasons']['season']:
        print season

        for episode in season['episodes']['episode']:
            url = common.build_url({'action': 'playVod', 'vod_id': episode['id']})

            print episode['id']

            # Try to find images
            heroImg = ''
            videoWallImg = ''
            cover = ''

            for image in episode['main_picture']['picture']:
                if image['type'] == 'hero_img':
                    heroImg = skygo.baseUrl + image['path'] + '/' + image['file']
                if image['type'] == 'videowall_home':
                    videoWallImg = skygo.baseUrl + image['path'] + '/' + image['file']
                if image['type'] == 'gallery':
                    cover = skygo.baseUrl + image['path'] + '/' + image['file']

            if episode['dvd_cover']:
                cover = skygo.baseUrl + episode['dvd_cover']['path'] + '/' + episode['dvd_cover']['file']

            if 'season_nr' not in episode:
                episode['season_nr'] = '??'
            label = episode['serie_title'] + ' S'+str(episode['season_nr'])+'E'+str(episode['episode_nr'])
            info = {
                'genre': episode['category']['main']['content'],
                'mpaa': episode['parental_rating']['value'],
                'title': episode['serie_title'] + ' E'+str(episode['episode_nr']),
                'mediatype': 'movie',
            }
            li = xbmcgui.ListItem(label=label)
            li.setArt({'thumb': cover, 'poster': cover, 'fanart': heroImg})

            li.setProperty('IsPlayable', 'true')

            li.setInfo('video', info)

            xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                        listitem=li)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
Ejemplo n.º 8
0
def generate_channel_list():
    channels = skygo.getChannels()
    xbmcplugin.setContent(addon_handle, 'videos')
    for channel in channels:
        url = common.build_url({'action': 'playLiveTvChannel', 'epg_channel_id': channel['id'], 'mediaUrl': channel['mediaurl']})
        li = xbmcgui.ListItem(label=channel['name'])
        li.setProperty('IsPlayable', 'true')
        li.setArt({'thumb': skygo.baseUrl+channel['logo']})
        info = {
            'mediatype': 'video'
        }
        li.setInfo('video', info)
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                    listitem=li, isFolder=False)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
Ejemplo n.º 9
0
def getTVShow(channel_id, tvshow_id, iconImage, infoLabels):
    for tvShowDir in tvShowDirs:
        parameter = {
            'action': 'listVideos',
            'path': '/videos',
            'tvshow_id': tvshow_id,
            'video_type': tvShowDir,
            'page': 0
        }
        if channel_id:
            parameter['channel_id'] = channel_id

        url = common.build_url(parameter)

        addDir(tvShowDir, url, iconImage, iconImage, infoLabels)
        xbmcplugin.setContent(addon_handle, 'tvshows')

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
Ejemplo n.º 10
0
def generateLPageDir(url):
    skygo = SkyGo()
    page = skygo.getPage(url)

    keys = ['box_listing', 'listing']

    for key in keys:
        if key in page:
            for item in page[key]['item']:
                url = common.build_url({'action': 'listing', 'path': item['path']})

                # Skip Sport stuff for now
                if item['title'] == 'Sport':
                    continue

                li = xbmcgui.ListItem(item['title'])
                xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                            listitem=li, isFolder=True)
Ejemplo n.º 11
0
def generate_channel_list():
    channels = skygo.getChannels()
    xbmcplugin.setContent(addon_handle, 'videos')
    for channel in channels:
        url = common.build_url({
            'action': 'playLiveTvChannel',
            'epg_channel_id': channel['id'],
            'mediaUrl': channel['mediaurl']
        })
        li = xbmcgui.ListItem(label=channel['name'])
        li.setProperty('IsPlayable', 'true')
        li.setArt({'thumb': skygo.baseUrl + channel['logo']})
        info = {'mediatype': 'video'}
        li.setInfo('video', info)
        xbmcplugin.addDirectoryItem(handle=addon_handle,
                                    url=url,
                                    listitem=li,
                                    isFolder=False)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
Ejemplo n.º 12
0
def generateLPageDir(url):
    skygo = SkyGo()
    page = skygo.getPage(url)

    keys = ['box_listing', 'listing']

    for key in keys:
        if key in page:
            for item in page[key]['item']:
                url = common.build_url({
                    'action': 'listing',
                    'path': item['path']
                })

                # Skip Sport stuff for now
                if item['title'] == 'Sport':
                    continue

                li = xbmcgui.ListItem(item['title'])
                xbmcplugin.addDirectoryItem(handle=addon_handle,
                                            url=url,
                                            listitem=li,
                                            isFolder=True)
Ejemplo n.º 13
0
def list_dir(path):
    assets = skygo.getListing(path)
    xbmcplugin.setContent(addon_handle, 'movies')

    for asset in assets:
        url = common.build_url({'action': 'playVod', 'vod_id': asset['id']})

        # Try to find a hero img
        heroImg = ''
        videoWallImg = ''
        cover = ''

        for image in asset['main_picture']['picture']:
            if image['type'] == 'hero_img':
                heroImg = skygo.baseUrl + image['path'] + '/' + image['file']
            if image['type'] == 'videowall_home':
                videoWallImg = skygo.baseUrl + image['path'] + '/' + image[
                    'file']
            if image['type'] == 'gallery':
                cover = skygo.baseUrl + image['path'] + '/' + image['file']

        if asset['dvd_cover']:
            cover = skygo.baseUrl + asset['dvd_cover']['path'] + '/' + asset[
                'dvd_cover']['file']

        info = {}
        label = 'label'
        if asset['type'] == 'Episode':
            if 'season_nr' not in asset:
                asset['season_nr'] = '??'
            label = asset['serie_title'] + ' S' + str(
                asset['season_nr']) + 'E' + str(asset['episode_nr'])
            info = {
                'genre': asset['category']['main']['content'],
                'year': asset['year_of_production'],
                'mpaa': asset['parental_rating']['value'],
                'title':
                asset['serie_title'] + ' E' + str(asset['episode_nr']),
                'mediatype': 'video',
                'originaltitle': asset['original_title'],
                'plot': asset['synopsis'],
                'episode': asset['episode_nr'],
                'season': asset['season_nr']
            }

        elif asset['type'] == 'Movie' or asset['type'] == 'Film':
            info = {
                'genre': asset['category']['main']['content'],
                'year': asset['year_of_production'],
                'mpaa': asset['parental_rating']['value'],
                'title': asset['title'],
                'mediatype': 'movie',
                'originaltitle': asset['original_title'],
                'plot': asset['synopsis'],
            }
            label = asset['title']

        elif asset['type'] == 'Series':
            url = common.build_url({
                'action': 'listSeries',
                'series_id': asset['id']
            })

            info = {
                'genre': asset['category']['main']['content'],
                'title': asset['title'],
                'mediatype': 'movie',
                'originaltitle': asset['original_title'],
                #'plot': asset['synopsis'],
            }
            if 'synopsis' in asset:
                info['plot'] = asset['synopsis']

            label = asset['title']

        li = xbmcgui.ListItem(label=label)
        li.setArt({'thumb': cover, 'poster': cover, 'fanart': heroImg})

        is_dir = False
        if asset['type'] == 'Series':
            is_dir = True
            li.setProperty('IsPlayable', 'false')
        else:
            li.setProperty('IsPlayable', 'true')

        li.setInfo('video', info)

        xbmcplugin.addDirectoryItem(handle=addon_handle,
                                    url=url,
                                    listitem=li,
                                    isFolder=is_dir)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)
Ejemplo n.º 14
0
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)
Ejemplo n.º 15
0
def list_dir(path):
    assets = skygo.getListing(path)
    xbmcplugin.setContent(addon_handle, 'movies')

    for asset in assets:
        url = common.build_url({'action': 'playVod', 'vod_id': asset['id']})

        # Try to find a hero img
        heroImg = ''
        videoWallImg = ''
        cover = ''

        for image in asset['main_picture']['picture']:
            if image['type'] == 'hero_img':
                heroImg = skygo.baseUrl + image['path'] + '/' + image['file']
            if image['type'] == 'videowall_home':
                videoWallImg = skygo.baseUrl + image['path'] + '/' + image['file']
            if image['type'] == 'gallery':
                cover = skygo.baseUrl + image['path'] + '/' + image['file']

        if asset['dvd_cover']:
            cover = skygo.baseUrl + asset['dvd_cover']['path'] + '/' + asset['dvd_cover']['file']

        info = {}
        label = 'label'
        if asset['type'] == 'Episode':
            if 'season_nr' not in asset:
                asset['season_nr'] = '??'
            label = asset['serie_title'] + ' S'+str(asset['season_nr'])+'E'+str(asset['episode_nr'])
            info = {
                'genre': asset['category']['main']['content'],
                'year': asset['year_of_production'],
                'mpaa': asset['parental_rating']['value'],
                'title': asset['serie_title'] + ' E'+str(asset['episode_nr']),
                'mediatype': 'video',
                'originaltitle': asset['original_title'],
                'plot': asset['synopsis'],
                'episode': asset['episode_nr'],
                'season': asset['season_nr']
            }

        elif asset['type'] == 'Movie' or asset['type'] == 'Film':
            info = {
                'genre': asset['category']['main']['content'],
                'year': asset['year_of_production'],
                'mpaa': asset['parental_rating']['value'],
                'title': asset['title'],
                'mediatype': 'movie',
                'originaltitle': asset['original_title'],
                'plot': asset['synopsis'],
            }
            label = asset['title']

        elif asset['type'] == 'Series':
            url = common.build_url({'action': 'listSeries', 'series_id': asset['id']})

            info = {
                'genre': asset['category']['main']['content'],
                'title': asset['title'],
                'mediatype': 'movie',
                'originaltitle': asset['original_title'],
                #'plot': asset['synopsis'],
            }
            if 'synopsis' in asset:
                info['plot'] = asset['synopsis']

            label = asset['title']

        li = xbmcgui.ListItem(label=label)
        li.setArt({'thumb': cover, 'poster': cover, 'fanart': heroImg})

        is_dir = False
        if asset['type'] == 'Series':
            is_dir = True
            li.setProperty('IsPlayable', 'false')
        else:
            li.setProperty('IsPlayable', 'true')

        li.setInfo('video', info)

        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                    listitem=li, isFolder=is_dir)

    xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=False)