def vod_season(label, series, id, **kwargs): folder = plugin.Folder(title=label) items = [] season = api_vod_season(series=series, id=id) for episode in season: items.append(plugin.Item( label = unicode(episode['label']), info = { 'plot': unicode(episode['description']), 'duration': episode['duration'], 'mediatype': 'video', 'sorttitle': unicode(episode['label']).upper(), }, art = { 'thumb': unicode(episode['image']), 'fanart': unicode(episode['image']) }, path = plugin.url_for(func_or_url=play_video, type='vod', channel=None, id=unicode(episode['id']), data=json.dumps(episode)), playable = True, )) folder.add_items(items) return folder
def primary(addons, **kwargs): folder = plugin.Folder(title=_.SELECT_PRIMARY) addons = json.loads(addons) desc = _.SELECT_PRIMARY_DESC desc2 = _.SKIP_DESC for entry in addons: folder.add_item(label=_(entry['label'], _bold=True), info={'plot': desc}, path=plugin.url_for(func_or_url=alternative, num=1, addon=entry['addonid'], addons=json.dumps(addons))) profile_settings = load_profile(profile_id=1) try: if len(profile_settings['addon1']) > 0: folder.add_item(label=_(_.SKIP, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=radio_select, num=6)) except: pass return folder
def home(**kwargs): clear_old() check_first() profile_settings = load_profile(profile_id=1) folder = plugin.Folder() if profile_settings and check_key(profile_settings, 'pswd') and len(profile_settings['pswd']) > 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'): for vod_entry in CONST_VOD_CAPABILITY: folder.add_item(label=_(vod_entry['label'], _bold=True), path=plugin.url_for(func_or_url=vod, file=vod_entry['file'], label=vod_entry['label'], start=vod_entry['start'], online=vod_entry['online'], split=vod_entry['split'])) if CONST_WATCHLIST: folder.add_item(label=_(_.WATCHLIST, _bold=True), path=plugin.url_for(func_or_url=watchlist)) 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 groups_menu(type, **kwargs): if type == 'tv': typestr = 'TV ' else: typestr = 'Radio ' folder = plugin.Folder(title=typestr + _.GROUPS) groups = load_file(type + '_groups.json', ext=False, isJSON=True) if not groups: groups = [] else: groups = list(groups) folder.add_item(label=_(_.ADD_GROUP, _bold=True), path=plugin.url_for(func_or_url=add_group, type=type)) for entry in groups: folder.add_item(label=_(entry, _bold=True), path=plugin.url_for(func_or_url=remove_group, type=type, name=entry)) 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 alternative(num, addon, addons, **kwargs): num = int(num) profile_settings = load_profile(profile_id=1) profile_settings['addon' + str(num)] = addon save_profile(profile_id=1, profile=profile_settings) folder = plugin.Folder(title=_.SELECT_SECONDARY) addons = json.loads(addons) addons2 = [] desc = _.SELECT_SECONDARY_DESC for entry in addons: if not entry['addonid'] == addon: addons2.append(entry) for entry in addons2: folder.add_item(label=_(entry['label'], _bold=True), info={'plot': desc}, path=plugin.url_for(func_or_url=alternative, num=num + 1, addon=entry['addonid'], addons=json.dumps(addons2))) folder.add_item(label=_.DONE, info={'plot': desc}, path=plugin.url_for(func_or_url=radio_select, num=num + 1)) return folder
def radio_order_picker_menu(double=None, primary=None, **kwargs): save_all_radio_order(double=double, primary=primary) folder = plugin.Folder(title=_.SELECT_ORDER) desc2 = _.NEXT_SETUP_IPTV folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=simple_iptv_menu)) prefs = load_radio_prefs(profile_id=1) order = load_radio_order(profile_id=1) if order: for currow in order: row = prefs[currow] if int(row['radio']) == 0: continue label = _(row['name'] + ": " + unicode(order[unicode(currow)]), _bold=True) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_radio_order, id=currow), playable=False, ) folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=simple_iptv_menu)) return folder
def radio_select(num, **kwargs): num = int(num) profile_settings = load_profile(profile_id=1) for x in range(num, 6): profile_settings['addon' + str(x)] = '' save_profile(profile_id=1, profile=profile_settings) folder = plugin.Folder(title=_.ADD_RADIO) desc = _.ADD_RADIO_DESC folder.add_item(label=_.YES, info={'plot': desc}, path=plugin.url_for(func_or_url=channel_picker_menu, type_tv_radio='live', save_all=1, radio=1)) folder.add_item(label=_.NO, info={'plot': desc}, path=plugin.url_for(func_or_url=channel_picker_menu, type_tv_radio='live', save_all=1, radio=0)) return folder
def channel_picker(type, **kwargs): if type=='live': title = _.LIVE_TV rows = get_live_channels(all=True) elif type=='replay': title = _.CHANNELS rows = get_replay_channels(all=True) folder = plugin.Folder(title=title) prefs = load_prefs(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 = _(unicode(row['label']), _bold=True, _color=color) folder.add_item( label = label, art = {'thumb': unicode(row['image'])}, path = plugin.url_for(func_or_url=change_channel, type=type, id=id, change=0), playable = False, ) return folder
def home(**kwargs): api_get_channels() folder = plugin.Folder(title='Installed Addons') installed = False loggedin = False addons = [] desc = _.ADDON_NOT_INSTALLED_DESC desc2 = _.NO_ADDONS_ENABLED_DESC desc3 = _.RESET_SETTINGS_DESC desc4 = _.ADDON_NOT_LOGGEDIN_DESC desc5 = _.ADDON_ENABLED_DESC desc6 = _.ADDONS_CONTINUE_DESC for entry in CONST_ADDONS: if check_addon(addon=entry['addonid']): if check_loggedin(addon=entry['addonid']): color = 'green' loggedin = True addons.append(entry) folder.add_item(label=_(entry['label'], _bold=True, _color=color), info={'plot': desc5}, path=plugin.url_for(func_or_url=home)) else: color = 'orange' folder.add_item(label=_(entry['label'], _bold=True, _color=color), info={'plot': desc4}, path=plugin.url_for(func_or_url=home)) installed = True else: color = 'red' folder.add_item(label=_(entry['label'], _bold=True, _color=color), info={'plot': desc}, path=plugin.url_for(func_or_url=home)) if installed == True and loggedin == True: folder.add_item(label=_.NEXT, info={'plot': desc6}, path=plugin.url_for(func_or_url=primary, addons=json.dumps(addons))) else: folder.add_item(label=_.NO_ADDONS_ENABLED, info={'plot': desc2}, path=plugin.url_for(func_or_url=home)) folder.add_item(label=_.RESET_SETTINGS, info={'plot': desc3}, path=plugin.url_for(func_or_url=reset_settings)) return folder
def vod(file, label, start=0, character=None, online=0, split=0, **kwargs): start = int(start) online = int(online) split = int(split) if split == 1: folder = plugin.Folder(title=_.PROGSAZ) label = _.OTHERTITLES folder.add_item( label = label, info = {'plot': _.OTHERTITLESDESC}, path = plugin.url_for(func_or_url=vod, file=file, label=label, start=start, character='other', online=online, split=0), ) 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=vod, file=file, label=label, start=start, character=character, online=online, split=0), ) return folder else: folder = plugin.Folder(title=label) processed = process_vod_content(data=file, start=start, type=label, character=character, online=online) 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), properties = {'SpecialSort': 'bottom'}, path = plugin.url_for(func_or_url=vod, file=file, label=label, start=processed['count2'], character=character, online=online, split=split), ) return folder
def watchlist(**kwargs): folder = plugin.Folder(title=_.WATCHLIST) data = api_list_watchlist() if data: processed = plugin_process_watchlist(data=data) if processed: folder.add_items(processed) return folder
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_KODI, path=plugin.url_for(func_or_url=plugin._set_settings_kodi)) 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 simple_iptv_menu(**kwargs): folder = plugin.Folder(title=_.SETUP_IPTV) desc = _.SETUP_IPTV_FINISH_DESC desc2 = _.SKIP_IPTV_FINISH_DESC folder.add_item(label=_(_.SETUP_IPTV_FINISH, _bold=True), info={'plot': desc}, path=plugin.url_for(func_or_url=finish_setup, setup=1)) folder.add_item(label=_(_.SKIP_IPTV_FINISH, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=finish_setup, setup=0)) 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=_.DISABLE_EROTICA, path=plugin.url_for(func_or_url=disable_prefs_menu, type='erotica')) folder.add_item(label=_.DISABLE_MINIMAL, path=plugin.url_for(func_or_url=disable_prefs_menu, type='minimal')) folder.add_item(label=_.DISABLE_REGIONAL2, path=plugin.url_for(func_or_url=disable_prefs_menu, type='regional')) if PROVIDER_NAME == 'kpn': folder.add_item(label=_.DISABLE_HOME_CONNECTION, path=plugin.url_for(func_or_url=disable_prefs_menu, type='home_only')) return folder
def live_channel_picker_menu(save_all=0, radio=None, **kwargs): save_all = int(save_all) if not radio == None: radio = int(radio) profile_settings = load_profile(profile_id=1) profile_settings['radio'] = radio save_profile(profile_id=1, profile=profile_settings) if save_all == 1: save_all_live_prefs() folder = plugin.Folder(title=_.SELECT_LIVE) desc2 = _.NEXT_SETUP_REPLAY folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=replay_channel_picker_menu, save_all=1)) prefs = load_prefs(profile_id=1) if prefs: for currow in prefs: row = prefs[currow] if row['live'] == 1: color = 'green' addon_type = row['live_addonid'].replace('plugin.video.', '') else: color = 'red' addon_type = _.DISABLED label = _(row['name'] + ": " + addon_type, _bold=True, _color=color) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_live_channel, id=currow), playable=False, ) folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=replay_channel_picker_menu, save_all=1)) return folder
def vod_series(label, type, id, **kwargs): folder = plugin.Folder(title=label) items = [] context = [] seasons = api_vod_seasons(type, id) title = label if seasons and check_key(seasons, 'seasons'): if CONST_WATCHLIST and check_key(seasons, 'watchlist'): context.append((_.ADD_TO_WATCHLIST, 'RunPlugin({context_url})'.format(context_url=plugin.url_for(func_or_url=add_to_watchlist, id=seasons['watchlist'], type='group')), )) if seasons['type'] == "seasons": for season in seasons['seasons']: label = _.SEASON + " " + unicode(season['seriesNumber']).replace('Seizoen ', '') items.append(plugin.Item( label = label, info = {'plot': unicode(season['description']), 'sorttitle': label.upper()}, art = { 'thumb': unicode(season['image']), 'fanart': unicode(season['image']) }, path = plugin.url_for(func_or_url=vod_season, label=label, series=id, id=unicode(season['id'])), context = context, )) else: for episode in seasons['seasons']: items.append(plugin.Item( label = unicode(episode['label']), info = { 'plot': unicode(episode['description']), 'duration': episode['duration'], 'mediatype': 'video', 'sorttitle': unicode(episode['label']).upper(), }, art = { 'thumb': unicode(episode['image']), 'fanart': unicode(episode['image']) }, path = plugin.url_for(func_or_url=play_video, type='vod', channel=None, id=unicode(episode['id'])), context = context, playable = True, )) folder.add_items(items) return folder
def live_tv(**kwargs): folder = plugin.Folder(title=_.LIVE_TV) for row in get_live_channels(): folder.add_item( label = row['label'], info = {'plot': row['description']}, art = {'thumb': row['image']}, path = row['path'], playable = row['playable'], context = row['context'], ) 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), ) if CONST_ONLINE_SEARCH: folder.add_item( label= label + " (Online)", path=plugin.url_for(func_or_url=online_search) ) profile_settings = load_profile(profile_id=1) for x in range(1, 10): try: if check_key(profile_settings, 'search' + unicode(x)): searchstr = profile_settings['search' + unicode(x)] else: searchstr = '' if searchstr != '': label = unicode(searchstr) path = plugin.url_for(func_or_url=search, query=searchstr) if CONST_ONLINE_SEARCH: if check_key(profile_settings, 'search_type' + unicode(x)): type = profile_settings['search_type' + unicode(x)] else: type = 0 if type == 1: label = unicode(searchstr) + ' (Online)' path = plugin.url_for(func_or_url=online_search, query=searchstr) folder.add_item( label = label, info = {'plot': _(_.SEARCH_FOR, query=searchstr)}, path = path, ) except: pass return folder
def search(query=None, **kwargs): items = [] if not query: query = gui.input(message=_.SEARCH, default='').strip() if not query: return profile_settings = load_profile(profile_id=1) for x in reversed(range(2, 10)): if check_key(profile_settings, 'search' + unicode(x - 1)): profile_settings['search' + unicode(x)] = profile_settings['search' + unicode(x - 1)] else: profile_settings['search' + unicode(x)] = '' profile_settings['search1'] = query if CONST_ONLINE_SEARCH: for x in reversed(range(2, 10)): if check_key(profile_settings, 'search_type' + unicode(x - 1)): profile_settings['search_type' + unicode(x)] = profile_settings['search_type' + unicode(x - 1)] else: profile_settings['search_type' + unicode(x)] = 0 profile_settings['search_type1'] = 0 save_profile(profile_id=1, profile=profile_settings) else: query = unicode(query) folder = plugin.Folder(title=_(_.SEARCH_FOR, query=query)) processed = process_replaytv_search(search=query) items += processed['items'] if settings.getBool('showMoviesSeries'): for vod_entry in CONST_VOD_CAPABILITY: processed = process_vod_content(data=vod_entry['file'], start=vod_entry['start'], search=query, type=vod_entry['label'], online=vod_entry['online']) items += processed['items'] items[:] = sorted(items, key=_sort_replay_items, reverse=True) items = items[:25] folder.add_items(items) 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, 'count2') and processed['total'] > processed['count2']: folder.add_item( label = _(_.NEXT_PAGE, _bold=True), properties = {'SpecialSort': 'bottom'}, path = plugin.url_for(func_or_url=replaytv_item, label=label, idtitle=idtitle, start=processed['count2']), ) return folder
def watchlist_listing(label, id, search=0, **kwargs): search = int(search) folder = plugin.Folder(title=label) data = api_watchlist_listing(id) if search == 0: id = None if data: processed = plugin_process_watchlist_listing(data=data, id=id) if processed: folder.add_items(processed) return folder
def order_picker_menu(type_tv_radio, double=None, primary=None, **kwargs): type_tv_radio = str(type_tv_radio) save_all_order(type_tv_radio=type_tv_radio, double=double, primary=primary) folder = plugin.Folder(title=_.SELECT_ORDER) desc2 = _.NEXT_SETUP_GROUPS folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=group_picker_menu, type_tv_radio=type_tv_radio)) if type_tv_radio == 'live': prefs = load_prefs(profile_id=1) order = load_order(profile_id=1) else: prefs = load_radio_prefs(profile_id=1) order = load_radio_order(profile_id=1) if order: for currow in order: row = prefs[currow] if int(row[type_tv_radio]) == 0: continue label = _(row['name'] + ": " + str(order[str(currow)]), _bold=True) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_order, id=currow, type_tv_radio=type_tv_radio), playable=False, ) desc2 = _.NEXT_SETUP_GROUPS folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=group_picker_menu, type_tv_radio=type_tv_radio)) 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
def replay_channel_picker_menu(save_all=0, **kwargs): save_all = int(save_all) if save_all == 1: save_all_replay_prefs() folder = plugin.Folder(title=_.SELECT_REPLAY) desc2 = _.NEXT_SETUP_ORDER folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=tv_order_picker_menu)) prefs = load_prefs(profile_id=1) if prefs: for currow in prefs: row = prefs[currow] if row['replay'] == 1: color = 'green' addon_type = row['replay_addonid'].replace('plugin.video.', '') else: color = 'red' addon_type = _.DISABLED label = _(row['name'] + ": " + addon_type, _bold=True, _color=color) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_replay_channel, id=currow), playable=False, ) folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=tv_order_picker_menu)) return folder
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
def online_search(query=None, **kwargs): items = [] if not query: query = gui.input(message=_.SEARCH, default='').strip() if not query: return profile_settings = load_profile(profile_id=1) for x in reversed(range(2, 10)): if check_key(profile_settings, 'search' + unicode(x - 1)): profile_settings['search' + unicode(x)] = profile_settings['search' + unicode(x - 1)] else: profile_settings['search' + unicode(x)] = '' if check_key(profile_settings, 'search_type' + unicode(x - 1)): profile_settings['search_type' + unicode(x)] = profile_settings['search_type' + unicode(x - 1)] else: profile_settings['search_type' + unicode(x)] = 0 profile_settings['search1'] = query profile_settings['search_type1'] = 1 save_profile(profile_id=1, profile=profile_settings) else: query = unicode(query) folder = plugin.Folder(title=_(_.SEARCH_FOR, query=query)) processed = process_vod_content(data=None, start=0, search=query, type='Online', online=1) items += processed['items'] items[:] = sorted(items, key=_sort_replay_items, reverse=True) items = items[:25] folder.add_items(items) return folder
def radio_channel_picker_menu(save_all=0, **kwargs): save_all = int(save_all) if save_all == 1: save_all_radio_prefs() folder = plugin.Folder(title=_.SELECT_RADIO) desc2 = _.NEXT_SETUP_ORDER folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=radio_order_picker_menu)) prefs = load_radio_prefs(profile_id=1) if prefs: for currow in prefs: row = prefs[currow] if row['radio'] == 1: color = 'green' else: color = 'red' label = _(row['name'], _bold=True, _color=color) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_radio_channel, id=currow), playable=False, ) folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=radio_order_picker_menu)) return folder
def group_picker_menu(type_tv_radio, **kwargs): type_tv_radio = str(type_tv_radio) folder = plugin.Folder(title=_.SELECT_GROUP) if type_tv_radio == 'live': profile_settings = load_profile(profile_id=1) if int(profile_settings['radio']) == 1: desc2 = _.NEXT_SETUP_RADIO path = plugin.url_for(func_or_url=channel_picker_menu, type_tv_radio='radio', save_all=1) else: desc2 = _.NEXT_SETUP_IPTV path = plugin.url_for(func_or_url=simple_iptv_menu) folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=path) prefs = load_prefs(profile_id=1) groups = load_file('tv_groups.json', ext=False, isJSON=True) else: desc2 = _.NEXT_SETUP_IPTV folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=simple_iptv_menu)) prefs = load_radio_prefs(profile_id=1) groups = load_file('radio_groups.json', ext=False, isJSON=True) if not groups: groups = [] else: groups = list(groups) if prefs: for currow in prefs: row = prefs[currow] if int(row[type_tv_radio]) == 0: continue if check_key(row, 'group'): label = _(row['name'] + ": " + str(row['group']), _bold=True) else: if type_tv_radio == 'live': label = _(row['name'] + ": TV", _bold=True) else: label = _(row['name'] + ": Radio", _bold=True) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_group, id=currow, type_tv_radio=type_tv_radio), playable=False, ) if type_tv_radio == 'live': folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=path) else: folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=simple_iptv_menu)) return folder
def channel_picker_menu(type_tv_radio, save_all=0, radio=None, **kwargs): type_tv_radio = str(type_tv_radio) save_all = int(save_all) if not radio == None: radio = int(radio) profile_settings = load_profile(profile_id=1) profile_settings['radio'] = radio save_profile(profile_id=1, profile=profile_settings) if save_all == 1: save_all_prefs(type_tv_radio) if type_tv_radio == 'live': folder = plugin.Folder(title=_.SELECT_LIVE) desc2 = _.NEXT_SETUP_REPLAY folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=channel_picker_menu, type_tv_radio='replay', save_all=1)) prefs = load_prefs(profile_id=1) elif type_tv_radio == 'replay': folder = plugin.Folder(title=_.SELECT_REPLAY) desc2 = _.NEXT_SETUP_ORDER prefs = load_prefs(profile_id=1) folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=order_picker_menu, type_tv_radio='live')) else: folder = plugin.Folder(title=_.SELECT_RADIO) desc2 = _.NEXT_SETUP_ORDER folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=order_picker_menu, type_tv_radio='radio')) prefs = load_radio_prefs(profile_id=1) if prefs: for currow in prefs: row = prefs[currow] if not check_key(row, type_tv_radio): continue if row[type_tv_radio] == 1: color = 'green' if not type_tv_radio == 'radio': addon_type = row[type_tv_radio + '_addonid'].replace( 'plugin.video.', '') else: color = 'red' if not type_tv_radio == 'radio': addon_type = _.DISABLED if not type_tv_radio == 'radio': label = _(row['name'] + ": " + addon_type, _bold=True, _color=color) else: label = _(row['name'], _bold=True, _color=color) folder.add_item( label=label, path=plugin.url_for(func_or_url=change_channel, id=currow, type_tv_radio=type_tv_radio), playable=False, ) if type_tv_radio == 'live': folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=channel_picker_menu, type_tv_radio='replay', save_all=1)) elif type_tv_radio == 'replay': folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=order_picker_menu, type_tv_radio='live')) else: folder.add_item(label=_(_.NEXT, _bold=True), info={'plot': desc2}, path=plugin.url_for(func_or_url=order_picker_menu, type_tv_radio='radio')) return folder