Exemple #1
0
def replaytv_alphabetical(**kwargs):
    folder = plugin.Folder(title=_.PROGSAZ)
    label = _.OTHERTITLES

    folder.add_item(
        label=label,
        info={'plot': _.OTHERTITLESDESC},
        path=plugin.url_for(func_or_url=replaytv_list,
                            label=label,
                            start=0,
                            character='other'),
    )

    for character in string.ascii_uppercase:
        label = _.TITLESWITH + character

        folder.add_item(
            label=label,
            info={'plot': _.TITLESWITHDESC + character},
            path=plugin.url_for(func_or_url=replaytv_list,
                                label=label,
                                start=0,
                                character=character),
        )

    return folder
Exemple #2
0
def home(**kwargs):
    profile_settings = load_profile(profile_id=1)

    if profile_settings['first_boot'] == 1:
        first_boot()

    folder = plugin.Folder()

    if len(profile_settings['pswd']) > 0 and len(
            profile_settings['devicekey']) > 0:
        folder.add_item(label=_(_.LIVE_TV, _bold=True),
                        path=plugin.url_for(func_or_url=live_tv))
        folder.add_item(label=_(_.CHANNELS, _bold=True),
                        path=plugin.url_for(func_or_url=replaytv))

        #if settings.getBool('showMoviesSeries'):
        #    folder.add_item(label=_(_.SERIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='series', label=_.SERIES, start=0))
        #    folder.add_item(label=_(_.MOVIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='movies', label=_.MOVIES, start=0))
        #    folder.add_item(label=_(_.KIDS_SERIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='kidsseries', label=_.KIDS_SERIES, start=0))
        #    folder.add_item(label=_(_.KIDS_MOVIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='kidsmovies', label=_.KIDS_MOVIES, start=0))

        folder.add_item(label=_(_.SEARCH, _bold=True),
                        path=plugin.url_for(func_or_url=search_menu))

    folder.add_item(label=_(_.LOGIN, _bold=True),
                    path=plugin.url_for(func_or_url=login))
    folder.add_item(label=_.SETTINGS,
                    path=plugin.url_for(func_or_url=settings_menu))

    return folder
def search_menu(**kwargs):
    folder = plugin.Folder(title=_.SEARCHMENU)
    label = _.NEWSEARCH

    folder.add_item(
        label = label,
        info = {'plot': _.NEWSEARCHDESC},
        path = plugin.url_for(func_or_url=search),
    )

    folder.add_item(
        label= label + " (Online)",
        path=plugin.url_for(func_or_url=online_search)
    )

    for x in range(1, 10):
        searchstr = settings.get(key='_search' + unicode(x))

        if searchstr != '':
            type = settings.get(key='_search_type' + unicode(x))
            label = searchstr + type

            if type == " (Online)":
                path = plugin.url_for(func_or_url=online_search, query=searchstr)
            else:
                path = plugin.url_for(func_or_url=search, query=searchstr)

            folder.add_item(
                label = label,
                info = {'plot': _(_.SEARCH_FOR, query=searchstr)},
                path = path,
            )

    return folder
Exemple #4
0
def settings_menu(**kwargs):
    folder = plugin.Folder(title=_.SETTINGS)

    folder.add_item(label=_.CHANNEL_PICKER,
                    path=plugin.url_for(func_or_url=channel_picker_menu))
    folder.add_item(label=_.SET_IPTV,
                    path=plugin.url_for(func_or_url=plugin._set_settings_iptv))
    folder.add_item(label=_.SET_KODI,
                    path=plugin.url_for(func_or_url=plugin._set_settings_kodi))
    folder.add_item(label=_.DOWNLOAD_SETTINGS,
                    path=plugin.url_for(func_or_url=plugin._download_settings))
    folder.add_item(label=_.DOWNLOAD_EPG,
                    path=plugin.url_for(func_or_url=plugin._download_epg))
    folder.add_item(label=_.INSTALL_WV_DRM,
                    path=plugin.url_for(func_or_url=plugin._ia_install))
    folder.add_item(label=_.RESET_SESSION,
                    path=plugin.url_for(func_or_url=login, ask=0))
    folder.add_item(label=_.RESET,
                    path=plugin.url_for(func_or_url=reset_addon))
    folder.add_item(label=_.LOGOUT, path=plugin.url_for(func_or_url=logout))

    folder.add_item(label="Addon " + _.SETTINGS,
                    path=plugin.url_for(func_or_url=plugin._settings))

    return folder
def search_menu(**kwargs):
    folder = plugin.Folder(title=_.SEARCHMENU)
    label = _.NEWSEARCH

    folder.add_item(
        label = label,
        info = {'plot': _.NEWSEARCHDESC},
        path = plugin.url_for(func_or_url=search),
    )

    profile_settings = load_profile(profile_id=1)

    for x in range(1, 10):
        searchstr = profile_settings['search' + unicode(x)]

        if searchstr != '':
            label = searchstr

            folder.add_item(
                label = label,
                info = {'plot': _(_.SEARCH_FOR, query=searchstr)},
                path = plugin.url_for(func_or_url=search, query=searchstr),
            )

    return folder
def channel_picker_menu(**kwargs):
    folder = plugin.Folder(title=_.CHANNEL_PICKER)

    folder.add_item(label=_.LIVE_TV, path=plugin.url_for(func_or_url=channel_picker, type='live'))
    folder.add_item(label=_.CHANNELS, path=plugin.url_for(func_or_url=channel_picker, type='replay'))
    folder.add_item(label=_.SIMPLEIPTV, path=plugin.url_for(func_or_url=channel_picker, type='epg'))

    return folder
Exemple #7
0
def settings_menu(**kwargs):
    folder = plugin.Folder(title=_.SETTINGS)

    folder.add_item(label=_.INSTALL_WV_DRM,
                    path=plugin.url_for(func_or_url=plugin._ia_install))
    folder.add_item(label=_.SET_IPTV,
                    path=plugin.url_for(func_or_url=plugin._set_settings_iptv))
    folder.add_item(label=_.SET_KODI,
                    path=plugin.url_for(func_or_url=plugin._set_settings_kodi))
    folder.add_item(label=_.DOWNLOAD_SETTINGS,
                    path=plugin.url_for(func_or_url=plugin._download_settings))
    folder.add_item(label=_.DOWNLOAD_EPG,
                    path=plugin.url_for(func_or_url=plugin._download_epg))
    folder.add_item(label=_.RESET_SESSION,
                    path=plugin.url_for(func_or_url=logout, delete=False))
    folder.add_item(label=_.RESET,
                    path=plugin.url_for(func_or_url=plugin._reset))

    if plugin.logged_in:
        folder.add_item(label=_.LOGOUT,
                        path=plugin.url_for(func_or_url=logout))

    folder.add_item(label="Addon " + _.SETTINGS,
                    path=plugin.url_for(func_or_url=plugin._settings))

    return folder
Exemple #8
0
def get_live_channels(addon=False):
    global backend, query_channel
    channels = []
    rows = load_file(file='channels.json', isJSON=True)

    if rows:
        if addon == True:
            query_addons = json.loads(
                xbmc.executeJSONRPC(
                    '{"jsonrpc": "2.0", "id": 1, "method": "Addons.GetAddons", "params": {"type": "xbmc.pvrclient"}}'
                ))
            addons = query_addons['result']['addons']
            backend = addons[0]['addonid']

            query_channel = json.loads(
                xbmc.executeJSONRPC(
                    '{"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid": "alltv", "properties" :["uniqueid"]},"id": 1}'
                ))

        for row in rows:
            channeldata = api.get_channel_data(rows=rows, row=row)

            path = plugin.url_for(func_or_url=play_video,
                                  type='channel',
                                  channel=channeldata['channel_id'],
                                  id=None,
                                  _is_live=True)
            playable = True

            if addon == True and 'result' in query_channel:
                if 'channels' in query_channel['result']:
                    pvrchannels = query_channel['result']['channels']

                    for channel in pvrchannels:
                        if channel['label'] == channeldata['label']:
                            channel_uid = channel['uniqueid']
                            path = plugin.url_for(func_or_url=switchChannel,
                                                  channel_uid=channel_uid)
                            playable = False
                            break

            channels.append({
                'label': channeldata['label'],
                'channel': channeldata['channel_id'],
                'chno': channeldata['channel_number'],
                'description': channeldata['description'],
                'image': channeldata['station_image_large'],
                'path': path,
                'playable': playable,
            })

        channels[:] = sorted(channels, key=_sort_live)

    return channels
def vod_season(label, id, **kwargs):
    folder = plugin.Folder(title=label)

    items = []

    season = api.vod_season(id)

    for episode in season:
        items.append(
            plugin.Item(
                label=episode['episodeNumber'] + " - " + episode['title'],
                info={
                    'plot': episode['desc'],
                    'duration': episode['duration'],
                    'mediatype': 'video',
                },
                art={
                    'thumb':
                    "{image_url}/vod/{image}/{img_size}.jpg?blurred=false".
                    format(image_url=CONST_IMAGE_URL,
                           image=episode['image'],
                           img_size=settings.get(key='_img_size'))
                },
                path=plugin.url_for(func_or_url=play_video,
                                    type='vod',
                                    id=episode['id'],
                                    asset_id=episode['assetid'],
                                    duration=episode['duration'],
                                    _is_live=False),
                playable=True,
            ))

    folder.add_items(items)

    return folder
def vod_series(label, description, image, id, **kwargs):
    folder = plugin.Folder(title=label)

    items = []

    seasons = api.vod_seasons(id)

    title = label

    for season in seasons:
        label = _.SEASON + " " + unicode(season['seriesNumber'])

        items.append(plugin.Item(
            label = label,
            info = {'plot': season['desc']},
            art = {
                'thumb': season['image'],
                'fanart': season['image']
            },
            path = plugin.url_for(func_or_url=vod_season, label=label, title=title, id=season['id']),
        ))

    folder.add_items(items)

    return folder
Exemple #11
0
def replaytv_content(label, day, station='', start=0, **kwargs):
    day = int(day)
    start = int(start)
    folder = plugin.Folder(title=label)

    data = load_file(file=station + "_replay.json", isJSON=True)

    if not data:
        gui.ok(_.DISABLE_ONLY_STANDARD, _.NO_REPLAY_TV_INFO)
        return folder

    totalrows = len(data)
    processed = process_replaytv_content(data=data, day=day, start=start)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed, 'count') and totalrows > processed['count']:
        folder.add_item(
            label=_(_.NEXT_PAGE, _bold=True),
            path=plugin.url_for(func_or_url=replaytv_content,
                                label=label,
                                day=day,
                                station=station,
                                start=processed['count']),
        )

    return folder
Exemple #12
0
def replaytv_item(ids=None, label=None, start=0, **kwargs):
    start = int(start)
    first = label[0]

    folder = plugin.Folder(title=label)

    if first.isalpha():
        data = load_file(file=first + "_replay.json", isJSON=True)
    else:
        data = load_file(file='other_replay.json', isJSON=True)

    if not data:
        return folder

    processed = process_replaytv_list_content(data=data, ids=ids, start=start)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed, 'totalrows') and check_key(
            processed,
            'count') and processed['totalrows'] > processed['count']:
        folder.add_item(
            label=_(_.NEXT_PAGE, _bold=True),
            path=plugin.url_for(func_or_url=replaytv_item,
                                ids=ids,
                                label=label,
                                start=processed['count']),
        )

    return folder
Exemple #13
0
def replaytv_list(character, label='', start=0, **kwargs):
    start = int(start)
    folder = plugin.Folder(title=label)

    data = load_file(file='list_replay.json', isJSON=True)

    if not data:
        gui.ok(message=_.NO_REPLAY_TV_INFO, heading=_.NO_REPLAY_TV_INFO)
        return folder

    if not check_key(data, character):
        return folder

    processed = process_replaytv_list(data=data[character], start=start)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed,
                 'count') and len(data[character]) > processed['count']:
        folder.add_item(
            label=_(_.NEXT_PAGE, _bold=True),
            path=plugin.url_for(func_or_url=replaytv_list,
                                character=character,
                                label=label,
                                start=processed['count']),
        )

    return folder
def process_replaytv_list(data, start=0):
    start = int(start)
    items = []
    count = 0
    item_count = 0
    time_now = int((datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds())

    for row in sorted(data):
        currow = data[row]

        if item_count == 51:
            break

        if count < start:
            count += 1
            continue

        count += 1

        if not check_key(currow, 'orig') or not check_key(currow, 'ids'):
            continue

        if check_key(currow, 'a') and check_key(currow, 'e') and (time_now < int(currow['a']) or time_now > int(currow['e'])):
            continue

        label = currow['orig']

        items.append(plugin.Item(
            label = label,
            path = plugin.url_for(func_or_url=replaytv_item, ids=json.dumps(currow['ids']), label=label, start=0),
        ))

        item_count += 1

    return {'items': items, 'count': count}
Exemple #15
0
def vod_season(label, title, id, **kwargs):
    folder = plugin.Folder(title=label)

    items = []

    season = api.vod_season(id)

    for episode in season:
        items.append(
            plugin.Item(
                label=episode['episodeNumber'] + " - " + episode['title'],
                info={
                    'plot': episode['desc'],
                    'duration': episode['duration'],
                    'mediatype': 'video',
                },
                art={
                    'thumb':
                    "{image_url}/vod/{image}/1920x1080.jpg?blurred=false".
                    format(image_url=CONST_IMAGE_URL, image=episode['image']),
                    'fanart':
                    "{image_url}/vod/{image}/1920x1080.jpg?blurred=false".
                    format(image_url=CONST_IMAGE_URL, image=episode['image'])
                },
                path=plugin.url_for(func_or_url=play_video,
                                    type='vod',
                                    channel=None,
                                    id=episode['id'],
                                    title=title),
                playable=True,
            ))

    folder.add_items(items)

    return folder
Exemple #16
0
def get_replay_channels():
    channels = []
    rows = load_file(file='channels.json', isJSON=True)

    if rows:
        for row in rows:
            channeldata = api.get_channel_data(rows=rows, row=row)

            channels.append({
                'label':
                channeldata['label'],
                'channel':
                channeldata['channel_id'],
                'chno':
                channeldata['channel_number'],
                'description':
                channeldata['description'],
                'image':
                channeldata['station_image_large'],
                'path':
                plugin.url_for(func_or_url=replaytv_by_day,
                               image=channeldata['station_image_large'],
                               description=channeldata['description'],
                               label=channeldata['label'],
                               station=channeldata['channel_id']),
                'playable':
                False,
            })

        channels[:] = sorted(channels, key=_sort_live)

    return channels
def vod_season(label, title, id, **kwargs):
    folder = plugin.Folder(title=label)

    items = []

    season = api.vod_season(id)

    for episode in season:
        items.append(plugin.Item(
            label = episode['episodeNumber'] + " - " + episode['title'],
            info = {
                'plot': episode['desc'],
                'duration': episode['duration'],
                'mediatype': 'video',
            },
            art = {
                'thumb': episode['image'],
                'fanart': episode['image']
            },
            path = plugin.url_for(func_or_url=play_video, type='vod', channel=episode['media_id'], id=episode['id'], title=title),
            playable = True,
        ))

    folder.add_items(items)

    return folder
Exemple #18
0
def vod_series(label, description, image, id, **kwargs):
    folder = plugin.Folder(title=label)

    items = []

    seasons = api.vod_seasons(id)

    title = label

    for season in seasons:
        label = _.SEASON + " " + unicode(season['seriesNumber'])

        items.append(
            plugin.Item(
                label=label,
                info={'plot': season['desc']},
                art={
                    'thumb':
                    "{image_url}/vod/{image}/1920x1080.jpg?blurred=false".
                    format(image_url=CONST_IMAGE_URL, image=season['image']),
                    'fanart':
                    "{image_url}/vod/{image}/1920x1080.jpg?blurred=false".
                    format(image_url=CONST_IMAGE_URL, image=season['image'])
                },
                path=plugin.url_for(func_or_url=vod_season,
                                    label=label,
                                    title=title,
                                    id=season['id']),
            ))

    folder.add_items(items)

    return folder
def replaytv_by_day(label='', image='', description='', station='', **kwargs):
    folder = plugin.Folder(title=label)

    for x in range(0, 7):
        curdate = datetime.date.today() - datetime.timedelta(days=x)

        itemlabel = ''

        if x == 0:
            itemlabel = _.TODAY + " - "
        elif x == 1:
            itemlabel = _.YESTERDAY + " - "

        if xbmc.getLanguage(xbmc.ISO_639_1) == 'nl':
            itemlabel += date_to_nl_dag(curdate=curdate) + curdate.strftime(" %d ") + date_to_nl_maand(curdate=curdate) + curdate.strftime(" %Y")
        else:
            itemlabel += curdate.strftime("%A %d %B %Y").capitalize()

        folder.add_item(
            label = itemlabel,
            info = {'plot': description},
            art = {'thumb': image},
            path = plugin.url_for(func_or_url=replaytv_content, label=itemlabel, day=x, station=station),
        )

    return folder
def process_vod_season(data, mediagroupid=None):
    items = []

    if sys.version_info >= (3, 0):
        data['mediaItems'] = list(data['mediaItems'])

    for row in data['mediaItems']:
        context = []
        label = ''
        description = ''
        program_image_large = ''
        duration = 0

        if not check_key(row, 'title') or not check_key(row, 'id'):
            continue

        if check_key(row, 'description'):
            description = row['description']

        if check_key(row, 'earliestBroadcastStartTime'):
            startsplit = int(row['earliestBroadcastStartTime']) // 1000

            startT = datetime.datetime.fromtimestamp(startsplit)
            startT = convert_datetime_timezone(startT, "UTC", "UTC")

            if xbmc.getLanguage(xbmc.ISO_639_1) == 'nl':
                label = date_to_nl_dag(startT) + startT.strftime(" %d ") + date_to_nl_maand(startT) + startT.strftime(" %Y %H:%M ") + row['title']
            else:
                label = (startT.strftime("%A %d %B %Y %H:%M ") + row['title']).capitalize()
        else:
            label = row['title']

        if check_key(row, 'duration'):
            duration = int(row['duration'])

        if check_key(row, 'images'):
            program_image_large = get_image("boxart", row['images'])

        if check_key(row, 'videoStreams'):
            urldata = get_play_url(content=row['videoStreams'])

            if urldata and check_key(urldata, 'play_url') and check_key(urldata, 'locator'):
                if mediagroupid:
                    context.append((_.ADD_TO_WATCHLIST, 'RunPlugin({context_url})'.format(context_url=plugin.url_for(func_or_url=add_to_watchlist, id=mediagroupid, type='group')), ))

                items.append(plugin.Item(
                    label = label,
                    info = {
                        'plot': description,
                        'duration': duration,
                        'mediatype': 'video',
                    },
                    art = {'thumb': program_image_large},
                    path = plugin.url_for(func_or_url=play_video, type='vod', id=row['id'], duration=duration, _is_live=False),
                    playable = True,
                    context = context
                ))

    return items
Exemple #21
0
def process_replaytv_search(data, start=0, search=None):
    start = int(start)
    items = []
    count = 0
    item_count = 0
    time_now = int((datetime.datetime.utcnow() -
                    datetime.datetime(1970, 1, 1)).total_seconds())

    for row in data:
        letter_row = data[row]

        for row2 in letter_row:
            currow = data[row][row2]

            if item_count == 51:
                break

            if count < start:
                count += 1
                continue

            count += 1

            if not check_key(currow, 'orig') or not check_key(currow, 'ids'):
                continue

            if check_key(currow, 'a') and check_key(
                    currow, 'e') and (time_now < int(currow['a'])
                                      or time_now > int(currow['e'])):
                continue

            label = currow['orig'] + ' (ReplayTV)'

            fuzz_set = fuzz.token_set_ratio(label, search)
            fuzz_partial = fuzz.partial_ratio(label, search)
            fuzz_sort = fuzz.token_sort_ratio(label, search)

            if (fuzz_set + fuzz_partial + fuzz_sort) > 160:
                items.append(
                    plugin.Item(
                        label=label,
                        properties={
                            "fuzz_set": fuzz_set,
                            "fuzz_sort": fuzz_sort,
                            "fuzz_partial": fuzz_partial,
                            "fuzz_total": fuzz_set + fuzz_partial + fuzz_sort
                        },
                        path=plugin.url_for(func_or_url=replaytv_item,
                                            ids=json.dumps(currow['ids']),
                                            label=label,
                                            start=0),
                    ))

                item_count += 1

    return {'items': items, 'count': count}
Exemple #22
0
def home(**kwargs):
    if settings.getBool(key='_first_boot') == True:
        first_boot()

    folder = plugin.Folder()

    if not plugin.logged_in:
        folder.add_item(label=_(_.LOGIN, _bold=True),
                        path=plugin.url_for(func_or_url=login))
    else:
        folder.add_item(label=_(_.LIVE_TV, _bold=True),
                        path=plugin.url_for(func_or_url=live_tv))
        folder.add_item(label=_(_.CHANNELS, _bold=True),
                        path=plugin.url_for(func_or_url=replaytv))
        folder.add_item(label=_(_.SEARCH, _bold=True),
                        path=plugin.url_for(func_or_url=search_menu))

    folder.add_item(label=_.SETTINGS,
                    path=plugin.url_for(func_or_url=settings_menu))

    return folder
Exemple #23
0
def get_replay_channels(all=False):
    channels = []

    query = "SELECT * FROM `channels`"
    data = query_epg(query=query,
                     return_result=True,
                     return_insert=False,
                     commit=False)

    prefs = load_prefs(profile_id=1)

    if data:
        for row in data:
            if '18+' in row['name']:
                continue

            id = unicode(row['id'])

            if all or not prefs or not check_key(
                    prefs, id) or prefs[id]['replay'] == 1:
                image_path = ADDON_PROFILE + "images" + os.sep + unicode(
                    row['id']) + ".png"

                if os.path.isfile(image_path):
                    image = image_path
                else:
                    image = row['icon']

                channels.append({
                    'label':
                    row['name'],
                    'channel':
                    row['id'],
                    'chno':
                    row['channelno'],
                    'description':
                    row['description'],
                    'image':
                    image,
                    'path':
                    plugin.url_for(func_or_url=replaytv_by_day,
                                   image=row['icon'],
                                   description=row['description'],
                                   label=row['name'],
                                   station=row['id']),
                    'playable':
                    False,
                    'context': [],
                })

        channels[:] = sorted(channels, key=_sort_live)

    return channels
def channel_picker(type, **kwargs):
    if type=='live':
        title = _.LIVE_TV
        rows = get_live_channels(addon=False, all=True)
    elif type=='replay':
        title = _.CHANNELS
        rows = get_replay_channels(all=True)
    else:
        title = _.SIMPLEIPTV
        rows = get_live_channels(addon=False, all=True)

    folder = plugin.Folder(title=title)
    prefs = load_prefs(profile_id=1)
    results = load_tests(profile_id=1)
    type = unicode(type)

    for row in rows:
        id = unicode(row['channel'])

        if not prefs or not check_key(prefs, id) or prefs[id][type] == 1:
            color = 'green'
        else:
            color = 'red'

        label = _(row['label'], _bold=True, _color=color)

        if results and check_key(results, id):
            if results[id][type] == 1:
                label += _(' (' + _.TEST_SUCCESS + ')', _bold=False, _color='green')
            else:
                label += _(' (' + _.TEST_FAILED + ')', _bold=False, _color='red')
        else:
            label += _(' (' + _.NOT_TESTED + ')', _bold=False, _color='orange')

        if not prefs or not check_key(prefs, id) or prefs[id][type + '_auto'] == 1:
            choice = _(' ,' + _.AUTO_CHOICE + '', _bold=False, _color='green')
        else:
            choice = _(' ,' + _.MANUAL_CHOICE + '', _bold=False, _color='orange')

        label += choice

        folder.add_item(
            label = label,
            art = {'thumb': row['image']},
            path = plugin.url_for(func_or_url=change_channel, type=type, id=id, change=0),
            context = [
                (_.AUTO_CHOICE_SET, 'Container.Update({context_url})'.format(context_url=plugin.url_for(func_or_url=change_channel, type=type, id=id, change=1)), ),
                #(_.TEST_CHANNEL, 'RunPlugin({context_url})'.format(context_url=plugin.url_for(func_or_url=test_channel, channel=id)), ),
            ],
            playable = False,
        )

    return folder
def home(**kwargs):
    if settings.getBool(key='_first_boot') == True:
        first_boot()

    folder = plugin.Folder()

    if not plugin.logged_in:
        folder.add_item(label=_(_.LOGIN, _bold=True),
                        path=plugin.url_for(func_or_url=login))
    else:
        folder.add_item(label=_(_.LIVE_TV, _bold=True),
                        path=plugin.url_for(func_or_url=live_tv))
        folder.add_item(label=_(_.CHANNELS, _bold=True),
                        path=plugin.url_for(func_or_url=replaytv))

        if settings.getBool('showMoviesSeries') == True:
            folder.add_item(label=_(_.SERIES, _bold=True),
                            path=plugin.url_for(func_or_url=vod,
                                                file='series',
                                                label=_.SERIES,
                                                start=0))
            folder.add_item(label=_(_.MOVIES, _bold=True),
                            path=plugin.url_for(func_or_url=vod,
                                                file='movies',
                                                label=_.MOVIES,
                                                start=0))
            folder.add_item(label=_(_.KIDS_SERIES, _bold=True),
                            path=plugin.url_for(func_or_url=vod,
                                                file='kidsseries',
                                                label=_.KIDS_SERIES,
                                                start=0))
            folder.add_item(label=_(_.KIDS_MOVIES, _bold=True),
                            path=plugin.url_for(func_or_url=vod,
                                                file='kidsmovies',
                                                label=_.KIDS_MOVIES,
                                                start=0))

        folder.add_item(label=_(_.SEARCH, _bold=True),
                        path=plugin.url_for(func_or_url=search_menu))

    folder.add_item(label=_.SETTINGS,
                    path=plugin.url_for(func_or_url=settings_menu))

    return folder
def replaytv_list(character, label='', start=0, **kwargs):
    start = int(start)
    folder = plugin.Folder(title=label)

    processed = process_replaytv_list(character=character, start=start)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed, 'count') and check_key(processed, 'total') and processed['total'] > 50:
        folder.add_item(
            label = _(_.NEXT_PAGE, _bold=True),
            path = plugin.url_for(func_or_url=replaytv_list, character=character, label=label, start=start+processed['count']),
        )

    return folder
def replaytv_item(label=None, idtitle=None, start=0, **kwargs):
    start = int(start)
    folder = plugin.Folder(title=label)

    processed = process_replaytv_list_content(label=label, idtitle=idtitle, start=start)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed, 'total') and check_key(processed, 'count') and int(processed['total']) > int(processed['count']):
        folder.add_item(
            label = _(_.NEXT_PAGE, _bold=True),
            path = plugin.url_for(func_or_url=replaytv_item, label=label, idtitle=idtitle, start=start+processed['count']),
        )

    return folder
def vod(file, label, start=0, **kwargs):
    start = int(start)
    folder = plugin.Folder(title=label)

    processed = process_vod_content(data=file, start=start, type=label)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed, 'total') and check_key(processed, 'count2') and processed['total'] > processed['count2']:
        folder.add_item(
            label = _(_.NEXT_PAGE, _bold=True),
            path = plugin.url_for(func_or_url=vod, file=file, label=label, start=processed['count2']),
        )

    return folder
def replaytv_content(label, day, station='', start=0, **kwargs):
    day = int(day)
    start = int(start)
    folder = plugin.Folder(title=label)

    processed = process_replaytv_content(station=station, day=day, start=start)

    if check_key(processed, 'items'):
        folder.add_items(processed['items'])

    if check_key(processed, 'total') and check_key(processed, 'count') and processed['total'] > processed['count']:
        folder.add_item(
            label = _(_.NEXT_PAGE, _bold=True),
            path = plugin.url_for(func_or_url=replaytv_content, label=label, day=day, station=station, start=processed['count']),
        )

    return folder
def replaytv(**kwargs):
    folder = plugin.Folder(title=_.CHANNELS)

    folder.add_item(
        label = _.PROGSAZ,
        info = {'plot': _.PROGSAZDESC},
        path = plugin.url_for(func_or_url=replaytv_alphabetical),
    )

    for row in get_replay_channels():
        folder.add_item(
            label = row['label'],
            info = {'plot': row['description']},
            art = {'thumb': row['image']},
            path = row['path'],
            playable = row['playable'],
        )

    return folder