コード例 #1
0
def show_vod_recent(type):

    streams = vaderClass.get_recent_vod(type)

    for stream in streams:
        utils.log(str(stream))
        chanName = stream['name']
        stream_id = stream['stream_id']
        icon = stream['stream_icon']
        container_extension = stream['container_extension']

        chanUrl = vaderClass.build_stream_url(stream_id,
                                              extension=container_extension,
                                              base='movie')

        title = chanName

        title = str(title.encode('utf-8').decode('ascii', 'ignore'))

        plugintools.add_playable(title=title,
                                 url=chanUrl,
                                 thumbnail=icon,
                                 plot='',
                                 isPlayable=True,
                                 folder=False)

    endOfDirectory(plugin.handle)
コード例 #2
0
def show_vod_movies(page):
    movies = vaderClass.getVapiMovies(int(page))
    for movie in movies['results']:
        title = movie['title']
        vodItem = movie['vodItemId']
        icon = movie['poster']
        plot = movie['desc']
        extension = movie['ext']
        category = movie['category']

        chanUrl = vaderClass.build_stream_url(vodItem,
                                              extension=extension,
                                              base='movie')

        title = str(title.encode('utf-8').decode('ascii', 'ignore'))
        if icon == None:
            icon = ''

        chanData = 'plugin://' + ADDONID + '/play/movie/{cat}/{id}/{ext}/{title}'.format(
            cat=category, title=title, id=vodItem, ext=extension)

        plugintools.add_playable(title=title,
                                 url=chanData,
                                 thumbnail=icon,
                                 plot='',
                                 isPlayable=True,
                                 folder=False)

    endOfDirectory(plugin.handle)
コード例 #3
0
def show_movies_year(year):
    try:
        if year == 'all':
            validYears = []
            streams = vaderClass.get_vod_by_pid('53')
            for stream in streams:
                name = stream['name']

                match = re.match(r'.*([1-3][0-9]{3})', name)
                if match is not None:
                    # Then it found a match!
                    validYears.append(int(match.group(1)))

            validYears.sort()
            validYears = list(set(validYears))
            validYears.reverse()

            for year in validYears:
                addDirectoryItem(
                    plugin.handle,
                    plugin.url_for(show_movies_year, year=str(year)),
                    ListItem(str(year)), True)

        else:
            streams = vaderClass.get_vod_by_pid('53')
            for stream in streams:
                name = stream['name']
                if str(year) in name:
                    stream_id = stream['stream_id']
                    icon = stream['stream_icon']
                    extension = stream['container_extension']

                    chanUrl = vaderClass.build_stream_url(stream_id,
                                                          extension=extension,
                                                          base='movie')

                    title = name

                    title = str(
                        title.encode('utf-8').decode('ascii', 'ignore'))

                    plugintools.add_playable(title=title,
                                             url=chanUrl,
                                             thumbnail=icon,
                                             plot='',
                                             isPlayable=True,
                                             folder=False)

        endOfDirectory(plugin.handle)

    except Exception as e:
        utils.log("Error listing streams \n{0}\n{1}".format(
            e, traceback.format_exc()))
        pass
コード例 #4
0
def show_vod_recent(type):

    streams = vaderClass.getVapiRecentVOD(type)
    if type == 'movie':
        for stream in streams:
            chanName = stream['title']
            stream_id = stream['vodItemId']
            category = stream['category']
            icon = stream['poster']
            if icon == None:
                icon = ''
            container_extension = stream['ext']
            chanUrl = vaderClass.build_stream_url(
                stream_id, extension=container_extension, base='movie')
            title = chanName
            title = str(title.encode('utf-8').decode('ascii', 'ignore'))
            if stream_id and chanName:
                chanData = 'plugin://' + ADDONID + '/play/movie/{cat}/{id}/{ext}/{title}'.format(
                    cat=category,
                    title=chanName,
                    id=stream_id,
                    ext=container_extension)

                plugintools.add_playable(title=title,
                                         url=chanData,
                                         thumbnail=icon,
                                         plot='',
                                         isPlayable=True,
                                         folder=False)

    if type == 'tv':
        for stream in streams:
            chanName = stream['showName']
            id = stream['id']
            icon = stream['poster']
            title = chanName
            title = str(title.encode('utf-8').decode('ascii', 'ignore'))
            addDirectoryItem(plugin.handle,
                             plugin.url_for(show_vod_tvshow_episodes, id=id),
                             ListItem(title), True)

    endOfDirectory(plugin.handle)
コード例 #5
0
def show_livetv_all():
    streams = vaderClass.get_all_streams()
    for streamObj in streams:
        chanName = streamObj['name']
        stream = streamObj['stream_id']
        icon = streamObj['stream_icon']
        category_id = streamObj['category_id']
        chanUrl = vaderClass.build_stream_url(stream)
        if category_id not in vaderClass.filter_category_list_id:
            if vaderClass.get_epg_chan(chanName):
                title = '[COLOR orange]' + chanName + '[/COLOR] - ' + '[I][COLOR cyan]' + vaderClass.get_epg_chan(
                    chanName) + '[/COLOR][/I]'
            else:
                title = chanName

            title = str(title.encode('utf-8').decode('ascii', 'ignore'))
            plugintools.add_playable(title=title,
                                     url=chanUrl,
                                     thumbnail=icon,
                                     plot='',
                                     isPlayable=True,
                                     folder=False)

    endOfDirectory(plugin.handle)
コード例 #6
0
def show_vod_tvshow_episodes(id):
    episodes = vaderClass.getVapiShowEpisodes(id)

    for episode in episodes:
        title = episode['title']
        name = episode['showName']
        episodeNum = episode['episode']
        seasonNum = episode['season']
        icon = episode['poster']
        plot = episode['desc']
        extension = episode['ext']
        vodItem = episode['vodItemId']
        category = episode['category']

        titlePrefix = 'Season: {season} Episode: {episode} - '.format(
            season=seasonNum, episode=episodeNum)
        title = titlePrefix + title
        chanUrl = vaderClass.build_stream_url(vodItem,
                                              extension=extension,
                                              base='movie')
        chanData = 'plugin://' + ADDONID + '/play/tv/{cat}/{id}/{ext}/{show}/{season}/{episode}'.format(
            show=name,
            season=seasonNum,
            episode=episodeNum,
            cat=category,
            id=vodItem,
            ext=extension)

        plugintools.add_playable(title=title,
                                 url=chanData,
                                 thumbnail=icon,
                                 plot='',
                                 isPlayable=True,
                                 folder=False)

    endOfDirectory(plugin.handle)
コード例 #7
0
def show_vod(category_id):
    try:

        if category_id == 'all':
            categories = vaderClass.get_vod_categories()
            for category in categories:
                parent_id = str(category['parent_id'])
                name = str(category['category_name'])
                cat_id = category['category_id']
                if parent_id == '0':

                    addDirectoryItem(
                        plugin.handle,
                        plugin.url_for(show_vod, category_id=str(cat_id)),
                        ListItem(name), True)

            addDirectoryItem(plugin.handle,
                             plugin.url_for(show_movies_year, year='all'),
                             ListItem('Movies - By Year'), True)

            addDirectoryItem(plugin.handle,
                             plugin.url_for(show_vod_recent, type='movies'),
                             ListItem('Recently Added - Movies'), True)
            addDirectoryItem(plugin.handle,
                             plugin.url_for(show_vod_recent, type='tvshows'),
                             ListItem('Recently Added - TV Shows'), True)

            addDirectoryItem(plugin.handle, plugin.url_for(show_web_vod_menu),
                             ListItem('Web Based VOD ~Beta~'), True)

            addDirectoryItem(
                plugin.handle, plugin.url_for(show_vod_recent, type='tvshows'),
                ListItem(
                    'Note: Surround Sound is included as the 2nd Audio Track, You can change Kodi default settings to auto select the best audio track instead of first'
                ), True)

        else:
            vod_categories = vaderClass.get_vod_categories(sort=True)
            uniqueShows = []

            for category in vod_categories:
                parent_id = category['parent_id']
                name = category['category_name']
                cat_id = category['category_id']

                if parent_id == category_id:
                    if parent_id == '55':
                        showName = re.split('S\d+', name)[0].strip()
                        if showName not in uniqueShows:
                            uniqueShows.append(showName)
                            search = showName + ' S'
                            addDirectoryItem(
                                plugin.handle,
                                plugin.url_for(show_vod_titlesearch,
                                               search=search),
                                ListItem(showName), True)
                    else:

                        addDirectoryItem(
                            plugin.handle,
                            plugin.url_for(show_vod, category_id=str(cat_id)),
                            ListItem(name), True)

            streams = vaderClass.get_category_id_vod(category_id, sort=True)
            for stream in streams:
                chanName = stream['name']
                stream_id = stream['stream_id']
                icon = stream['stream_icon']
                extension = stream['container_extension']

                chanUrl = vaderClass.build_stream_url(stream_id,
                                                      extension=extension,
                                                      base='movie')

                title = chanName

                title = str(title.encode('utf-8').decode('ascii', 'ignore'))
                utils.log(str(chanName))

                plugintools.add_playable(title=title,
                                         url=chanUrl,
                                         thumbnail=icon,
                                         plot='',
                                         isPlayable=True,
                                         folder=False)

        endOfDirectory(plugin.handle)

    except Exception as e:
        utils.log("Error listing streams \n{0}\n{1}".format(
            e, traceback.format_exc()))
        pass
コード例 #8
0
def show_livetv_cat(category_id):

    try:

        if category_id == 'all':
            categories = vaderClass.get_categories()
            for category in categories:
                category_id_list = str(categories[category])

                addDirectoryItem(
                    plugin.handle,
                    plugin.url_for(show_livetv_cat, category_id=category),
                    ListItem(category_id_list), True)
            endOfDirectory(plugin.handle)
        else:
            try:
                streams = vaderClass.get_category_id_live(category_id)
                for streamObj in streams:
                    chanName = streamObj['stream_display_name']

                    stream = streamObj['id']
                    icon = unidecode(streamObj['stream_icon'])
                    chanUrl = plugin.url_for(play_live, stream_id=stream)
                    programs = streamObj['programs']
                    timeNow = time.time()
                    timeNow = int(timeNow)
                    epg = ''

                    for program in programs:
                        startTime = dateutil.parser.parse(program['start'])
                        stopTime = dateutil.parser.parse(program['stop'])

                        startTimeLocal = UTCToLocal(startTime)
                        stopTimeLocal = UTCToLocal(stopTime)

                        startTime = int(time.mktime(
                            startTimeLocal.timetuple()))
                        stopTime = int(time.mktime(stopTimeLocal.timetuple()))

                        if stopTime >= timeNow and startTime < timeNow:
                            epg = program['title']
                            break

                    title = '[COLOR orange]' + unidecode(
                        chanName
                    ) + '[/COLOR] - ' + '[I][COLOR cyan]' + unidecode(
                        epg) + '[/COLOR][/I]'

                    title = str(
                        title.encode('utf-8').decode('ascii', 'ignore'))

                    plugintools.add_playable(title=title,
                                             url=chanUrl,
                                             thumbnail=icon,
                                             plot='',
                                             isPlayable=True,
                                             folder=False)

                endOfDirectory(plugin.handle)
            except Exception as e:
                utils.log("Error listing streams \n{0}\n{1}".format(
                    e, traceback.format_exc()))
                pass

    except Exception as e:
        utils.log("Error listing streams \n{0}\n{1}".format(
            e, traceback.format_exc()))
        pass