def genres(video_type): post_data = '' match = [] xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) if not xbmcvfs.exists(utility.session_file()): login.login() if video_type == 'tv': post_data = utility.series_genre % utility.get_setting( 'authorization_url') elif video_type == 'movie': post_data = utility.movie_genre % utility.get_setting( 'authorization_url') else: pass content = utility.decode( connect.load_site(utility.evaluator(), post=post_data)) matches = json.loads(content)['value']['genres'] for item in matches: try: match.append( (unicode(matches[item]['id']), matches[item]['menuName'])) except Exception: try: match.append((unicode(matches[item]['summary']['id']), matches[item]['summary']['menuName'])) except Exception: pass for genre_id, title in match: if video_type == 'tv': add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type) elif not genre_id == '83' and video_type == 'movie': add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def genres(video_type): post_data = '' match = [] xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) if not xbmcvfs.exists(utility.session_file()): login.login() if video_type == 'tv': post_data = '{"paths":[["genres",83,"subgenres",{"from":0,"to":20},"summary"],["genres",83,"subgenres",' \ '"summary"]],"authURL":"%s"}' % utility.get_setting('authorization_url') elif video_type == 'movie': post_data = '{"paths":[["genreList",{"from":0,"to":24},["id","menuName"]],["genreList"]],"authURL":"%s"}' \ % utility.get_setting('authorization_url') else: pass content = utility.decode(connect.load_site(utility.evaluator(), post=post_data)) matches = json.loads(content)['value']['genres'] for item in matches: try: match.append((unicode(matches[item]['id']), matches[item]['menuName'])) except Exception: try: match.append((unicode(matches[item]['summary']['id']), matches[item]['summary']['menuName'])) except Exception: pass for genre_id, title in match: if video_type == 'tv': add.directory(title, utility.main_url + '/browse/genre/' + genre_id + '?bc=83', 'list_videos', '', video_type) elif not genre_id == '83' and video_type == 'movie': add.directory(title, utility.main_url + '/browse/genre/' + genre_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def add_dynamic_lists(video_type): content = connect.load_netflix_site("https://www.netflix.com/") falkor_cache = generic_utility.parse_falkorcache(content) for list in read_lists(falkor_cache): add.directory(list['name'], 'list?' + list['id'], 'list_videos', '', video_type)
def genres(video_type): post_data = '' match = [] xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) if not xbmcvfs.exists(utility.session_file()): login.login() if video_type == 'tv': post_data = utility.series_genre % utility.get_setting('authorization_url') elif video_type == 'movie': post_data = utility.movie_genre % utility.get_setting('authorization_url') else: pass content = utility.decode(connect.load_site(utility.evaluator(), post=post_data)) matches = json.loads(content)['value']['genres'] for item in matches: try: match.append((unicode(matches[item]['id']), matches[item]['menuName'])) except Exception: try: match.append((unicode(matches[item]['summary']['id']), matches[item]['summary']['menuName'])) except Exception: pass for genre_id, title in match: if video_type == 'tv': add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type) elif not genre_id == '83' and video_type == 'movie': add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def main(video_type): add.directory(generic_utility.get_string(30105), '', 'list_viewing_activity', '', video_type) add_dynamic_lists(video_type) if video_type == 'tv': add.directory(generic_utility.get_string(30107), 'genre?83', 'list_videos', '', video_type) add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type) else: add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type) add.directory(generic_utility.get_string(30109), '', 'search', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def add_dynamic_lists(): ret, root_list = req_lists() mylist_id, lists = lolomos.read_lists(ret, root_list) for list in lists: list_id = list['id'] mylist_parm = '' if list_id == mylist_id: mylist_parm = '&mylist' add.directory(list['name'], 'list?' + list_id+mylist_parm, 'list_videos', '', 'both')
def genres(video_type): xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) match = get.genre_data(video_type) for genre_id, title in match: if video_type == 'show': add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type) elif not genre_id == '83' and video_type == 'movie': add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def channels(connect_handle, id_number): url = urls.base_url + urls.channels_url % (plugin_info.get_setting('language'), id_number) response = connect_handle.url(url) content = connect_handle.json(response) for item in content['items']: title = item['title'] id_number = item['id'] thumb = item['logo'] add.directory(title, id_number, 'channel', thumb, '') xbmcplugin.setContent(plugin_handle, 'files') xbmcplugin.endOfDirectory(plugin_handle)
def index(connect_handle): url = urls.base_url + urls.global_url % plugin_info.get_setting('language') response = connect_handle.url(url) content = connect_handle.json(response) content = content['landing_pages'] for item in content[0]['landing_pages']: item_title = item['name'] item_id = item['id'] add.directory(item_title, item_id, 'vod', '', '') add.directory(content[1]['name'], content[1]['id'], 'channels', '', '') xbmcplugin.setContent(plugin_handle, 'files') xbmcplugin.endOfDirectory(plugin_handle)
def add_dynamic_lists(): ret, root_list = req_lists() mylist_id, lists = lolomos.read_lists(ret, root_list) for list in lists: list_id = list['id'] mylist_parm = '' if list_id == mylist_id: mylist_parm = '&mylist' add.directory(list['name'], 'list?' + list_id + mylist_parm, 'list_videos', '', 'both')
def index(): add.directory(generic_utility.get_string(30100), '', 'main', '', 'movie', login_context=True) add.directory(generic_utility.get_string(30101), '', 'main', '', 'show', login_context=True) if generic_utility.get_setting('superbrowse') == 'true': add.directory(generic_utility.get_string(30112), '', 'superbrowse', '', 'superbrowse', login_context=True) add.directory(generic_utility.get_string(30102), '', 'main', '', 'dynamic', login_context=True) if not generic_utility.get_setting('single_profile') == 'true': add.item(generic_utility.get_string(30103) + ' - [COLOR FF8E0000]' + generic_utility.get_setting('profile_name') + '[/COLOR]', 'choose_profile', login_context=True) xbmcplugin.endOfDirectory(plugin_handle)
def superbrowse(): xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) with open(".kodi/addons/plugin.video.flix2kodi/resources/data/superbrowse_categories.json") as categories_file: categories = json.load(categories_file) for category_name,category_id in categories.iteritems(): if 'TV' in category_name: video_type='show' elif 'Series' in category_name: video_tyoe='show' else: video_type='movie' add.directory(category_name, 'genre?' + category_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def index(): if login.login(): add.directory(utility.get_string(30100), '', 'main', '', 'movie') add.directory(utility.get_string(30101), '', 'main', '', 'tv') add.directory(utility.get_string(30102), '', 'wi_home', '', 'both') if not utility.get_setting('single_profile') == 'true': add.directory( utility.get_string(30103) + ' - [COLOR FF8E0000]' + utility.get_setting('profile_name') + '[/COLOR]', '', 'update_displayed_profile', 'DefaultAddonService.png', '', context_enable=False) xbmcplugin.endOfDirectory(plugin_handle)
def superbrowse(): xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) with open( ".kodi/addons/plugin.video.flix2kodi/resources/data/superbrowse_categories.json" ) as categories_file: categories = json.load(categories_file) for category_name, category_id in categories.iteritems(): if 'TV' in category_name: video_type = 'show' elif 'Series' in category_name: video_tyoe = 'show' else: video_type = 'movie' add.directory(category_name, 'genre?' + category_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def superbrowse(): xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) with open( xbmc.translatePath(generic_utility.addon_dir() + '/resources/data/superbrowse_categories.json') ) as categories_file: categories = json.load(categories_file) for category_name, category_id in categories.iteritems(): if 'TV' in category_name: video_type = 'show' elif 'Series' in category_name: video_tyoe = 'show' else: video_type = 'movie' add.directory(category_name, 'genre?' + category_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def main(connect_handle, id_number): url = urls.base_url + urls.landing_url % (plugin_info.get_setting('language'), id_number) response = connect_handle.url(url) content = connect_handle.json(response) add.directory(plugin_info.get_string(30100), id_number, 'sorting', '', 'latest') add.directory(plugin_info.get_string(30101), id_number, 'sorting', '', 'alpha') add.directory(plugin_info.get_string(30102), id_number, 'sorting', '', 'genre') if content['collections']['items']: title = content['collections']['name'] add.directory(title, id_number, 'collection', '', '') xbmcplugin.setContent(plugin_handle, 'files') if plugin_info.get_setting('force_view') == 'true': xbmc.executebuiltin('Container.SetViewMode(%s)' % plugin_info.get_setting('view_id_folders')) xbmcplugin.endOfDirectory(plugin_handle)
def index(): if login.login(): add.directory(utility.get_string(30100), '', 'main', '', 'movie') add.directory(utility.get_string(30101), '', 'main', '', 'tv') add.directory(utility.get_string(30102), '', 'wi_home', '', 'both') if not utility.get_setting('single_profile') == 'true': add.directory(utility.get_string(30103) + ' - [COLOR FF8E0000]' + utility.get_setting('profile_name') + '[/COLOR]', '', 'update_displayed_profile', 'DefaultAddonService.png', '', context_enable=False) xbmcplugin.endOfDirectory(plugin_handle)
def genres(video_type): post_data = '' match = [] xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) if not xbmcvfs.exists(utility.session_file()): login.login() if video_type == 'tv': post_data = '{"paths":[["genres",83,"subgenres",{"from":0,"to":20},"summary"],["genres",83,"subgenres",' \ '"summary"]],"authURL":"%s"}' % utility.get_setting('authorization_url') elif video_type == 'movie': post_data = '{"paths":[["genreList",{"from":0,"to":24},["id","menuName"]],["genreList"]],"authURL":"%s"}' \ % utility.get_setting('authorization_url') else: pass content = utility.decode( connect.load_site(utility.evaluator_url % (utility.get_setting('netflix_application'), utility.get_setting('netflix_version')), post=post_data)) matches = json.loads(content)['value']['genres'] for k in matches: try: match.append((unicode(matches[k]['id']), matches[k]['menuName'])) except Exception: try: match.append((unicode(matches[k]['summary']['id']), matches[k]['summary']['menuName'])) except Exception: pass for genre_id, title in match: if video_type == 'tv': add.directory( title, utility.main_url + '/browse/genre/' + genre_id + '?bc=83', 'list_videos', '', video_type) elif not genre_id == '83' and video_type == 'movie': add.directory(title, utility.main_url + '/browse/genre/' + genre_id, 'list_videos', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def index(): add.directory(generic_utility.get_string(30100), '', 'main', '', 'movie', login_context=True) add.directory(generic_utility.get_string(30101), '', 'main', '', 'show', login_context=True) if generic_utility.get_setting('superbrowse') == 'true': add.directory(generic_utility.get_string(30112), '', 'superbrowse', '', 'superbrowse', login_context=True) add.directory(generic_utility.get_string(30102), '', 'main', '', 'dynamic', login_context=True) if not generic_utility.get_setting('single_profile') == 'true': add.item( generic_utility.get_string(30103) + ' - [COLOR FF8E0000]' + generic_utility.get_setting('profile_name') + '[/COLOR]', 'choose_profile', login_context=True) xbmcplugin.endOfDirectory(plugin_handle)
def add_dynamic_lists(video_type): content = connect.load_netflix_site("https://www.netflix.com/") falkor_cache = generic_utility.parse_falkorcache(content) for list in read_lists(falkor_cache): add.directory(list['name'], 'list?'+list['id'], 'list_videos', '', video_type)
def main(video_type): add.directory(generic_utility.get_string(30105), '', 'list_viewing_activity', '', video_type) if video_type == 'show': add.directory(generic_utility.get_string(30107), 'genre?83', 'list_videos', '', video_type) add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type) elif video_type == 'movie': add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type) elif video_type == 'dynamic': add_dynamic_lists() if video_type != 'dynamic': root_list = lolomos.get_root_list() mylist = lolomos.get_mylist(root_list) add.directory(child('displayName', mylist[1]), 'list?&mylist', 'list_videos', '', video_type) add.directory(generic_utility.get_string(30109), '', 'search', '', video_type) xbmcplugin.endOfDirectory(plugin_handle, cacheToDisc=False)
def main(video_type): add.directory(utility.get_string(30104), utility.main_url + '/browse/my-list', 'list_videos', '', video_type) add.directory(utility.get_string(30105), '', 'list_viewing_activity', '', video_type) add.directory(utility.get_string(30106), utility.main_url + '/browse/recently-added', 'list_videos', '', video_type) if video_type == 'tv': add.directory(utility.get_string(30107), utility.main_url + '/browse/genre/83', 'list_videos', '', video_type) add.directory(utility.get_string(30108), '', 'list_genres', '', video_type) else: add.directory(utility.get_string(30108), '', 'list_genres', '', video_type) add.directory(utility.get_string(30109), '', 'search', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)
def main(video_type): add.directory(generic_utility.get_string(30105), '', 'list_viewing_activity', '', video_type) if video_type == 'show': add.directory(generic_utility.get_string(30107), 'genre?83', 'list_videos', '', video_type) add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type) elif video_type == 'movie': add.directory(generic_utility.get_string(30108), '', 'list_genres', '', video_type) elif video_type == 'dynamic': add_dynamic_lists() if video_type != 'dynamic' and generic_utility.get_setting( 'is_kid') == 'false': try: root_list = lolomos.get_root_list() except AttributeError: if connect.do_login(): root_list = lolomos.get_root_list() else: raise Exception("Cannot login") mylist = lolomos.get_mylist(root_list) add.directory(child('displayName', mylist[1]), 'list?&mylist', 'list_videos', '', video_type) add.directory(generic_utility.get_string(30109), '', 'search', '', video_type) xbmcplugin.endOfDirectory(plugin_handle, cacheToDisc=False)
def videos(url, video_type, run_as_widget=False): loading_progress = None if not run_as_widget: loading_progress = xbmcgui.DialogProgress() loading_progress.create('Netflix', utility.get_string(30205) + '...') utility.progress_window(loading_progress, 0, '...') xbmcplugin.setContent(plugin_handle, 'movies') if not xbmcvfs.exists(utility.session_file()): login.login() ''' the next part is necessary during the changing phase. Otherwise data are not available. ''' if 'recently-added' in url: postdata = utility.recently_added % utility.get_setting('authorization_url') content = utility.decode(connect.load_site(utility.evaluator(), post=postdata)) else: content = utility.decode(connect.load_site(url)) if not 'id="page-LOGIN"' in content or url == 'recently-added': if utility.get_setting('single_profile') == 'true' and 'id="page-ProfilesGate"' in content: profiles.force_choose() else: if '<div id="queue"' in content: content = content[content.find('<div id="queue"'):] if not 'recently-added' in url: content = utility.clean_content(content) match = None if not match: match = re.compile('"\$type":"leaf",.*?"id":([0-9]+)', re.DOTALL).findall(content) print '1: ' + str(match) if not match: match = re.compile('<a href="\/watch\/([0-9]+)', re.DOTALL).findall(content) print '2: ' + str(match) if not match: match = re.compile('<span id="dbs(.+?)_.+?alt=".+?"', re.DOTALL).findall(content) print '3: ' + str(match) if not match: match = re.compile('<span class="title.*?"><a id="b(.+?)_', re.DOTALL).findall(content) print '4: ' + str(match) if not match: match = re.compile('"boxart":".+?","titleId":(.+?),', re.DOTALL).findall(content) print '5: ' + str(match) if not match: match = re.compile('WiPlayer\?movieid=([0-9]+?)&', re.DOTALL).findall(content) print '6: ' + str(match) if 'recently-added' in url: matches = json.loads(content)['value']['videos'] for video_id in matches: match.append(unicode(video_id)) print '7: ' + str(match) print len(match) i = 1 for video_id in match: if int(video_id) > 10000000 or 'recently-added' in url: if not run_as_widget: utility.progress_window(loading_progress, i * 100 / len(match), '...') video(video_id, '', '', False, False, video_type, url) i += 1 match1 = re.compile('&pn=(.+?)&', re.DOTALL).findall(url) match2 = re.compile('&from=(.+?)&', re.DOTALL).findall(url) match_api_root = re.compile('"API_ROOT":"(.+?)"', re.DOTALL).findall(content) match_api_base = re.compile('"API_BASE_URL":"(.+?)"', re.DOTALL).findall(content) match_identifier = re.compile('"BUILD_IDENTIFIER":"(.+?)"', re.DOTALL).findall(content) if 'agid=' in url and match_api_root and match_api_base and match_identifier: genre_id = url[url.find('agid=') + 5:] add.directory(utility.get_string(30110), match_api_root[0] + match_api_base[0] + '/' + match_identifier[ 0] + '/wigenre?genreId=' + genre_id + '&full=false&from=51&to=100&_retry=0', 'list_videos', '', video_type) elif match1: current_page = match1[0] next_page = str(int(current_page) + 1) add.directory(utility.get_string(30110), url.replace('&pn=' + current_page + '&', '&pn=' + next_page + '&'), 'list_videos', '', video_type) elif match2: current_from = match2[0] next_from = str(int(current_from) + 50) current_to = str(int(current_from) + 49) next_to = str(int(current_from) + 99) add.directory(utility.get_string(30110), url.replace('&from=' + current_from + '&', '&from=' + next_from + '&').replace( '&to=' + current_to + '&', '&to=' + next_to + '&'), 'list_videos', '', video_type) if utility.get_setting('force_view') == 'true' and not run_as_widget: xbmc.executebuiltin('Container.SetViewMode(' + utility.get_setting('view_id_videos') + ')') xbmcplugin.endOfDirectory(plugin_handle) else: delete.cookies() utility.log('User is not logged in.', loglevel=xbmc.LOGERROR) utility.notification(utility.get_string(30303))
def videos(url, video_type, run_as_widget=False): loading_progress = None if not run_as_widget: loading_progress = xbmcgui.DialogProgress() loading_progress.create('Netflix', utility.get_string(30205) + '...') utility.progress_window(loading_progress, 0, '...') xbmcplugin.setContent(plugin_handle, 'movies') if not xbmcvfs.exists(utility.session_file()): login.login() content = utility.decode(connect.load_site(url)) if not 'id="page-LOGIN"' in content: if utility.get_setting( 'single_profile' ) == 'true' and 'id="page-ProfilesGate"' in content: profiles.force_choose() else: if '<div id="queue"' in content: content = content[content.find('<div id="queue"'):] content = utility.clean_content(content) match = None if not match: match = re.compile('"\$type":"leaf",.*?"id":([0-9]+)', re.DOTALL).findall(content) print '1: ' + str(match) if not match: match = re.compile('<a href="\/watch\/([0-9]+)', re.DOTALL).findall(content) print '2: ' + str(match) if not match: match = re.compile('<span id="dbs(.+?)_.+?alt=".+?"', re.DOTALL).findall(content) print '3: ' + str(match) if not match: match = re.compile('<span class="title.*?"><a id="b(.+?)_', re.DOTALL).findall(content) print '4: ' + str(match) if not match: match = re.compile('"boxart":".+?","titleId":(.+?),', re.DOTALL).findall(content) print '5: ' + str(match) if not match: match = re.compile('WiPlayer\?movieid=([0-9]+?)&', re.DOTALL).findall(content) print '6: ' + str(match) print len(match) i = 1 for video_id in match: if int(video_id) > 10000000: if not run_as_widget: utility.progress_window(loading_progress, i * 100 / len(match), '...') video(video_id, '', '', False, False, video_type, url) i += 1 match1 = re.compile('&pn=(.+?)&', re.DOTALL).findall(url) match2 = re.compile('&from=(.+?)&', re.DOTALL).findall(url) match_api_root = re.compile('"API_ROOT":"(.+?)"', re.DOTALL).findall(content) match_api_base = re.compile('"API_BASE_URL":"(.+?)"', re.DOTALL).findall(content) match_identifier = re.compile('"BUILD_IDENTIFIER":"(.+?)"', re.DOTALL).findall(content) if 'agid=' in url and match_api_root and match_api_base and match_identifier: genre_id = url[url.find('agid=') + 5:] add.directory( utility.get_string(30110), match_api_root[0] + match_api_base[0] + '/' + match_identifier[0] + '/wigenre?genreId=' + genre_id + '&full=false&from=51&to=100&_retry=0', 'list_videos', '', video_type) elif match1: current_page = match1[0] next_page = str(int(current_page) + 1) add.directory( utility.get_string(30110), url.replace('&pn=' + current_page + '&', '&pn=' + next_page + '&'), 'list_videos', '', video_type) elif match2: current_from = match2[0] next_from = str(int(current_from) + 50) current_to = str(int(current_from) + 49) next_to = str(int(current_from) + 99) add.directory( utility.get_string(30110), url.replace('&from=' + current_from + '&', '&from=' + next_from + '&').replace( '&to=' + current_to + '&', '&to=' + next_to + '&'), 'list_videos', '', video_type) if utility.get_setting( 'force_view') == 'true' and not run_as_widget: xbmc.executebuiltin('Container.SetViewMode(' + utility.get_setting('view_id_videos') + ')') xbmcplugin.endOfDirectory(plugin_handle) else: delete.cookies() utility.log('User is not logged in.', loglevel=xbmc.LOGERROR) utility.notification(utility.get_string(30303))
def main(video_type): add.directory(utility.get_string(30104), 'my-list', 'list_videos', '', video_type) add.directory(utility.get_string(30105), '', 'list_viewing_activity', '', video_type) add.directory(utility.get_string(30106), 'recently-added', 'list_videos', '', video_type) if video_type == 'tv': add.directory(utility.get_string(30107), 'genre?83', 'list_videos', '', video_type) add.directory(utility.get_string(30108), '', 'list_genres', '', video_type) else: add.directory(utility.get_string(30108), '', 'list_genres', '', video_type) add.directory(utility.get_string(30109), '', 'search', '', video_type) xbmcplugin.endOfDirectory(plugin_handle)