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, kids=0, start=0)) folder.add_item(label=_(_.MOVIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='movies', label=_.MOVIES, kids=0, start=0)) folder.add_item(label=_(_.HBO_SERIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='hboseries', label=_.HBO_SERIES, kids=0, start=0)) folder.add_item(label=_(_.HBO_MOVIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='hbomovies', label=_.HBO_MOVIES, kids=0, start=0)) folder.add_item(label=_(_.KIDS_SERIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='kids', label=_.KIDS_SERIES, kids=1, start=0)) folder.add_item(label=_(_.KIDS_MOVIES, _bold=True), path=plugin.url_for(func_or_url=vod, file='kids', label=_.KIDS_MOVIES, kids=2, start=0)) 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=_.SETTINGS, path=plugin.url_for(func_or_url=settings_menu)) return folder
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 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 online_search(query=None, **kwargs): if not query: query = gui.input(message=_.SEARCH, default='').strip() if not query: return for x in reversed(list(range(2, 10))): settings.set(key='_search' + unicode(x), value=settings.get(key='_search' + unicode(x - 1))) settings.set(key='_search_type' + unicode(x), value=settings.get(key='_search_type' + unicode(x - 1))) settings.set(key='_search1', value=query) settings.set(key='_search_type1', value=' (Online)') folder = plugin.Folder(title=_(_.SEARCH_FOR, query=query)) data = api.online_search(search=query, vod=settings.getBool('showMoviesSeries')) if data: processed = process_online_search(data=data) if processed: folder.add_items(processed) return folder
def search(query=None, **kwargs): items = [] if not query: query = gui.input(message=_.SEARCH, default='').strip() if not query: return for x in reversed(list(range(2, 10))): settings.set(key='_search' + unicode(x), value=settings.get(key='_search' + unicode(x - 1))) settings.set(key='_search1', value=query) folder = plugin.Folder(title=_(_.SEARCH_FOR, query=query)) data = load_file(file='list_replay.json', isJSON=True) processed = process_replaytv_search(data=data, start=0, search=query) items += processed['items'] items[:] = sorted(items, key=_sort_replay_items, reverse=True) items = items[:25] folder.add_items(items) return folder
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
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 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 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 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
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 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
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
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 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
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
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
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 search(query=None, **kwargs): items = [] if not query: query = gui.input(message=_.SEARCH, default='').strip() if not query: return db_query = "UPDATE `vars` SET `search10`=`search9`, `search9`=`search8`, `search8`=`search7`, `search7`=`search6`, `search6`=`search5`, `search5`=`search4`, `search4`=`search3`, `search3`=`search2`, `search2`=`search1`, `search1`='{search1}' WHERE profile_id={profile_id}".format(search1=query, profile_id=1) query_settings(query=db_query, return_result=False, return_insert=False, commit=False) folder = plugin.Folder(title=_(_.SEARCH_FOR, query=query)) processed = process_replaytv_search(search=query) items += processed['items'] if settings.getBool('showMoviesSeries'): processed = process_vod_content(data='series', start=0, search=query, type=_.SERIES) items += processed['items'] processed = process_vod_content(data='film1', start=0, search=query, type=_.MOVIES) items += processed['items'] processed = process_vod_content(data='videoshop', start=0, search=query, type=_.VIDEOSHOP) items += processed['items'] items[:] = sorted(items, key=_sort_replay_items, reverse=True) items = items[:25] folder.add_items(items) 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
def search(query=None, **kwargs): items = [] if not query: query = gui.input(message=_.SEARCH, default='').strip() if not query: return for x in reversed(list(range(2, 10))): settings.set(key='_search' + unicode(x), value=settings.get(key='_search' + unicode(x - 1))) settings.set(key='_search1', value=query) folder = plugin.Folder(title=_(_.SEARCH_FOR, query=query)) data = load_file(file='list_replay.json', isJSON=True) processed = process_replaytv_search(data=data, start=0, search=query) items += processed['items'] if settings.getBool('showMoviesSeries') == True: processed = process_vod_content(data=load_file(file='vod.json', isJSON=True)['series'], start=0, search=query, type=_.SERIES) items += processed['items'] processed = process_vod_content(data=load_file(file='vod.json', isJSON=True)['movies'], start=0, search=query, type=_.MOVIES) items += processed['items'] processed = process_vod_content(data=load_file( file='vod.json', isJSON=True)['kidsseries'], start=0, search=query, type=_.KIDS_SERIES) items += processed['items'] processed = process_vod_content(data=load_file( file='vod.json', isJSON=True)['kidsmovies'], start=0, search=query, type=_.KIDS_MOVIES) items += processed['items'] items[:] = sorted(items, key=_sort_replay_items, reverse=True) items = items[:25] folder.add_items(items) return folder
def watchlist(**kwargs): folder = plugin.Folder(title=_.WATCHLIST) data = api.list_watchlist() if data and check_key(data, 'entries'): processed = process_watchlist(data=data) if processed: folder.add_items(processed) return folder
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 live_tv(**kwargs): folder = plugin.Folder(title=_.LIVE_TV) for row in get_live_channels(addon=settings.getBool(key='enable_simple_iptv')): folder.add_item( label = row['label'], info = {'plot': row['description']}, art = {'thumb': row['image']}, path = row['path'], playable = row['playable'], ) return folder
def vod_season(label, id, mediagroupid=None, **kwargs): folder = plugin.Folder(title=label) season_url = '{mediaitems_url}/?byParentId={id}&includeAdult=true&range=0-1000&sort=seriesEpisodeNumber|ASC'.format(mediaitems_url=settings.get(key='_mediaitems_url'), id=id) data = api.download(url=season_url, type="get", code=[200], data=None, json_data=False, data_return=True, return_json=True, retry=True, check_data=False) if not data or not check_key(data, 'mediaItems'): return folder processed = process_vod_season(data=data, mediagroupid=mediagroupid) if processed: folder.add_items(processed) return folder
def watchlist_listing(label, description, image, id, search=False, **kwargs): folder = plugin.Folder(title=label) data = api.watchlist_listing(id) if search == False: id = None if data and check_key(data, 'listings'): processed = process_watchlist_listing(data=data, id=id) if processed: folder.add_items(processed) 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