rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
self.log.debug("Netload: APIDATA: "+src.strip())
|
self.log.debug("Netload: APIDATA: "+src)
|
def download_api_data(self, n=0): url = self.url id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)") match = id_regex.search(url) if match: apiurl = "http://netload.in/share/fileinfos2.php" src = self.load(apiurl, cookies=False, get={"file_id": match.group(1)}).strip() if not src and n < 3: sleep(0.2) self.download_api_data(n+1) return else: self.fail(_("No API Data was send"))
|
try: t, j = self.queue.get() except IndexError:
|
t, j = self.queue.get() if not j:
|
def work(self): while True: try: t, j = self.queue.get() except IndexError: break else: if t <= time(): j.start() else: self.queue.put((t, j)) break
|
tessparams = ['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")
|
tessparams = ['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")]
|
def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True ): self.logger.debug("create tmp tif") tmp = tempfile.NamedTemporaryFile(suffix=".tif") self.logger.debug("create tmp txt") tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") self.logger.debug("save tiff") self.image.save(tmp.name, 'TIFF')
|
self.response(line)
|
self.response(line, msg["origin"])
|
def handle_events(self, msg): if msg["origin"].split("!", 1)[0] != self.owner: return if msg["target"].split("!", 1)[0] != self.nick: return if msg["action"] != "PRIVMSG": return # HANDLE CTCP ANTI FLOOD/BOT PROTECTION if msg["text"] == "\x01VERSION\x01": self.log.debug("Sending CTCP VERSION.") self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) return elif msg["text"] == "\x01TIME\x01": self.log.debug("Sending CTCP TIME.") self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) return elif msg["text"] == "\x01LAG\x01": self.log.debug("Received CTCP LAG.") # don't know how to answer return trigger = "pass" args = None temp = msg["text"].split() trigger = temp[0] if len(temp) > 1: args = temp[1:] handler = getattr(self, "event_%s" % trigger, self.event_pass) try: res = handler(args) for line in res: self.response(line) except Exception, e: self.log.error("pyLoadIRC: "+ repr(e))
|
def response(self, msg): for t in self.getConf("owner").split(): self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg))
|
def response(self, msg, origin=""): if origin == "": for t in self.getConf("owner").split(): self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg)) else: self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg))
|
def response(self, msg): for t in self.getConf("owner").split(): self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg))
|
self.logger.info(_("Free space: %sMB") % self.freeSpace())
|
self.logger.info(_("Free space: %sMB") % freeSpace)
|
def start(self): """ starts the machine"""
|
__import__("ctypes").windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes))
|
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes))
|
def freeSpace(self): folder = self.make_path(self.config['general']['download_folder']) if platform == 'nt': free_bytes = ctypes.c_ulonglong(0) __import__("ctypes").windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes)) return free_bytes.value / 1024 / 1024 #megabyte else: from os import statvfs s = statvfs(folder) return s.f_bsize * s.f_bavail / 1024 / 1024 #megabyte
|
premkbleft = int(fields[19].split("=")[1])
|
premkbleft = int(fields[18].split("=")[1])
|
def download_api_data(self): """ http://images.rapidshare.com/apidoc.txt """ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_file = {"sub": "checkfiles_v1", "files": "", "filenames": "", "incmd5": "1"} m = re.compile(self.props['pattern']).search(self.url) if m: api_param_file["files"] = m.group(1) api_param_file["filenames"] = m.group(2) src = self.req.load(api_url_base, cookies=False, get=api_param_file) if src.startswith("ERROR"): return fields = src.split(",") self.api_data = {} self.api_data["fileid"] = fields[0] self.api_data["filename"] = fields[1] self.api_data["size"] = fields[2] # in bytes self.api_data["serverid"] = fields[3] self.api_data["status"] = fields[4] """ status codes: 0=File not found 1=File OK (Downloading possible without any logging) 2=File OK (TrafficShare direct download without any logging) 3=Server down 4=File marked as illegal 5=Anonymous file locked, because it has more than 10 downloads already 6=File OK (TrafficShare direct download with enabled logging) """ self.api_data["shorthost"] = fields[5] self.api_data["checksum"] = fields[6].strip().lower() # md5 self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
|
raise Exception data["port"] = coreparser.get("remote","port") data["user"] = coreparser.get("remote","username") data["password"] = coreparser.get("remote","password") data["host"] = "127.0.0.1" data["ssl"] = coreparser.get("ssl","activated")
|
data["port"] = 7227 data["user"] = "admin" data["password"] = "pwhere" data["host"] = "127.0.0.1" data["ssl"] = False else: data["port"] = coreparser.get("remote","port") data["user"] = coreparser.get("remote","username") data["password"] = coreparser.get("remote","password") data["host"] = "127.0.0.1" data["ssl"] = coreparser.get("ssl","activated")
|
def slotConnect(self, data): """ connect to a core if connection is local, parse the core config file for data set up connector, show main window """ self.connWindow.hide() if not data["type"] == "remote":
|
now = time.localtime()[3:5]
|
now = list(time.localtime()[3:5])
|
def compare_time(self, start, end): start = map(int, start) end = map(int, end) if start == end: return True
|
dump += "HTML DUMP:\n\n %s" % pyfile.plugin.html
|
dump += "HTML DUMP:\n\n %s" % pformat(pyfile.plugin.html)
|
def run(self): """run method"""
|
self.list.packager.pushPackage2Queue(pid)
|
def jobFinished(self, pyfile): """manage completing download""" self.lock.acquire()
|
|
for match in matches: self.slotAddLinks([str(match.group(0))])
|
links = [str(match.group(0)) for match in matches] if len(links) == 0: return filenames = [link.rpartition("/")[2] for link in links] packagename = commonprefix(filenames) if len(packagename) == 0: packagename = filenames[0] self.slotAddPackage(packagename, links)
|
def slotClipboardChange(self): """ called if clipboard changes """ if self.checkClipboard: text = self.clipboard.text() pattern = re.compile(r"(http|https|ftp)://[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?/.*)?") matches = pattern.finditer(text) for match in matches: self.slotAddLinks([str(match.group(0))])
|
if option in ("-C", "--configfile="):
|
if option in ("-C", "--configdir"):
|
def __init__(self): self.doDebug = False self.arg_links = [] self.path = abspath(dirname(__file__)) chdir(self.path) self.homedir = self.getHomeDir()
|
captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False)
|
try: captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) except TypeError: captcha_image_name = os.path.join(tempfile.gettempdir(), "pyload_tmp_%d"%time()) captcha_image = open(captcha_image_name, "w+b")
|
def download_html(self): if self.config['premium']: post_vars = {"act": "login", "location": "service.php", "dieseid": "", "user": self.config['username'], "pass": self.config['password'], "login":"Log+me+in", "folder_autologin":"1"} self.load("http://www.share-online.biz/login.php", cookies=True, post=post_vars) url = self.parent.url self.html[0] = self.load(url, cookies=True) if not self.config['premium']: #captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
|
captcha = self.ocr.get_captcha(captcha_image.name) os.remove(captcha_image.name)
|
try: captcha = self.ocr.get_captcha(captcha_image.name) os.remove(captcha_image.name) except AttributeError: captcha = self.ocr.get_captcha(captcha_image_name) os.remove(captcha_image_name)
|
def download_html(self): if self.config['premium']: post_vars = {"act": "login", "location": "service.php", "dieseid": "", "user": self.config['username'], "pass": self.config['password'], "login":"Log+me+in", "folder_autologin":"1"} self.load("http://www.share-online.biz/login.php", cookies=True, post=post_vars) url = self.parent.url self.html[0] = self.load(url, cookies=True) if not self.config['premium']: #captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
|
uid = getpwnam(self.config["permission"]["user"]) gid = getgrnam(self.config["permission"]["group"])
|
uid = getpwnam(self.config["permission"]["user"])[2] gid = getgrnam(self.config["permission"]["group"])[2]
|
def download(self, url, get={}, post={}, ref=True, cookies=True): """ downloads the url content to disk """
|
if line.find(":", comment) < 0 and line.find("=", comment) < 0:
|
if line.find(":", comment) < 0 and line.find("=", comment) < 0 and comment > 0:
|
def parseConfig(self, config): """parses a given configfile""" f = open(config) config = f.read()
|
typ, none, option = content.rpartition(" ")
|
typ, none, option = content.strip().rpartition(" ")
|
def parseConfig(self, config): """parses a given configfile""" f = open(config) config = f.read()
|
if freeSpace > 10000: self.logger.info(_("Free space: %sGB") % (freeSpace / 1000))
|
if freeSpace > 10 * 1024: self.logger.info(_("Free space: %sGB") % (freeSpace / 1024))
|
def start(self): """ starts the machine"""
|
if i == 0: self.waitUntil = time() else: self.waitUntil = t self.log.info(_("Netload: waiting for captcha %d s.") % (self.waitUntil - time()))
|
if i == 0: self.pyfile.waitUntil = time() else: self.pyfile.waitUntil = t self.log.info(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time()))
|
def download_html(self): self.log.debug("Netload: Entering download_html") page = self.load(self.url) t = time() + 30
|
self.accounts[plugin][name]["options"][option[0]] = True if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:])
|
self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:])
|
def loadAccounts(self): """loads all accounts available""" if not exists("accounts.conf"): f = open("accounts.conf", "wb") f.write("version: " + str(ACC_VERSION)) f.close() f = open("accounts.conf", "rb") content = f.readlines() version = content.pop(0) version = version.split(":")[1].strip()
|
for user,data in accounts:
|
for user,data in accounts.iteritems():
|
def config(request): conf = settings.PYLOAD.get_config() plugin = settings.PYLOAD.get_plugin_config() accs = settings.PYLOAD.get_accounts() messages = [] for section in chain(conf.itervalues(), plugin.itervalues()): for key, option in section.iteritems(): if key == "desc": continue if ";" in option["type"]: option["list"] = option["type"].split(";") if request.META.get('REQUEST_METHOD', "GET") == "POST": errors = [] for key, value in request.POST.iteritems(): if not "|" in key: continue sec, skey, okey = key.split("|")[:] if sec == "General": if conf.has_key(skey): if conf[skey].has_key(okey): try: if str(conf[skey][okey]['value']) != value: settings.PYLOAD.set_conf_val(skey, okey, value) except Exception, e: errors.append("%s | %s : %s" % (skey, okey, e)) else: continue else: continue elif sec == "Plugin": if plugin.has_key(skey): if plugin[skey].has_key(okey): try: if str(plugin[skey][okey]['value']) != value: settings.PYLOAD.set_conf_val(skey, okey, value, "plugin") except Exception, e: errors.append("%s | %s : %s" % (skey, okey, e)) else: continue else: continue elif sec == "Accounts": if ";" in okey: action, name = okey.split(";") if action == "delete": settings.PYLOAD.remove_account(skey, name) elif action == "password": for acc in accs[skey]: if acc["login"] == name and value.strip(): settings.PYLOAD.update_account(skey, name, value) elif okey == "newacc" and value: # add account pw = request.POST.get("Accounts|%s|newpw" % skey) settings.PYLOAD.update_account(skey, value, pw) if errors: messages.append(_("Error occured when setting the following options:")) messages.append("") messages += errors else: messages.append(_("All options were set correctly.")) accs = settings.PYLOAD.get_accounts() for plugin,accounts in accs.iteritems(): for user,data in accounts: if data["trafficleft"] == -1: data["trafficleft"] = _("unlimited") elif not data["trafficleft"]: data["trafficleft"] = "" if data["validuntil"] == -1: data["validuntil"] = _("unlimited") elif not data["validuntil"]: data["validuntil"] = "" else: t = localtime(data["validuntil"]) data["validuntil"] = strftime("%d-%m-%Y",t) return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {'Plugin':plugin, 'General':conf, 'Accounts': accs}, 'errors': messages}, [status_proc]))
|
m = re.search(r'Attention! You used up your limit for file downloading! Please try in\s+(\d+)', self.html)
|
m = re.search(r'<span class="html_download_api-limit_interval">(\d+)</span>', self.html)
|
def handleFree(self): tmp_url = self.pyfile.url match = re.search(r"depositfiles.com/(?:(?P<lang>[\w]{1,3})/)?files/(?P<id>[\w]+)", tmp_url) if match: if match.group("id"): tmp_url = "http://depositfiles.com/en/files/" + match.group("id")
|
self.log.info( "%s: Traffic used up. Waiting %d minutes." % (self.__name__, wait_time) ) self.setWait(wait_time * 60 + 61)
|
self.log.info( "%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time) ) self.setWait(wait_time) if wait_time > 300: self.wantReconnect = True
|
def handleFree(self): tmp_url = self.pyfile.url match = re.search(r"depositfiles.com/(?:(?P<lang>[\w]{1,3})/)?files/(?P<id>[\w]+)", tmp_url) if match: if match.group("id"): tmp_url = "http://depositfiles.com/en/files/" + match.group("id")
|
self.retry()
|
def downloadHTML(self): self.html = self.load(self.pyfile.url, cookies=True) if not self.account: html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True) if re.search(r"/failure/full/1", self.req.lastEffectiveURL): self.setWait(120) self.log.info("%s: no free slots, waiting 120 seconds" % (self.__name__)) self.wait() self.retry() return True # captcha = self.decryptCaptcha("http://www.share-online.biz/captcha.php", get={"rand":"0.%s" % random.randint(10**15,10**16)}, cookies=True) # self.log.debug("%s Captcha: %s" % (self.__name__, captcha)) # sleep(3) # html = self.load(self.pyfile.url, post={"captchacode": captcha}, cookies=True) # return True #m = re.search("var timeout='(\d+)';", self.html[1]) #self.waitUntil = time() + int(m.group(1)) if m else 30 # if r"Der Download ist Ihnen zu langsam" in html: # return True
|
|
args.extend(cargs)
|
args+=tuple(cargs)
|
def callback(self, *args, **kwargs): if self.result: raise AlreadyCalled self.result = (args, kwargs) for f, cargs, ckwargs in self.call: args.extend(cargs) kwargs.update(ckwargs) callInThread(f, *args, **kwargs)
|
dl_dict = self.freeWait() download = "http://%(host)s/cgi-bin/rsapi.cgi?sub=download_v1&editparentlocation=1&bin=1&fileid=%(id)s&filename=%(name)s&dlauth=%(auth)s
|
self.dl_dict = self.freeWait() download = "http://%(host)s/cgi-bin/rsapi.cgi?sub=download_v1&editparentlocation=1&bin=1&fileid=%(id)s&filename=%(name)s&dlauth=%(auth)s
|
def handleFree(self):
|
self.offset += 5
|
sleep(5)
|
def postCheck(self, dl):
|
if pid or pyfile.package.data["id"]: self.list.packager.pushPackage2Queue(pyfile.package.data["id"] or pid)
|
if pyfile.package.data["id"] or pid: self.list.packager.pushPackage2Queue(pyfile.package.data["id"] or pid)
|
def jobFinished(self, pyfile): """manage completing download""" self.lock.acquire()
|
print "pycurl error", code, msg
|
pyfile.setStatus("failed") self.m.log.error("pycurl error %s: %s" (code, msg))
|
def run(self): """run method"""
|
if between_wait:
|
if "You need RapidPro to download more files from your IP address" in result: self.setWait(60) self.log.info(_("Already downloading from this ip address, waiting 60 seconds")) self.wait() elif between_wait:
|
def freeWait(self): """downloads html with the important informations """ self.html[1] = self.load(self.pyfile.url) self.no_download = True
|
self.setWait(int(data[2]))
|
self.setWait(int(data[2])+1)
|
def freeWait(self): """downloads html with the important informations """ self.html[1] = self.load(self.pyfile.url) self.no_download = True
|
page = False
|
def download_html(self): self.log.debug("Netload: Entering download_html") page = self.load(self.url)
|
|
self.log.info(_("Netload: waiting for captcha %d s." % wait)) self.setWait(wait)
|
else: self.waitUntil = time self.log.info(_("Netload: waiting for captcha %d s." % t - time()))
|
def download_html(self): self.log.debug("Netload: Entering download_html") page = self.load(self.url)
|
if not self.data[section]["options"][option]["input"]:
|
try: if not self.data[section]["options"][option]["input"]: return [] return self.data[section]["options"][option]["input"].split(";") except:
|
def getInputValues(self, section, option): if not self.data[section]["options"][option]["input"]: return [] return self.data[section]["options"][option]["input"].split(";")
|
return self.data[section]["options"][option]["input"].split(";")
|
def getInputValues(self, section, option): if not self.data[section]["options"][option]["input"]: return [] return self.data[section]["options"][option]["input"].split(";")
|
|
if pyfile.package.data["id"] or pid: self.list.packager.pushPackage2Queue(pyfile.package.data["id"] or pid)
|
def jobFinished(self, pyfile): """manage completing download""" self.lock.acquire()
|
|
for user,data in accounts.iteritems():
|
for data in accounts:
|
def config(request): conf = settings.PYLOAD.get_config() plugin = settings.PYLOAD.get_plugin_config() accs = settings.PYLOAD.get_accounts() messages = [] for section in chain(conf.itervalues(), plugin.itervalues()): for key, option in section.iteritems(): if key == "desc": continue if ";" in option["type"]: option["list"] = option["type"].split(";") if request.META.get('REQUEST_METHOD', "GET") == "POST": errors = [] for key, value in request.POST.iteritems(): if not "|" in key: continue sec, skey, okey = key.split("|")[:] if sec == "General": if conf.has_key(skey): if conf[skey].has_key(okey): try: if str(conf[skey][okey]['value']) != value: settings.PYLOAD.set_conf_val(skey, okey, value) except Exception, e: errors.append("%s | %s : %s" % (skey, okey, e)) else: continue else: continue elif sec == "Plugin": if plugin.has_key(skey): if plugin[skey].has_key(okey): try: if str(plugin[skey][okey]['value']) != value: settings.PYLOAD.set_conf_val(skey, okey, value, "plugin") except Exception, e: errors.append("%s | %s : %s" % (skey, okey, e)) else: continue else: continue elif sec == "Accounts": if ";" in okey: action, name = okey.split(";") if action == "delete": settings.PYLOAD.remove_account(skey, name) elif action == "password": for acc in accs[skey]: if acc["login"] == name and value.strip(): settings.PYLOAD.update_account(skey, name, value) elif okey == "newacc" and value: # add account pw = request.POST.get("Accounts|%s|newpw" % skey) settings.PYLOAD.update_account(skey, value, pw) if errors: messages.append(_("Error occured when setting the following options:")) messages.append("") messages += errors else: messages.append(_("All options were set correctly.")) accs = settings.PYLOAD.get_accounts() for plugin,accounts in accs.iteritems(): for user,data in accounts.iteritems(): if data["trafficleft"] == -1: data["trafficleft"] = _("unlimited") elif not data["trafficleft"]: data["trafficleft"] = "" if data["validuntil"] == -1: data["validuntil"] = _("unlimited") elif not data["validuntil"]: data["validuntil"] = "" else: t = localtime(data["validuntil"]) data["validuntil"] = strftime("%d-%m-%Y",t) return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {'Plugin':plugin, 'General':conf, 'Accounts': accs}, 'errors': messages}, [status_proc]))
|
file_url_pattern = r"<br/>\ <br/>\ <br/>\ [\t\n\r ]+<a href=\"(http://.*?)\""
|
file_url_pattern = r"<br/>\ <br/>\ <br/>\ [\t\n\r ]+<a href=\"(?P<url>http://.*?)\""
|
def get_file_url(self): self.log.debug("OneFichierCom: Getting file URL") file_url_pattern = r"<br/>\ <br/>\ <br/>\ [\t\n\r ]+<a href=\"(http://.*?)\"" m = re.search(file_url_pattern, self.html) if m is not None: url = m.group(1) self.log.debug("OneFichierCom: File URL [%s]" % url) return url
|
url = m.group(1)
|
url = m.group('url')
|
def get_file_url(self): self.log.debug("OneFichierCom: Getting file URL") file_url_pattern = r"<br/>\ <br/>\ <br/>\ [\t\n\r ]+<a href=\"(http://.*?)\"" m = re.search(file_url_pattern, self.html) if m is not None: url = m.group(1) self.log.debug("OneFichierCom: File URL [%s]" % url) return url
|
r"content=\"Téléchargement du fichier (.*?)\">", r"(>Cliquez ici pour télécharger|>Click here to download) (.*?)</a>", r"\">(Nom du fichier :|File name :)</th>[\t\r\n ]+<td>(.*?)</td>", r"<title>Download of (.*?)</title>"
|
r"\">(Nom du fichier :|File name :)</th>[\t\r\n ]+<td>(?P<name>.*?)</td>", r"(>Cliquez ici pour télécharger|>Click here to download) (?P<name>.*?)</a>", r"content=\"(Téléchargement du fichier |Download the file named )(?P<name>.*?)\">", r"<title>(Téléchargement du fichier|Download the file)\s*:\s*(?P<name>.*?)</title>"
|
def get_file_name(self): self.log.debug("OneFichierCom: Getting file name") file_name_patterns = ( r"content=\"Téléchargement du fichier (.*?)\">", r"(>Cliquez ici pour télécharger|>Click here to download) (.*?)</a>", r"\">(Nom du fichier :|File name :)</th>[\t\r\n ]+<td>(.*?)</td>", r"<title>Download of (.*?)</title>" ) for pattern in file_name_patterns: m = re.search(pattern, self.html) if m is not None: name = m.group(1).strip() self.log.debug("OneFichierCom: File name [%s]" % name) return name
|
name = m.group(1).strip()
|
name = m.group('name').strip()
|
def get_file_name(self): self.log.debug("OneFichierCom: Getting file name") file_name_patterns = ( r"content=\"Téléchargement du fichier (.*?)\">", r"(>Cliquez ici pour télécharger|>Click here to download) (.*?)</a>", r"\">(Nom du fichier :|File name :)</th>[\t\r\n ]+<td>(.*?)</td>", r"<title>Download of (.*?)</title>" ) for pattern in file_name_patterns: m = re.search(pattern, self.html) if m is not None: name = m.group(1).strip() self.log.debug("OneFichierCom: File name [%s]" % name) return name
|
if r'Your download link has expired.' in html:
|
if r'Your download link has expired' in html:
|
def handleFree(self): if r'<div id="captchaArea" style="display:none;">' in self.html or \ r'/showCaptcha\(\);' in self.html: # we got a captcha id = re.search(r"var reCAPTCHA_publickey='(.*?)';", self.html).group(1) recaptcha = ReCaptcha(self) challenge, code = recaptcha.challenge(id) shortencode = re.search(r'name="recaptcha_shortencode_field" value="(.*?)"', self.html).group(1)
|
self.load(self.pyfile.url, post={"download":"normal"}, just_header=True) dl = self.download(self.pyfile.url, post={"download":"normal"}) size = stat(dl) size = size.st_size if size < 40000: f = open(dl, "rb") content = f.read() m = re.search(r'<html>', content) if m is not None: self.setWait(720) self.wantReconnect = True self.wait() self.handleFree() return
|
html = self.load(self.pyfile.url, post={"download":"normal"}) m = re.search(r'You need to wait (\d+) seconds to start another download', html) if m: wait_time = int(m.group(1)) self.setWait(wait_time) self.log.debug("%s: You need to wait %d seconds for another download." % (self.__name__, wait_time)) self.wantReconnect = True self.wait() self.retry() self.download(self.pyfile.url, post={"download":"normal"})
|
def handleFree(self): if r'<div id="captchaArea" style="display:none;">' in self.html or \ r'/showCaptcha\(\);' in self.html: # we got a captcha id = re.search(r"var reCAPTCHA_publickey='(.*?)';", self.html).group(1) recaptcha = ReCaptcha(self) challenge, code = recaptcha.challenge(id) shortencode = re.search(r'name="recaptcha_shortencode_field" value="(.*?)"', self.html).group(1)
|
downloads = self.core.status_downloads()
|
downloads = self.sm.status_downloads()
|
def event_status(self, args): downloads = self.core.status_downloads() if len(downloads) < 1: return ["INFO: There are no active downloads currently."] lines = [] lines.append("ID - Name - Status - Speed - ETA - Progress") for data in downloads: lines.append("#%d - %s - %s - %s - %s - %s" % ( data['id'], data['name'], data['status'], "%d kb/s" % int(data['speed']), "%d min" % int(data['eta'] / 60), "%d/%d MB (%d%%)" % ((data['size']-data['kbleft']) / 1024, data['size'] / 1024, data['percent']) ) ) return lines
|
ps = self.core.get_collector()
|
ps = self.sm.get_collector()
|
def event_collector(self, args): ps = self.core.get_collector() if len(ps) == 0: return ["INFO: No packages in collector!"] lines = [] for packdata in ps: lines.append('PACKAGE: Package "%s" with id #%d' % (packdata['package_name'], packdata['id'])) for fileid in self.core.get_package_files(packdata['id']): fileinfo = self.core.get_file_info(fileid) lines.append('#%d FILE: %s (#%d)' % (packdata['id'], fileinfo["filename"], fileinfo["id"])) return lines
|
for fileid in self.core.get_package_files(packdata['id']): fileinfo = self.core.get_file_info(fileid)
|
for fileid in self.sm.get_package_files(packdata['id']): fileinfo = self.sm.get_file_info(fileid)
|
def event_collector(self, args): ps = self.core.get_collector() if len(ps) == 0: return ["INFO: No packages in collector!"] lines = [] for packdata in ps: lines.append('PACKAGE: Package "%s" with id #%d' % (packdata['package_name'], packdata['id'])) for fileid in self.core.get_package_files(packdata['id']): fileinfo = self.core.get_file_info(fileid) lines.append('#%d FILE: %s (#%d)' % (packdata['id'], fileinfo["filename"], fileinfo["id"])) return lines
|
fids = self.core.get_files()
|
fids = self.sm.get_files()
|
def event_links(self, args): fids = self.core.get_files() if len(fids) == 0: return ["INFO: No links."] lines = [] for fid in fids: info = self.core.get_file_info(fid) lines.append('LINK #%d: %s [%s]' % (fid, info["filename"], info["status_type"])) return lines
|
info = self.core.get_file_info(fid)
|
info = self.sm.get_file_info(fid)
|
def event_links(self, args): fids = self.core.get_files() if len(fids) == 0: return ["INFO: No links."] lines = [] for fid in fids: info = self.core.get_file_info(fid) lines.append('LINK #%d: %s [%s]' % (fid, info["filename"], info["status_type"])) return lines
|
pids = self.core.get_packages()
|
pids = self.sm.get_packages()
|
def event_packages(self, args): pids = self.core.get_packages() if len(pids) == 0: return ["INFO: No packages."] lines = [] for pid in pids: data = self.core.get_package_data(pid) lines.append('PACKAGE #%d: %s (%d links)' % (pid, data["package_name"], len(self.core.get_package_files(pid)))) return lines
|
data = self.core.get_package_data(pid) lines.append('PACKAGE
|
data = self.sm.get_package_data(pid) lines.append('PACKAGE
|
def event_packages(self, args): pids = self.core.get_packages() if len(pids) == 0: return ["INFO: No packages."] lines = [] for pid in pids: data = self.core.get_package_data(pid) lines.append('PACKAGE #%d: %s (%d links)' % (pid, data["package_name"], len(self.core.get_package_files(pid)))) return lines
|
info = self.core.get_file_info(int(args[0]))
|
info = self.sm.get_file_info(int(args[0]))
|
def event_info(self, args): if not args: return ['ERROR: Use info like this: info <id>'] info = self.core.get_file_info(int(args[0])) return ['LINK #%d: %s (%d) [%s bytes]' % (info['id'], info['filename'], info['size'], info['status_type'])]
|
packdata = self.core.get_package_data(int(args[0]))
|
packdata = self.sm.get_package_data(int(args[0]))
|
def event_packinfo(self, args): if not args: return ['ERROR: Use packinfo like this: packinfo <id>'] lines = [] packdata = self.core.get_package_data(int(args[0])) lines.append('PACKAGE: Package "%s" with id #%d' % (packdata['package_name'], packdata['id'])) for fileid in self.core.get_package_files(packdata['id']): fileinfo = self.core.get_file_info(fileid) lines.append('#%d LINK: %s (#%d)' % (packdata['id'], fileinfo["filename"], fileinfo["id"])) return lines
|
for fileid in self.core.get_package_files(packdata['id']): fileinfo = self.core.get_file_info(fileid)
|
for fileid in self.sm.get_package_files(packdata['id']): fileinfo = self.sm.get_file_info(fileid)
|
def event_packinfo(self, args): if not args: return ['ERROR: Use packinfo like this: packinfo <id>'] lines = [] packdata = self.core.get_package_data(int(args[0])) lines.append('PACKAGE: Package "%s" with id #%d' % (packdata['package_name'], packdata['id'])) for fileid in self.core.get_package_files(packdata['id']): fileinfo = self.core.get_file_info(fileid) lines.append('#%d LINK: %s (#%d)' % (packdata['id'], fileinfo["filename"], fileinfo["id"])) return lines
|
for packdata in self.core.get_collector_packages(): self.core.push_package_2_queue(packdata['id'])
|
for packdata in self.sm.get_collector_packages(): self.sm.push_package_2_queue(packdata['id'])
|
def event_start(self, args): if not args: count = 0 for packdata in self.core.get_collector_packages(): self.core.push_package_2_queue(packdata['id']) count += 1
|
self.core.push_package_2_queue(id)
|
self.sm.push_package_2_queue(id)
|
def event_start(self, args): if not args: count = 0 for packdata in self.core.get_collector_packages(): self.core.push_package_2_queue(packdata['id']) count += 1
|
self.core.stop_downloads()
|
self.sm.stop_downloads()
|
def event_stop(self, args): if not args: self.core.stop_downloads() return ["INFO: All downloads stopped."] lines = [] for val in args: id = int(val.strip()) self.core.stop_download("", id) lines.append("INFO: Download #%d stopped." % id) return lines
|
self.core.stop_download("", id)
|
self.sm.stop_download("", id)
|
def event_stop(self, args): if not args: self.core.stop_downloads() return ["INFO: All downloads stopped."] lines = [] for val in args: id = int(val.strip()) self.core.stop_download("", id) lines.append("INFO: Download #%d stopped." % id) return lines
|
for packdata in self.core.get_collector_packages():
|
for packdata in self.sm.get_collector_packages():
|
def get_pack_id(pack): if pack.isdigit(): pack = int(pack) for packdata in self.core.get_collector_packages(): if packdata['id'] == pack: return pack return -1 for packdata in self.core.get_collector_packages(): if packdata['package_name'] == pack: return packdata['id'] return -1
|
if not self.core.is_valid_link(link): return ["ERROR: Your specified link is not supported by pyLoad."]
|
def get_pack_id(pack): if pack.isdigit(): pack = int(pack) for packdata in self.core.get_collector_packages(): if packdata['id'] == pack: return pack return -1 for packdata in self.core.get_collector_packages(): if packdata['package_name'] == pack: return packdata['id'] return -1
|
|
pack_id = self.core.new_package(pack)
|
pack_id = self.sm.new_package(pack)
|
def get_pack_id(pack): if pack.isdigit(): pack = int(pack) for packdata in self.core.get_collector_packages(): if packdata['id'] == pack: return pack return -1 for packdata in self.core.get_collector_packages(): if packdata['package_name'] == pack: return packdata['id'] return -1
|
fid = self.core.add_links_to_package(pack_id, [link])
|
fid = self.sm.add_links_to_package(pack_id, [link])
|
def get_pack_id(pack): if pack.isdigit(): pack = int(pack) for packdata in self.core.get_collector_packages(): if packdata['id'] == pack: return pack return -1 for packdata in self.core.get_collector_packages(): if packdata['package_name'] == pack: return packdata['id'] return -1
|
ret = self.core.del_packages(map(int, args[1:]))
|
ret = self.sm.del_packages(map(int, args[1:]))
|
def event_del(self, args): if len(args) < 2: return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] if args[0] == "-p": ret = self.core.del_packages(map(int, args[1:])) return ["INFO: Deleted %d packages!" % ret] elif args[0] == "-l": ret = self.core.del_links(map(int, args[1:])) return ["INFO: Deleted %d links!" % ret]
|
ret = self.core.del_links(map(int, args[1:]))
|
ret = self.sm.del_links(map(int, args[1:]))
|
def event_del(self, args): if len(args) < 2: return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] if args[0] == "-p": ret = self.core.del_packages(map(int, args[1:])) return ["INFO: Deleted %d packages!" % ret] elif args[0] == "-l": ret = self.core.del_links(map(int, args[1:])) return ["INFO: Deleted %d links!" % ret]
|
return self.parent.open(new, timeout=req.timeout)
|
return self.parent.open(new)
|
def http_error_302(self, req, fp, code, msg, headers): resp = addinfourl(fp, headers, req.get_full_url()) resp.code = code resp.msg = msg self.cookiejar.extract_cookies(resp, req) if not self.follow: return resp # Some servers (incorrectly) return multiple Location headers # (so probably same goes for URI). Use first header. if 'location' in headers: newurl = headers.getheaders('location')[0] elif 'uri' in headers: newurl = headers.getheaders('uri')[0] else: return
|
self.list.packager.pushPackage2Queue(pid)
|
if pid or pyfile.package.data["id"]: self.list.packager.pushPackage2Queue(pyfile.package.data["id"] or pid)
|
def jobFinished(self, pyfile): """manage completing download""" self.lock.acquire()
|
__version__ = "0.1"
|
__version__ = "0.2"
|
def getInfo(urls): api_url = "http://www.share.cx/uapi?do=check&links=" for chunk in chunks(urls, 90): get = "" for url in chunk: get += ";"+url api = getURL(api_url+get[1:]) result = [] for i, link in enumerate(api.split()): url,name,size = link.split(";") if name and size: status = 2 else: status = 1 if not name: name = chunk[i] if not size: size = 0 result.append( (name, size, status, chunk[i]) ) yield result
|
op = re.search(r'name="op" value="(.*?)"', self.html).group(1) usr_login = re.search(r'name="usr_login" value="(.*?)"', self.html).group(1) id = re.search(r'name="id" value="(.*?)"', self.html).group(1) fname = re.search(r'name="fname" value="(.*?)"', self.html).group(1) referer = re.search(r'name="referer" value="(.*?)"', self.html).group(1) method_free = "Datei+herunterladen" self.html = self.load(self.pyfile.url, post={ "op" : op, "usr_login" : usr_login, "id" : id, "fname" : fname, "referer" : referer, "method_free" : method_free })
|
try: op = re.search(r'name="op" value="(.*?)"', self.html).group(1) usr_login = re.search(r'name="usr_login" value="(.*?)"', self.html).group(1) id = re.search(r'name="id" value="(.*?)"', self.html).group(1) fname = re.search(r'name="fname" value="(.*?)"', self.html).group(1) referer = re.search(r'name="referer" value="(.*?)"', self.html).group(1) method_free = "Datei+herunterladen" self.html = self.load(self.pyfile.url, post={ "op" : op, "usr_login" : usr_login, "id" : id, "fname" : fname, "referer" : referer, "method_free" : method_free }) except: pass
|
def doDownload(self): """ returns the absolute downloadable filepath """ if self.html is None: self.download_html()
|
name = re.search(r'<title>Download: (.*?)</title>', self.html).group(1)
|
name = re.search(r'<title>Download: (.*?) at Share.cx</title>', self.html).group(1)
|
def get_file_name(self): if self.html is None: self.download_html() name = re.search(r'<title>Download: (.*?)</title>', self.html).group(1) return name
|
xmlconfig = XMLConfigParser(join(abspath(dirname(__file__)),"module","config","core.xml"))
|
xmlconfig = XMLConfigParser(join(abspath(dirname(__file__)),"module","config","core.xml"), join(abspath(dirname(__file__)),"module","config","core_default.xml"))
|
def white(string): return "\033[1;37m" + string + "\033[0m"
|
self.html = None
|
self.html = [None, None]
|
def __init__(self, parent): Plugin.__init__(self, parent) props = {} props['name'] = "HotfileCom" props['type'] = "hoster" props['pattern'] = r"http://hotfile.com/dl/" props['version'] = "0.1" props['description'] = """Hotfile.com Download Plugin""" props['author_name'] = ("sitacuisses","spoob","mkaay") props['author_mail'] = ("[email protected]","[email protected]","[email protected]") self.props = props self.parent = parent self.html = None self.want_reconnect = False self.multi_dl = False self.htmlwithlink = None self.url = None
|
self.download_html()
|
def prepare(self, thread): pyfile = self.parent
|
|
self.html = self.req.load(self.url)
|
self.html[0] = self.req.load(self.url, cookies=True)
|
def download_html(self): self.url = self.parent.url self.html = self.req.load(self.url)
|
if self.html == None: self.download_html() if not self.want_reconnect: self.get_download_page() file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.htmlwithlink).group(1) return file_url else: return False
|
form_content = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html[0]).group(0) form_posts = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content) self.html[1] = self.req.load(self.url, post=form_posts, cookies=True) file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.html[1]).group(1) return file_url
|
def get_file_url(self): """ returns the absolute downloadable filepath """ if self.html == None: self.download_html() if not self.want_reconnect: self.get_download_page() file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.htmlwithlink).group(1) return file_url else: return False
|
if self.html == None: self.download_html() if not self.want_reconnect: file_name = re.search('Downloading\s<b>(.*?)</b>', self.html).group(1) return file_name else: return self.parent.url
|
file_name = re.search('Downloading\s<b>(.*?)</b>', self.html[0]).group(1) return file_name
|
def get_file_name(self): if self.html == None: self.download_html() if not self.want_reconnect: file_name = re.search('Downloading\s<b>(.*?)</b>', self.html).group(1) return file_name else: return self.parent.url
|
if self.html == None: self.download_html() if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None:
|
if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html[0]) != None:
|
def file_exists(self): """ returns True or False """ if self.html == None: self.download_html() if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None: return False else: return True
|
else: return True
|
return True
|
def file_exists(self): """ returns True or False """ if self.html == None: self.download_html() if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None: return False else: return True
|
matches = free_limit_pattern.findall(self.html)
|
matches = free_limit_pattern.findall(self.html[0])
|
def get_wait_time(self): free_limit_pattern = re.compile(r"timerend=d\.getTime\(\)\+(\d+);") matches = free_limit_pattern.findall(self.html) if matches: for match in matches: if int(match) == 60000: continue if int(match) == 0: continue else: self.time_plus_wait = time() + int(match)/1000 + 65 self.want_reconnect = True return True self.time_plus_wait = time() + 65
|
def get_download_page(self): herewego = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html).group(0) all_the_tuples = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", herewego) self.htmlwithlink = self.req.load(self.url, None, all_the_tuples) def proceed(self, url, location): self.req.download(url, location)
|
def get_wait_time(self): free_limit_pattern = re.compile(r"timerend=d\.getTime\(\)\+(\d+);") matches = free_limit_pattern.findall(self.html) if matches: for match in matches: if int(match) == 60000: continue if int(match) == 0: continue else: self.time_plus_wait = time() + int(match)/1000 + 65 self.want_reconnect = True return True self.time_plus_wait = time() + 65
|
|
requestFactory.iface = lambda self: iface.adress
|
requestFactory.iface = lambda: iface.adress
|
def getRequest(pluginName, account=None): iface = self.bestInterface(pluginName, account) if iface: iface.useFor(pluginName, account) requestFactory.iface = lambda self: iface.adress self.log.debug("Multihome: using address: "+iface.adress) return oldGetRequest(pluginName, account)
|
def beforeReconnecting(self, ip): self.disconnect() def afterReconnecting(self, ip): self.connect()
|
def announce(self, message): """ send message to all owners""" for user in self.getConfig("owners").split(";"):
|
|
plugins = tuple(plugins)
|
plugins = str(tuple(plugins))
|
def getDecryptJob(self): """return job for decrypting""" if self.jobCache.has_key("decrypt"): return None
|
remove(join("module", "links.pkl")) print "Removed Linklist"
|
try: remove(join("module", "links.pkl")) print "Removed Linklist" except: print "No Linklist found"
|
def __init__(self): self.doDebug = False self.arg_links = [] self.path = abspath(dirname(__file__)) chdir(self.path)
|
print " -v, --version", " " * 4, "Print version to terminal" print " -c, --clear", " " * 6, "Delete the saved linklist" print " -a, --add=<list>", " " * 1, "Add the specified links" print " -u, --user", " " * 7, "Set new User and password" print " -d, --debug", " " * 6, "Enable debug mode" print " -s, --setup", " " * 6, "Run Setup Assistent" print " -h, --help", " " * 7, "Display this help screen"
|
print " -v, --version", " " * 9, "Print version to terminal" print " -c, --clear", " " * 11, "Delete the saved linklist" print " -a, --add=<link/list>", " " * 1, "Add the specified links" print " -u, --user", " " * 12, "Set new User and password" print " -d, --debug", " " * 11, "Enable debug mode" print " -s, --setup", " " * 11, "Run Setup Assistent" print " -h, --help", " " * 12, "Display this help screen"
|
def print_help(self): print "" print "pyLoad %s Copyright (c) 2008-2010 the pyLoad Team" % CURRENT_VERSION print "" print "Usage: [python] pyLoadCore.py [options]" print "" print "<Options>" print " -v, --version", " " * 4, "Print version to terminal" print " -c, --clear", " " * 6, "Delete the saved linklist" print " -a, --add=<list>", " " * 1, "Add the specified links" print " -u, --user", " " * 7, "Set new User and password" print " -d, --debug", " " * 6, "Enable debug mode" print " -s, --setup", " " * 6, "Run Setup Assistent" print " -h, --help", " " * 7, "Display this help screen" print ""
|
self.check_install("pycurl", _("pycurl for lower memory footprint while downloading"))
|
self.check_install("pycurl", _("pycurl to download any files"), True, True)
|
def start(self): """ starts the machine"""
|
self.beginRemoveRows(QModelIndex(), 0, len(self._data)) self._data = [] self.endRemoveRows()
|
if len(self._data) > 0: self.beginRemoveRows(QModelIndex(), 0, len(self._data)-1) self._data = [] self.endRemoveRows()
|
def reloadData(self, force=True): data = self.connector.proxy.get_accounts(False, force) self.beginRemoveRows(QModelIndex(), 0, len(self._data)) self._data = [] self.endRemoveRows() accounts = [] for li in data.values(): accounts += li self.beginInsertRows(QModelIndex(), 0, len(accounts)) self._data = accounts self.endInsertRows()
|
self.beginInsertRows(QModelIndex(), 0, len(accounts)) self._data = accounts self.endInsertRows()
|
if len(accounts) > 0: self.beginInsertRows(QModelIndex(), 0, len(accounts)-1) self._data = accounts self.endInsertRows()
|
def reloadData(self, force=True): data = self.connector.proxy.get_accounts(False, force) self.beginRemoveRows(QModelIndex(), 0, len(self._data)) self._data = [] self.endRemoveRows() accounts = [] for li in data.values(): accounts += li self.beginInsertRows(QModelIndex(), 0, len(accounts)) self._data = accounts self.endInsertRows()
|
link = urllib.unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1))
|
if self.account: link = urllib.unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) else: link = urllib.unquote(re.search('<form action="(http://.+?\.depositfiles.com/.+?)" method="get"', self.html).group(1))
|
def process(self, pyfile): self.html = self.load(self.pyfile.url, cookies=True if self.account else False) if re.search(r"Such file does not exist or it has been removed for infringement of copyrights", self.html): self.offline() if not self.account: self.handleFree() pyfile.name = re.search('File name: <b title="(.*)">', self.html).group(1) link = urllib.unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) self.download(link)
|
__pattern__ = r"http://[\w\.]*?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>.+)|
|
__pattern__ = r"http://[\w\.]*?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|
|
def getInfo(urls): ids = "" names = "" p = re.compile(RapidshareCom.__pattern__) for url in urls: r = p.search(url) if r.group("name"): ids+= ","+r.group("id") names+= ","+r.group("name") elif r.group("name_new"): ids+= ","+r.group("id_new") names+= ","+r.group("name_new") url = "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files=%s&filenames=%s" % (ids[1:], names[1:]) api = getURL(url) result = [] i = 0 for res in api.split(): tmp = res.split(",") if tmp[4] in ("0", "4", "5"): status = 1 elif tmp[4] == "1": status = 2 else: status = 3 result.append( (tmp[1], tmp[2], status, urls[i]) ) i += 1 yield result
|
print_exc() dump = "pyLoad Debug Report\n\nTRACEBACK from %s:\n %s \n\nDUMP from %s:\n" % (pyfile.pluginname, format_exc(), pyfile.pluginname) tb = exc_info()[2] stack = [] while tb: stack.append(tb.tb_frame) tb = tb.tb_next for frame in stack[1:]: dump += "\nFrame %s in %s at line %s\n" % (frame.f_code.co_name, frame.f_code.co_filename, frame.f_lineno) for key, value in frame.f_locals.items(): dump += "\t%20s = " % key try: if hasattr(value, "__iter__"): dump += pformat(value) + ":" + pformat(list(value)) else: dump += pformat(value) + "\n" except: dump += "<ERROR WHILE PRINTING VALUE>\n" dump += "\n\nPLUGIN OBJECT DUMP: \n\n" for name in dir(pyfile.plugin): attr = getattr(pyfile.plugin, name) if not name.endswith("__") and type(attr) not in (InstanceType,MethodType): dump += "\t%20s = " % name dump += pformat(attr) +"\n" dump += "\nPYFILE OBJECT DUMP: \n\n" for name in dir(pyfile): attr = getattr(pyfile, name) if not name.endswith("__") and type(attr) not in (InstanceType,MethodType): dump += "\t%20s = " % name dump += pformat(attr) +"\n" dump_name = "debug_%s_%s.txt" % (pyfile.pluginname, strftime("%d%h%Y_%H:%M:%S")) self.m.core.log.info("Debug Report written to %s" % dump_name) f = open(dump_name, "wb") f.write(dump) f.close()
|
print_exc() self.writeDebugReport(pyfile)
|
def run(self): """run method"""
|
file_url = re.search('a href=\"(.*?)\".*?button\.basic\.jpg', self.htmlwithlink).group(1)
|
file_url = re.search('a href=\"(.*?)\" id=\"downloadLinkTarget\"', self.htmlwithlink).group(1)
|
def get_file_url(self): """ returns the absolute downloadable filepath """ if self.html == None: self.download_html() if not self.want_reconnect: file_url = re.search('a href=\"(.*?)\".*?button\.basic\.jpg', self.htmlwithlink).group(1) #print file_url return file_url else: return False
|
return expanduser("~")
|
if platform == 'nt': import ctypes from ctypes import wintypes, windll CSIDL_APPDATA = 26 _SHGetFolderPath = ctypes.windll.shell32.SHGetFolderPathW _SHGetFolderPath.argtypes = [ctypes.wintypes.HWND, ctypes.c_int, ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.wintypes.LPCWSTR] path_buf = ctypes.wintypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) result = _SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, path_buf) return path_buf.value else: return expanduser("~")
|
def getHomeDir(self): try: from win32com.shell import shellcon, shell return shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) except ImportError: # quick semi-nasty fallback for non-windows/win32com case return expanduser("~")
|
time.sleep(1.1)
|
sleep(1.1)
|
def initReconnect(self): """initialise a reonnect""" if not self.parent.config['reconnect']['activated'] or self.reconnecting or not self.parent.server_methods.is_time_reconnect(): return False
|
time.sleep(1)
|
sleep(1)
|
def reconnect(self): self.parent.logger.info(_("Starting reconnect")) ip = re.match(".*Current IP Address: (.*)</body>.*", getURL("http://checkip.dyndns.org/")).group(1) self.parent.hookManager.beforeReconnecting(ip) reconn = subprocess.Popen(self.parent.config['reconnect']['method'])#, stdout=subprocess.PIPE) reconn.wait() time.sleep(1) ip = "" while ip == "": try: ip = re.match(".*Current IP Address: (.*)</body>.*", getURL("http://checkip.dyndns.org/")).group(1) #versuchen neue ip aus zu lesen except: ip = "" time.sleep(1) self.parent.hookManager.afterReconnecting(ip) self.parent.logger.info(_("Reconnected, new IP: %s") % ip)
|
if code in (7,52,56):
|
if code in (7,52,56,28):
|
def run(self): """run method"""
|
sleep(60) self.queue.put(pyfile)
|
wait = time() + 60 while time() < wait: sleep(1) if pyfile.abort: break if pyfile.abort: self.m.log.info(_("Download aborted: %s") % pyfile.name) pyfile.setStatus("aborted") pyfile.plugin.req.clean() self.active = False pyfile.release() else: self.queue.put(pyfile)
|
def run(self): """run method"""
|
self.c.execute("SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=1 AND l.plugin NOT IN %s AND l.status IN (2,3,6) LIMIT 5" % str(occ))
|
self.c.execute("SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=1 AND l.plugin NOT IN %s AND l.status IN (2,3,6) LIMIT 5" % occ)
|
def getJob(self, occ): """return pyfile instance, which is suitable for download and dont use a occupied plugin""" self.c.execute("SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=1 AND l.plugin NOT IN %s AND l.status IN (2,3,6) LIMIT 5" % str(occ)) # very bad!
|
self.debug = True
|
self.debug = False
|
def __init__(self, interface=None):
|
if "Der Traffic f\xc3\xbcr heute ist verbraucht!" in self.html:
|
if "Der Traffic f\xc3\xbcr heute ist verbraucht!" in self.html or "Your Traffic is used up for today" in self.html:
|
def get_waiting_time(self): if self.html is None: self.download_html() if "Der Traffic f\xc3\xbcr heute ist verbraucht!" in self.html: self.wantReconnect = True return 24*3600 timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1) if timestring: sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off else: sec = 0 return sec
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.