def parentalPin(): input = kodi.get_keyboard('Please Set Password', hidden=True) if (not input): kodi.dialog.ok(kodi.get_name(), "Sorry, no password was entered.") sys.exit(0) pass_one = input input = kodi.get_keyboard('Please Confirm Your Password', hidden=True) if (not input): kodi.dialog.ok(kodi.get_name(), "Sorry, no password was entered.") sys.exit(0) pass_two = input if pass_one == pass_two: writeme = hashlib.sha256(pass_one).hexdigest() addEntry(writeme, None) kodi.dialog.ok(kodi.get_name(), 'Parental control has been enabled.') xbmc.executebuiltin("Container.Refresh") else: kodi.dialog.ok(kodi.get_name(), 'The passwords do not match, please try again.') sys.exit(0)
def prompt_for_link(old_link='', old_name=''): if old_link.endswith('\n'): old_link = old_link[:-1] if old_name.endswith('\n'): old_name = old_name[:-1] new_link = kodi.get_keyboard('Edit Link', old_link) if new_link is None: return new_name = kodi.get_keyboard('Enter Name', old_name) if new_name is None: return if new_name: return (new_link, new_name) else: return (new_link, )
def parentalOff(): input = kodi.get_keyboard('Please Enter Your Password', hidden=True) if ( not input ): kodi.dialog.ok(kodi.get_name(),"Sorry, no password was entered.") sys.exit(0) pass_one = hashlib.sha256(input).hexdigest() conn = sqlite3.connect(parentaldb) conn.text_factory = str c = conn.cursor() c.execute("SELECT * FROM parental") for (passwd, timest) in c.fetchall(): timestamp = timest password = passwd conn.close() if password == pass_one: try: try: os.remove(parentaldb) except: pass kodi.dialog.ok(kodi.get_name(),'Parental controls have been disabled.') xbmc.executebuiltin("Container.Refresh") except: kodi.dialog.ok(kodi.get_name(),'There was an error disabling the parental controls.') xbmc.executebuiltin("Container.Refresh") else: kodi.dialog.ok(kodi.get_name(),"Sorry, the password you entered was incorrect.") quit()
def getMatches(url): if url == 'search': term = kodi.get_keyboard(heading='Search Our Match') if term: c = client.request('http://ourmatch.net/?s=%s' % term.lower().replace(' ', '+')) else: quit() else: c = client.request(url) r = dom_parser2.parse_dom(c, 'div', {'class': 'vidthumb'}) r = [(dom_parser2.parse_dom(i, 'span', {'class': 'time'}), \ dom_parser2.parse_dom(i, 'a', req=['href','title']), \ dom_parser2.parse_dom(i, 'img', req='src')) for i in r if i] r = [(re.sub('<.+?>', '', i[0][0].content), i[1][0].attrs['title'], i[1][0].attrs['href'], i[2][0].attrs['src']) for i in r] for i in r: addDir('%s - %s' % (i[0], i[1]), i[2], 4, i[3]) try: np = re.findall('''<link\s*rel=['"]next['"]\s*href=['"]([^'"]+)''', c)[0] addDir('Next Page -->', np, 3, art + 'nextpage.png') except: pass
def create_dir(path, dir_name=None): if dir_name is None: dir_name = kodi.get_keyboard('Enter Directory Name') if dir_name is None: return try: os.mkdir(os.path.join(path, dir_name)) except OSError as e: kodi.notify(msg=e.strerror) kodi.refresh_container()
def searchUser(): user = kodi.get_keyboard('Enter Username') if user: user = user.replace(' ','_') url = 'https://chaturbate.com/' + user iconimg = 'https://roomimg.stream.highwebmedia.com/ri/' + user + '.jpg' url += '|SPLIT|Chaturbate' player.resolve_url(url,user,iconimg) else: kodi.dialog.ok(kodi.get_name(), 'No username entered. Please try again.') quit()
def parentalCheck(): timestamp = None password = None conn = sqlite3.connect(parentaldb) conn.text_factory = str c = conn.cursor() c.execute("SELECT * FROM parental") for (passwd, timest) in c.fetchall(): timestamp = timest password = passwd conn.close() session_time = int(kodi.get_setting('session_time')) if password: try: now = time.time() check = now - 60 * session_time if (not timestamp): timestamp = 0 except: now = time.time() check = now - 60 * session_time timestamp = 0 else: return if (timestamp < check): input = kodi.get_keyboard( 'Please Enter Your Password - %s' % kodi.giveColor( '(%s Minute Session)' % str(session_time), 'red', True), hidden=True) if (not input): sys.exit(0) pass_one = hashlib.sha256(input).hexdigest() if password != pass_one: kodi.dialog.ok(kodi.get_name(), "Sorry, the password you entered was incorrect.") sys.exit(0) else: delEntry(password) addEntry(password, now) kodi.dialog.ok( kodi.get_name(), 'Login successful!', 'You now have a %s minute session before you will be asked for the password again.' % str(session_time)) return
def rename_dir(path, dir_name, new_name=None): if new_name is None: new_name = kodi.get_keyboard('Enter Directory Name', dir_name) if new_name is None: return old_path = os.path.join(path, dir_name) new_path = os.path.join(path, new_name) try: os.rename(old_path, new_path) except OSError as e: kodi.notify(msg=e.strerror) kodi.refresh_container()
def followUser(): user = kodi.get_keyboard('Enter Username') if user: user = user.replace(' ', '_') xbmc.executebuiltin("ActivateWindow(busydialog)") conn = sqlite3.connect(chaturbatedb) conn.text_factory = str c = conn.cursor() c.execute("SELECT name FROM chaturbate") e = [i for i in c.fetchall()] conn.close() if user in str(e): kodi.dialog.ok(kodi.get_name(), user + ' is already being monitored.') xbmc.executebuiltin("Dialog.Close(busydialog)") quit() url = 'https://chaturbate.com/' + user try: r = client.request(url) except: xbmc.executebuiltin("Dialog.Close(busydialog)") kodi.dialog.ok( kodi.get_name(), 'We could not find any model matching the username ' + user + '. Please check the username and try again.') quit() if not 'Bio and Free Webcam' in r: xbmc.executebuiltin("Dialog.Close(busydialog)") dialog.ok( kodi.get_name(), 'We could not find any model matching the username ' + user + '. Please check the username and try again.') quit() else: iconimg = 'https://roomimg.stream.highwebmedia.com/ri/' + user + '.jpg' addPerformer(user, url, iconimg) kodi.dialog.ok(kodi.get_name(), user + ' has been added to the monitor list.') xbmc.executebuiltin("Dialog.Close(busydialog)") xbmc.executebuiltin('Container.Refresh') quit() else: kodi.dialog.ok(kodi.get_name(), 'No username entered. Please try again.') xbmc.executebuiltin("Dialog.Close(busydialog)") quit()
def _do_recaptcha(self, key, tries=None, max_tries=None): challenge_url = CAPTCHA_BASE_URL + '/challenge?k=%s' % (key) html = self._cached_http_get(challenge_url, CAPTCHA_BASE_URL, timeout=DEFAULT_TIMEOUT, cache_limit=0) match = re.search("challenge\s+\:\s+'([^']+)", html) captchaimg = 'http://www.google.com/recaptcha/api/image?c=%s' % (match.group(1)) img = xbmcgui.ControlImage(450, 0, 400, 130, captchaimg) wdlg = xbmcgui.WindowDialog() wdlg.addControl(img) wdlg.show() header = 'Type the words in the image' if tries and max_tries: header += ' (Try: %s/%s)' % (tries, max_tries) solution = kodi.get_keyboard(header) if not solution: raise Exception('You must enter text in the image to access video') wdlg.close() return {'recaptcha_challenge_field': match.group(1), 'recaptcha_response_field': solution}
def do_recaptcha(scraper, key, tries=None, max_tries=None): challenge_url = CAPTCHA_BASE_URL + '/challenge?k=%s' % (key) html = scraper._cached_http_get(challenge_url, CAPTCHA_BASE_URL, timeout=DEFAULT_TIMEOUT, cache_limit=0) match = re.search("challenge\s+\:\s+'([^']+)", html) captchaimg = 'http://www.google.com/recaptcha/api/image?c=%s' % (match.group(1)) img = xbmcgui.ControlImage(450, 0, 400, 130, captchaimg) wdlg = xbmcgui.WindowDialog() wdlg.addControl(img) wdlg.show() header = 'Type the words in the image' if tries and max_tries: header += ' (Try: %s/%s)' % (tries, max_tries) solution = kodi.get_keyboard(header) if not solution: raise Exception('You must enter text in the image to access video') wdlg.close() return {'recaptcha_challenge_field': match.group(1), 'recaptcha_response_field': solution}
def mainSearch(url): if '|SPLIT|' in url: url,site = url.split('|SPLIT|') term = url if term == "null": term = kodi.get_keyboard('Search %s' % kodi.get_name()) if term: search_on_off = kodi.get_setting("search_setting") if search_on_off == "true": delTerm(term) addTerm(term) display_term = term term = urllib.quote_plus(term) term = term.lower() if site=='all': sources = __all__ ; search_sources = [] for i in sources: try: if eval(i + ".search_tag") == 1: search_sources.append(i) except: pass if search_sources: i = 0 source_num = 0 failed_list = '' line1 = kodi.giveColor('Searching: ','white') + kodi.giveColor('%s','dodgerblue') line2 = kodi.giveColor('Found: %s videos','white') line3 = kodi.giveColor('Source: %s of ' + str(len(search_sources)),'white') kodi.dp.create(kodi.get_name(),'',line2,'') xbmc.executebuiltin('Dialog.Close(busydialog)') for u in sorted(search_sources): if kodi.dp.iscanceled(): break try: i += 1 progress = 100 * int(i)/len(search_sources) kodi.dp.update(progress, line1 % u.title(),line2 % str(source_num),line3 % str(i)) search_url = eval(u + ".search_base") % term try: source_n = eval(u+".content('%s',True)" % search_url) except: source_n = 0 try: source_n = int(source_n) except: source_n = 0 if ( not source_n ): if failed_list == '': failed_list += str(u).title() else: failed_list += ', %s' % str(u).title() else: source_num += int(source_n) except: pass kodi.dp.close() if failed_list != '': kodi.notify(msg='%s failed to return results.' % failed_list, duration=4000, sound=True) log_utils.log('Scrapers failing to return search results are :: : %s' % failed_list, log_utils.LOGERROR) else: kodi.notify(msg='%s results found.' % str(source_num), duration=4000, sound=True) xbmcplugin.setContent(kodi.syshandle, 'movies') xbmcplugin.endOfDirectory(kodi.syshandle, cacheToDisc=True) utils.setView('search') else: search_url = eval(site + ".search_base") % term eval(site + ".content('%s')" % search_url) else: kodi.notify(msg='Blank searches are not allowed.') quit()