def show_loading_progress(run_as_widget): loading_progress = None if not run_as_widget: loading_progress = xbmcgui.DialogProgress() loading_progress.create('Netflix', generic_utility.get_string(30205) + '...') generic_utility.progress_window(loading_progress, 0, '...') return loading_progress
def load_data(metadatas, video_type, run_as_widget, loading_progress, is_episode=False, viewing_activity=False): video_add_args = [] lock = thread.allocate_lock() max_threads = 4 threads = [None] * max_threads rets = [None] * max_threads size = 0 thread_id = 0 for metadata in metadatas: if (thread_id == max_threads): # utility.log('max reached, waiting for join') for thread_id in range(len(threads)): threads[thread_id].join() video_add_args.append(rets[thread_id]) threads[thread_id] = None rets[thread_id] = None # utility.log('all joined') thread_id = 0 # utility.log(video_id) threads[thread_id] = threading.Thread(target=load_match, args=(thread_id, lock, rets, metadata, is_episode, viewing_activity)) threads[thread_id].start() # utility.log('thread '+str(i)+' started') size += 1 if not run_as_widget: generic_utility.progress_window(loading_progress, size * 100 / len(metadata), 'processing...') thread_id += 1 for thread_id in range(len(threads)): if threads[thread_id] != None: threads[thread_id].join() video_add_args.append(rets[thread_id]) threads[thread_id] = None rets[thread_id] = None # utility.log('all joined') return video_add_args
def search(search_string, video_type, run_as_widget=False): loading_progress = None if not run_as_widget: loading_progress = xbmcgui.DialogProgress() loading_progress.create('Netflix', generic_utility.get_string(30205) + '...') generic_utility.progress_window(loading_progress, 0, '...') xbmcplugin.setContent(plugin_handle, 'movies') metadatas = get.videos_in_search(search_string) # video_ids = get.search_matches(search_string, video_type) add_videos_to_directory(loading_progress, run_as_widget, metadatas, video_type, 0, '') if generic_utility.get_setting('force_view') and not run_as_widget: xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_videos') + ')') xbmcplugin.endOfDirectory(plugin_handle)
def login(): if not test: login_progress = xbmcgui.DialogProgress() login_progress.create('Netflix', generic_utility.get_string(30200) + '...') generic_utility.progress_window(login_progress, 25, generic_utility.get_string(30201)) content = connect.load_netflix_site(generic_utility.main_url + 'Login', new_session=True, login_process=True) if not 'Sorry, Netflix ' in content: match = re.compile('locale: "(.+?)"', re.DOTALL|re.UNICODE).findall(content) locale = None if(len(match)) == 0: match = re.compile('"pageName":"login","locale":"(.+?)"', re.DOTALL|re.UNICODE).findall(content) if(len(match)) == 0: generic_utility.error('Cannot find locale on page. content: '+content) login_url = 'Login' else: locale = match[0] login_url = 'Login?locale=' + locale else: locale = match[0] login_url = 'Login?locale=' + locale generic_utility.set_setting('language', locale) post_data = {'authURL': generic_utility.get_setting('authorization_url'), 'email': generic_utility.get_setting('username'), 'password': generic_utility.get_setting('password'), 'RememberMe': 'on'} if not test: generic_utility.progress_window(login_progress, 50, generic_utility.get_string(30202)) content = connect.load_netflix_site( generic_utility.main_url + login_url, post=post_data, login_process=True) if 'id="page-LOGIN"' in content: if not test: generic_utility.notification(generic_utility.get_string(30303)) return False parse_data_set_cookies(content) if not test: generic_utility.progress_window(login_progress, 75, generic_utility.get_string(30203)) profile_selection() if login_progress: if not test: if not generic_utility.progress_window(login_progress, 100, generic_utility.get_string(30204)): return False xbmc.sleep(500) login_progress.close() return True else: if not test: generic_utility.notification(generic_utility.get_string(30300)) if login_progress: login_progress.close() return False
def load_data(metadatas, video_type, run_as_widget, loading_progress, viewing_activity=False): video_add_args = [] lock = thread.allocate_lock() max_threads = 4 threads = [None] * max_threads rets = [None] * max_threads size = 0 thread_id = 0 for metadata in metadatas: if thread_id == max_threads: # utility.log('max reached, waiting for join') for thread_id in range(len(threads)): threads[thread_id].join() video_add_args.append(rets[thread_id]) threads[thread_id] = None rets[thread_id] = None # utility.log('all joined') thread_id = 0 # utility.log(video_id) threads[thread_id] = threading.Thread( target=load_match, args=(thread_id, lock, rets, metadata, viewing_activity) ) threads[thread_id].start() # utility.log('thread '+str(i)+' started') size += 1 if not run_as_widget: generic_utility.progress_window(loading_progress, size * 100 / len(metadata), "processing...") thread_id += 1 for thread_id in range(len(threads)): if threads[thread_id] != None: threads[thread_id].join() video_add_args.append(rets[thread_id]) threads[thread_id] = None rets[thread_id] = None # utility.log('all joined') return video_add_args
def login(): login_progress = xbmcgui.DialogProgress() login_progress.create('Netflix', generic_utility.get_string(30200) + '...') generic_utility.progress_window(login_progress, 25, generic_utility.get_string(30201)) content = connect.load_netflix_site(generic_utility.main_url + 'Login', new_session=True) if not 'Sorry, Netflix ' in content: match = re.compile('name="authURL" value="(.+?)"', re.DOTALL | re.UNICODE).findall(content) # utility.log('Setting authorization url: ' + match[0]) generic_utility.set_setting('authorization_url', match[0]) match = re.compile('locale: "(.+?)"', re.DOTALL | re.UNICODE).findall(content) generic_utility.set_setting('language', match[0]) post_data = { 'authURL': generic_utility.get_setting('authorization_url'), 'email': generic_utility.get_setting('username'), 'password': generic_utility.get_setting('password'), 'RememberMe': 'on' } generic_utility.progress_window(login_progress, 50, generic_utility.get_string(30202)) content = connect.load_netflix_site( generic_utility.main_url + 'Login?locale=' + generic_utility.get_setting('language'), post=post_data) # utility.log(content) if 'id="page-LOGIN"' in content: generic_utility.notification(generic_utility.get_string(30303)) return False match = re.compile('"apiUrl":"(.+?)",', re.UNICODE).findall(content) generic_utility.set_setting('api_url', match[0]) connect.set_chrome_netflix_cookies() generic_utility.progress_window(login_progress, 75, generic_utility.get_string(30203)) profile_selection() if login_progress: if not generic_utility.progress_window( login_progress, 100, generic_utility.get_string(30204)): return False xbmc.sleep(500) login_progress.close() return True else: generic_utility.notification(generic_utility.get_string(30300)) if login_progress: login_progress.close() return False
def login(): login_progress = xbmcgui.DialogProgress() login_progress.create('Netflix', generic_utility.get_string(30200) + '...') generic_utility.progress_window(login_progress, 25, generic_utility.get_string(30201)) content = connect.load_netflix_site(generic_utility.main_url + 'Login', new_session=True) if not 'Sorry, Netflix ' in content: match = re.compile('name="authURL" value="(.+?)"', re.DOTALL| re.UNICODE).findall(content) # utility.log('Setting authorization url: ' + match[0]) generic_utility.set_setting('authorization_url', match[0]) match = re.compile('locale: "(.+?)"', re.DOTALL|re.UNICODE).findall(content) generic_utility.set_setting('language', match[0]) post_data = {'authURL': generic_utility.get_setting('authorization_url'), 'email': generic_utility.get_setting('username'), 'password': generic_utility.get_setting('password'), 'RememberMe': 'on'} generic_utility.progress_window(login_progress, 50, generic_utility.get_string(30202)) content = connect.load_netflix_site( generic_utility.main_url + 'Login?locale=' + generic_utility.get_setting('language'), post=post_data) # utility.log(content) if 'id="page-LOGIN"' in content: generic_utility.notification(generic_utility.get_string(30303)) return False match = re.compile('"apiUrl":"(.+?)",', re.UNICODE).findall(content) generic_utility.set_setting('api_url', match[0]) connect.set_chrome_netflix_cookies() generic_utility.progress_window(login_progress, 75, generic_utility.get_string(30203)) profile_selection() if login_progress: if not generic_utility.progress_window(login_progress, 100, generic_utility.get_string(30204)): return False xbmc.sleep(500) login_progress.close() return True else: generic_utility.notification(generic_utility.get_string(30300)) if login_progress: login_progress.close() return False
def login(): if not test: login_progress = xbmcgui.DialogProgress() login_progress.create("Netflix", generic_utility.get_string(30200) + "...") generic_utility.progress_window(login_progress, 25, generic_utility.get_string(30201)) content = connect.load_netflix_site(generic_utility.main_url + "Login", new_session=True, login_process=True) if "Sorry, Netflix " not in content: match = re.compile('locale: "(.+?)"', re.DOTALL | re.UNICODE).findall(content) locale = None if (len(match)) == 0: match = re.compile('"pageName":"login","locale":"(.+?)"', re.DOTALL | re.UNICODE).findall(content) if (len(match)) == 0: generic_utility.error("Cannot find locale on page. content: " + content) login_url = "Login" else: locale = match[0] login_url = "Login?locale=" + locale else: locale = match[0] login_url = "Login?locale=" + locale generic_utility.set_setting("language", locale) post_data = { "authURL": generic_utility.get_setting("authorization_url"), "email": generic_utility.get_setting("username"), "password": generic_utility.get_setting("password"), "rememberMe": "true", "flow": "websiteSignUp", "mode": "loginPassword", "action": "loginAction", "withFields": "email,password,rememberMe,nextPage", "nextPage": "", } if not test: generic_utility.progress_window(login_progress, 50, generic_utility.get_string(30202)) content = connect.load_netflix_site(generic_utility.main_url + login_url, post=post_data, login_process=True) if 'id="page-LOGIN"' in content: if not test: generic_utility.notification(generic_utility.get_string(30303)) return False parse_data_set_cookies(content) if not test: generic_utility.progress_window(login_progress, 75, generic_utility.get_string(30203)) profile_selection() if login_progress: if not test: if not generic_utility.progress_window(login_progress, 100, generic_utility.get_string(30204)): return False xbmc.sleep(500) login_progress.close() return True else: if not test: generic_utility.notification(generic_utility.get_string(30300)) if login_progress: login_progress.close() return False