diff options
Diffstat (limited to 'pyload')
40 files changed, 220 insertions, 261 deletions
diff --git a/pyload/plugins/accounts/UploadedTo.py b/pyload/plugins/accounts/UploadedTo.py index e10b93e8d..d202018f2 100644 --- a/pyload/plugins/accounts/UploadedTo.py +++ b/pyload/plugins/accounts/UploadedTo.py @@ -23,7 +23,7 @@ from time import time class UploadedTo(Account): __name__ = "UploadedTo" - __version__ = "0.23" + __version__ = "0.26" __type__ = "account" __description__ = """ul.net account plugin""" __author_name__ = ("mkaay") @@ -37,7 +37,7 @@ class UploadedTo(Account): premium = '<a href="register"><em>Premium</em>' in html or '<em>Premium</em></th>' in html if premium: - raw_traffic = re.search(r'<th colspan="2"><b class="cB">([^<]+)', html).group(1) + raw_traffic = re.search(r'<th colspan="2"><b class="cB">([^<]+)', html).group(1).replace('.', '') raw_valid = re.search(r"<td>Duration:</td>\s*<th>([^<]+)", html, re.MULTILINE).group(1).strip() traffic = int(self.parseTraffic(raw_traffic)) @@ -45,10 +45,10 @@ class UploadedTo(Account): if raw_valid == "unlimited": validuntil = -1 else: - raw_valid = re.findall(r"(\d+) (weeks|days|hours)", raw_valid) + raw_valid = re.findall(r"(\d+) (Week|weeks|days|day|hours|hour)", raw_valid) validuntil = time() for n, u in raw_valid: - validuntil += 3600 * int(n) * {"weeks": 168, "days": 24, "hours": 1}[u] + validuntil += 3600 * int(n) * {"Week": 168, "weeks": 168, "days": 24, "day": 24, "hours": 1, "hour": 1}[u] return {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":50*1024*1024} else: diff --git a/pyload/plugins/addons/ClickAndLoad.py b/pyload/plugins/addons/ClickAndLoad.py index 6d6928557..fcc2cf24e 100644 --- a/pyload/plugins/addons/ClickAndLoad.py +++ b/pyload/plugins/addons/ClickAndLoad.py @@ -25,7 +25,7 @@ from module.plugins.Addon import Addon class ClickAndLoad(Addon): __name__ = "ClickAndLoad" - __version__ = "0.2" + __version__ = "0.21" __description__ = """Gives abillity to use jd's click and load. depends on webinterface""" __config__ = [("activated", "bool", "Activated", "True"), ("extern", "bool", "Allow external link adding", "False")] @@ -43,7 +43,7 @@ class ClickAndLoad(Addon): thread.start_new_thread(proxy, (self, ip, self.port, 9666)) except: - self.log.error("ClickAndLoad port already in use.") + self.logError("ClickAndLoad port already in use.") def proxy(self, *settings): @@ -71,7 +71,7 @@ def server(self, *settings): errno = e.args[0] if errno == 98: - self.core.log.warning(_("Click'N'Load: Port 9666 already in use")) + self.logWarning(_("Click'N'Load: Port 9666 already in use")) return thread.start_new_thread(server, (self,) + settings) except: diff --git a/pyload/plugins/addons/DeleteFinished.py b/pyload/plugins/addons/DeleteFinished.py index 01cb1b8e1..155158701 100644 --- a/pyload/plugins/addons/DeleteFinished.py +++ b/pyload/plugins/addons/DeleteFinished.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -""" +''' This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, @@ -15,79 +15,70 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. @author: Walter Purcaro -""" +''' from module.database import style from module.plugins.Hook import Hook class DeleteFinished(Hook): - __name__ = "DeleteFinished" - __version__ = "1.02" - __description__ = "Automatically delete finished packages from queue" + __name__ = 'DeleteFinished' + __version__ = '1.09' + __description__ = 'Automatically delete all finished packages from queue' __config__ = [ - ("activated", "bool", "Activated", "False"), - ("interval", "int", "Delete every (hours)", "72") + ('activated', 'bool', 'Activated', 'False'), + ('interval', 'int', 'Delete every (hours)', '72'), + ('deloffline', 'bool', 'Delete packages with offline links', 'False') ] - __author_name__ = ("Walter Purcaro") - __author_mail__ = ("vuolter@gmail.com") + __author_name__ = ('Walter Purcaro') + __author_mail__ = ('vuolter@gmail.com') ## overwritten methods ## def periodical(self): - # self.logDebug("self.periodical") - if not self.info["sleep"]: - self.logInfo("self.deleteFinished") - self.deleteFinished() - self.info["sleep"] = True - self.addEvent("packageFinished", self.wakeup) + if not self.info['sleep']: + deloffline = self.getConfig('deloffline') + mode = '0,1,4' if deloffline else '0,4' + msg = 'delete all finished packages in queue list (%s packages with offline links)' + self.logInfo(msg % ('including' if deloffline else 'excluding')) + self.deleteFinished(mode) + self.info['sleep'] = True + self.addEvent('packageFinished', self.wakeup) def pluginConfigChanged(self, plugin, name, value): - # self.logDebug("self.pluginConfigChanged") - if name == "interval" and value != self.interval: - self.interval = value + if name == 'interval' and value != self.interval: + self.interval = value * 3600 self.initPeriodical() def unload(self): - # self.logDebug("self.unload") - self.removeEvent("packageFinished", self.wakeup) + self.removeEvent('packageFinished', self.wakeup) def coreReady(self): - # self.logDebug("self.coreReady") - self.info = {"sleep": True} - interval = self.getConfig("interval") * 3600 - self.pluginConfigChanged("DeleteFinished", "interval", interval) - self.addEvent("packageFinished", self.wakeup) + self.info = {'sleep': True} + interval = self.getConfig('interval') + self.pluginConfigChanged('DeleteFinished', 'interval', interval) + self.addEvent('packageFinished', self.wakeup) ## own methods ## @style.queue - def deleteFinished(self): - self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (0,4))") - self.c.execute("DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)") + def deleteFinished(self, mode): + self.c.execute('DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (%s))' % mode) + self.c.execute('DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)') def wakeup(self, pypack): - # self.logDebug("self.wakeup") - self.removeEvent("packageFinished", self.wakeup) - self.info["sleep"] = False + self.removeEvent('packageFinished', self.wakeup) + self.info['sleep'] = False ## event managing ## - def addEvent(self, event, handler): - if event in self.manager.events: - if handler not in self.manager.events[event]: - self.manager.events[event].append(handler) - # self.logDebug("self.addEvent: " + event + ": added handler") + def addEvent(self, event, func): + '''Adds an event listener for event name''' + if event in self.m.events: + if func in self.m.events[event]: + self.logDebug('Function already registered %s' % func) else: - # self.logDebug("self.addEvent: " + event + ": NOT added handler") - return False + self.m.events[event].append(func) else: - self.manager.events[event] = [handler] - # self.logDebug("self.addEvent: " + event + ": added event and handler") - return True + self.m.events[event] = [func] - def removeEvent(self, event, handler): - if event in self.manager.events and handler in self.manager.events[event]: - self.manager.events[event].remove(handler) - # self.logDebug("self.removeEvent: " + event + ": removed handler") - return True - else: - # self.logDebug("self.removeEvent: " + event + ": NOT removed handler") - return False + def setup(self): + self.m = self.manager + self.removeEvent = self.m.removeEvent diff --git a/pyload/plugins/addons/Ev0InFetcher.py b/pyload/plugins/addons/Ev0InFetcher.py index 608baf217..970c70cd5 100644 --- a/pyload/plugins/addons/Ev0InFetcher.py +++ b/pyload/plugins/addons/Ev0InFetcher.py @@ -22,7 +22,7 @@ from module.plugins.Addon import Addon class Ev0InFetcher(Addon): __name__ = "Ev0InFetcher" - __version__ = "0.2" + __version__ = "0.21" __description__ = """checks rss feeds for ev0.in""" __config__ = [("activated", "bool", "Activated", "False"), ("interval", "int", "Check interval in minutes", "10"), @@ -73,15 +73,15 @@ class Ev0InFetcher(Addon): if show.lower() in normalizefiletitle(item['title']) and lastfound < int(mktime(item.date_parsed)): links = self.filterLinks(item['description'].split("<br />")) packagename = item['title'].encode("utf-8") - self.core.log.info("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show)) + self.logInfo("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show)) self.core.api.addPackage(packagename, links, 1 if self.getConfig("queue") else 0) self.setStorage("show_%s_lastfound" % show, int(mktime(item.date_parsed))) found = True if not found: - #self.core.log.debug("Ev0InFetcher: no new episodes found") + #self.logDebug("Ev0InFetcher: no new episodes found") pass for show, lastfound in self.getStorage().iteritems(): if int(lastfound) > 0 and int(lastfound) + (3600*24*30) < int(time()): self.delStorage("show_%s_lastfound" % show) - self.core.log.debug("Ev0InFetcher: cleaned '%s' record" % show) + self.logDebug("Ev0InFetcher: cleaned '%s' record" % show) diff --git a/pyload/plugins/addons/ExtractArchive.py b/pyload/plugins/addons/ExtractArchive.py index 587903fbe..d5609863e 100644 --- a/pyload/plugins/addons/ExtractArchive.py +++ b/pyload/plugins/addons/ExtractArchive.py @@ -57,7 +57,7 @@ class ExtractArchive(Addon): Provides: unrarFinished (folder, filename) """ __name__ = "ExtractArchive" - __version__ = "0.13" + __version__ = "0.14" __description__ = "Extract different kind of archives" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), @@ -309,4 +309,4 @@ class ExtractArchive(Addon): gid = getgrnam(self.config["permission"]["group"])[2] chown(f, uid, gid) except Exception, e: - self.log.warning(_("Setting User and Group failed"), e) + self.logWarning(_("Setting User and Group failed"), e) diff --git a/pyload/plugins/addons/HotFolder.py b/pyload/plugins/addons/HotFolder.py index d05026448..c3c285369 100644 --- a/pyload/plugins/addons/HotFolder.py +++ b/pyload/plugins/addons/HotFolder.py @@ -30,7 +30,7 @@ from module.plugins.Addon import Addon class HotFolder(Addon): __name__ = "HotFolder" - __version__ = "0.1" + __version__ = "0.11" __description__ = """observe folder and file for changes and add container and links""" __config__ = [ ("activated", "bool", "Activated" , "False"), ("folder", "str", "Folder to observe", "container"), @@ -79,7 +79,7 @@ class HotFolder(Addon): newpath = join(self.getConfig("folder"), "finished", f if self.getConfig("keep") else "tmp_"+f) move(path, newpath) - self.log.info(_("Added %s from HotFolder") % f) + self.logInfo(_("Added %s from HotFolder") % f) self.core.api.addPackage(f, [newpath], 1)
\ No newline at end of file diff --git a/pyload/plugins/addons/IRCInterface.py b/pyload/plugins/addons/IRCInterface.py index c261fc6f3..821f80b6c 100644 --- a/pyload/plugins/addons/IRCInterface.py +++ b/pyload/plugins/addons/IRCInterface.py @@ -36,7 +36,7 @@ from pycurl import FORM_FILE class IRCInterface(Thread, Addon): __name__ = "IRCInterface" - __version__ = "0.1" + __version__ = "0.11" __description__ = """connect to irc and let owner perform different tasks""" __config__ = [("activated", "bool", "Activated", "False"), ("host", "str", "IRC-Server Address", "Enter your server here!"), @@ -105,8 +105,8 @@ class IRCInterface(Thread, Addon): for t in self.getConfig("owner").split(): if t.strip().startswith("#"): self.sock.send("JOIN %s\r\n" % t.strip()) - self.log.info("pyLoad IRC: Connected to %s!" % host) - self.log.info("pyLoad IRC: Switching to listening mode!") + self.logInfo("pyLoad IRC: Connected to %s!" % host) + self.logInfo("pyLoad IRC: Switching to listening mode!") try: self.main_loop() @@ -167,15 +167,15 @@ class IRCInterface(Thread, Addon): # HANDLE CTCP ANTI FLOOD/BOT PROTECTION if msg["text"] == "\x01VERSION\x01": - self.log.debug("Sending CTCP VERSION.") + self.logDebug("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.logDebug("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 + self.logDebug("Received CTCP LAG.") # don't know how to answer return trigger = "pass" @@ -195,7 +195,7 @@ class IRCInterface(Thread, Addon): for line in res: self.response(line, msg["origin"]) except Exception, e: - self.log.error("pyLoad IRC: "+ repr(e)) + self.logError("pyLoad IRC: "+ repr(e)) def response(self, msg, origin=""): diff --git a/pyload/plugins/addons/MergeFiles.py b/pyload/plugins/addons/MergeFiles.py index 48f997681..8d7f8aef1 100644 --- a/pyload/plugins/addons/MergeFiles.py +++ b/pyload/plugins/addons/MergeFiles.py @@ -30,7 +30,7 @@ BUFFER_SIZE = 4096 class MergeFiles(Addon): __name__ = "MergeFiles" - __version__ = "0.1" + __version__ = "0.11" __description__ = "Merges parts splitted with hjsplit" __config__ = [ ("activated" , "bool" , "Activated" , "False"), @@ -60,11 +60,11 @@ class MergeFiles(Addon): download_folder = save_join(download_folder, pack.folder) for name, file_list in files.iteritems(): - self.core.log.info("Starting merging of %s" % name) + self.logInfo("Starting merging of %s" % name) final_file = open(join(download_folder, fs_encode(name)), "wb") for splitted_file in file_list: - self.core.log.debug("Merging part %s" % splitted_file) + self.logDebug("Merging part %s" % splitted_file) pyfile = self.core.files.getFile(fid_dict[splitted_file]) pyfile.setStatus("processing") try: @@ -80,7 +80,7 @@ class MergeFiles(Addon): else: break s_file.close() - self.core.log.debug("Finished merging part %s" % splitted_file) + self.logDebug("Finished merging part %s" % splitted_file) except Exception, e: print traceback.print_exc() finally: @@ -89,6 +89,6 @@ class MergeFiles(Addon): pyfile.release() final_file.close() - self.core.log.info("Finished merging of %s" % name) + self.logInfo("Finished merging of %s" % name) diff --git a/pyload/plugins/addons/MultiHome.py b/pyload/plugins/addons/MultiHome.py index af3f55416..e38ce047a 100644 --- a/pyload/plugins/addons/MultiHome.py +++ b/pyload/plugins/addons/MultiHome.py @@ -22,7 +22,7 @@ from time import time class MultiHome(Addon): __name__ = "MultiHome" - __version__ = "0.1" + __version__ = "0.11" __description__ = """ip address changer""" __config__ = [ ("activated", "bool", "Activated" , "False"), ("interfaces", "str", "Interfaces" , "None") ] @@ -54,7 +54,7 @@ class MultiHome(Addon): if iface: iface.useFor(pluginName, account) requestFactory.iface = lambda: iface.adress - self.log.debug("Multihome: using address: "+iface.adress) + self.logDebug("Multihome: using address: "+iface.adress) return oldGetRequest(pluginName, account) requestFactory.getRequest = getRequest diff --git a/pyload/plugins/addons/RehostTo.py b/pyload/plugins/addons/RehostTo.py index 7ca5e5cde..cd9f7ccef 100644 --- a/pyload/plugins/addons/RehostTo.py +++ b/pyload/plugins/addons/RehostTo.py @@ -5,7 +5,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class RehostTo(MultiHoster): __name__ = "RehostTo" - __version__ = "0.42" + __version__ = "0.43" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), @@ -31,7 +31,7 @@ class RehostTo(MultiHoster): user = self.account.selectAccount()[0] if not user: - self.log.error("Rehost.to: "+ _("Please add your rehost.to account first and restart pyLoad")) + self.logError("Rehost.to: "+ _("Please add your rehost.to account first and restart pyLoad")) return data = self.account.getAccountInfo(user) diff --git a/pyload/plugins/addons/UpdateManager.py b/pyload/plugins/addons/UpdateManager.py index c800b44bf..b30289287 100644 --- a/pyload/plugins/addons/UpdateManager.py +++ b/pyload/plugins/addons/UpdateManager.py @@ -29,7 +29,7 @@ from module.plugins.Hook import threaded, Expose, Hook class UpdateManager(Hook): __name__ = "UpdateManager" - __version__ = "0.13" + __version__ = "0.15" __description__ = """checks for updates""" __config__ = [("activated", "bool", "Activated", "True"), ("interval", "int", "Check interval in minutes", "480"), @@ -70,12 +70,12 @@ class UpdateManager(Hook): if self.updated and not self.reloaded: self.info["plugins"] = True - self.log.info(_("*** Plugins have been updated, please restart pyLoad ***")) + self.logInfo(_("*** Plugins have been updated, please restart pyLoad ***")) elif self.updated and self.reloaded: - self.log.info(_("Plugins updated and reloaded")) + self.logInfo(_("Plugins updated and reloaded")) self.updated = False elif self.version == "None": - self.log.info(_("No plugin updates available")) + self.logInfo(_("No plugin updates available")) @Expose def recheckForUpdates(self): @@ -92,16 +92,16 @@ class UpdateManager(Hook): # Still no updates, plugins will be checked if self.version == "None": - self.log.info(_("No Updates for pyLoad")) + self.logInfo(_("No Updates for pyLoad")) return version_check[1:] self.info["pyload"] = True - self.log.info(_("*** New pyLoad Version %s available ***") % self.version) - self.log.info(_("*** Get it here: http://pyload.org/download ***")) + self.logInfo(_("*** New pyLoad Version %s available ***") % self.version) + self.logInfo(_("*** Get it here: http://pyload.org/download ***")) except: - self.log.warning(_("Not able to connect server for updates")) + self.logWarning(_("Not able to connect server for updates")) return None # Nothing will be done @@ -145,7 +145,7 @@ class UpdateManager(Hook): if name in IGNORE or (type, name) in IGNORE: continue - self.log.info(_("New version of %(type)s|%(name)s : %(version).2f") % { + self.logInfo(_("New version of %(type)s|%(name)s : %(version).2f") % { "type": type, "name": name, "version": float(version) diff --git a/pyload/plugins/addons/XMPPInterface.py b/pyload/plugins/addons/XMPPInterface.py index e8ef1d2ca..40454f1c3 100644 --- a/pyload/plugins/addons/XMPPInterface.py +++ b/pyload/plugins/addons/XMPPInterface.py @@ -28,7 +28,7 @@ from module.plugins.addons.IRCInterface import IRCInterface class XMPPInterface(IRCInterface, JabberClient): __name__ = "XMPPInterface" - __version__ = "0.1" + __version__ = "0.11" __description__ = """connect to jabber and let owner perform different tasks""" __config__ = [("activated", "bool", "Activated", "False"), ("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"), @@ -97,22 +97,22 @@ class XMPPInterface(IRCInterface, JabberClient): try: self.loop() except Exception, ex: - self.core.log.error("pyLoad XMPP: %s" % str(ex)) + self.logError("pyLoad XMPP: %s" % str(ex)) def stream_state_changed(self, state, arg): """This one is called when the state of stream connecting the component to a server changes. This will usually be used to let the user know what is going on.""" - self.log.debug("pyLoad XMPP: *** State changed: %s %r ***" % (state, arg)) + self.logDebug("pyLoad XMPP: *** State changed: %s %r ***" % (state, arg)) def disconnected(self): - self.log.debug("pyLoad XMPP: Client was disconnected") + self.logDebug("pyLoad XMPP: Client was disconnected") def stream_closed(self, stream): - self.log.debug("pyLoad XMPP: Stream was closed | %s" % stream) + self.logDebug("pyLoad XMPP: Stream was closed | %s" % stream) def stream_error(self, err): - self.log.debug("pyLoad XMPP: Stream Error: %s" % err) + self.logDebug("pyLoad XMPP: Stream Error: %s" % err) def get_message_handlers(self): """Return list of (message_type, message_handler) tuples. @@ -147,8 +147,8 @@ class XMPPInterface(IRCInterface, JabberClient): subject = stanza.get_subject() body = stanza.get_body() t = stanza.get_type() - self.log.debug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(), ))) - self.log.debug(u'pyLoad XMPP: Body: %s Subject: %s Type: %s' % (body, subject, t)) + self.logDebug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(), ))) + self.logDebug(u'pyLoad XMPP: Body: %s Subject: %s Type: %s' % (body, subject, t)) if t == "headline": # 'headline' messages should never be replied to @@ -192,7 +192,7 @@ class XMPPInterface(IRCInterface, JabberClient): messages.append(m) except Exception, e: - self.log.error("pyLoad XMPP: " + repr(e)) + self.logError("pyLoad XMPP: " + repr(e)) return messages @@ -205,7 +205,7 @@ class XMPPInterface(IRCInterface, JabberClient): def announce(self, message): """ send message to all owners""" for user in self.getConfig("owners").split(";"): - self.log.debug("pyLoad XMPP: Send message to %s" % user) + self.logDebug("pyLoad XMPP: Send message to %s" % user) to_jid = JID(user) diff --git a/pyload/plugins/crypter/EasybytezComFolder.py b/pyload/plugins/crypter/EasybytezComFolder.py index 1b887e421..83ec6472e 100644 --- a/pyload/plugins/crypter/EasybytezComFolder.py +++ b/pyload/plugins/crypter/EasybytezComFolder.py @@ -15,8 +15,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################ -import re - from module.plugins.internal.SimpleCrypter import SimpleCrypter @@ -24,37 +22,14 @@ class EasybytezComFolder(SimpleCrypter): __name__ = "EasybytezComFolder" __type__ = "crypter" __pattern__ = r"https?://(www\.)?easybytez\.com/users/\w+/\w+" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Easybytez Crypter Plugin""" __author_name__ = ("stickell") __author_mail__ = ("l.stickell@yahoo.it") LINK_PATTERN = r'<div class="link"><a href="(http://www\.easybytez\.com/\w+)" target="_blank">.+</a></div>' TITLE_PATTERN = r'<Title>Files of (?P<title>.+) folder</Title>' - PAGES_PATTERN = r"<a href='[^']+'>(\d+)</a><a href='[^']+'>Next »</a><br><small>\(\d+ total\)</small></div>" - - def decrypt(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - - package_name, folder_name = self.getPackageNameAndFolder() - - package_links = re.findall(self.LINK_PATTERN, self.html) - - pages = re.search(self.PAGES_PATTERN, self.html) - if pages: - pages = int(pages.group(1)) - else: - pages = 1 - - p = 2 - while p <= pages: - self.html = self.load(pyfile.url, get={'page': p}, decode=True) - package_links += re.findall(self.LINK_PATTERN, self.html) - p += 1 - - self.logDebug('Package has %d links' % len(package_links)) + PAGES_PATTERN = r"<a href='[^']+'>(?P<pages>\d+)</a><a href='[^']+'>Next »</a><br><small>\(\d+ total\)</small></div>" - if package_links: - self.packages = [(package_name, package_links, folder_name)] - else: - self.fail('Could not extract any links')
\ No newline at end of file + def loadPage(self, page_n): + return self.load(self.pyfile.url, get={'page': page_n}, decode=True) diff --git a/pyload/plugins/hooks/Captcha9kw.py b/pyload/plugins/hooks/Captcha9kw.py index 61f4ad5a2..cd622b7cd 100755 --- a/pyload/plugins/hooks/Captcha9kw.py +++ b/pyload/plugins/hooks/Captcha9kw.py @@ -86,7 +86,7 @@ class Captcha9kw(Hook): "action": "usercaptchaupload" }) if response.isdigit(): - self.logInfo(_("NewCaptchaID from upload: %s : %s") % (response,task.captchaFile)) + self.logInfo(_("New CaptchaID from upload: %s : %s") % (response,task.captchaFile)) for i in range(1, 100, 1): response2 = getURL(self.API_URL, get = { "apikey": self.getConfig("passkey"), "id": response,"pyload": "1","source": "pyload", "action": "usercaptchacorrectdata" }) diff --git a/pyload/plugins/hoster/ARD.py b/pyload/plugins/hoster/ARD.py index 5ab65cd4b..cda783091 100644 --- a/pyload/plugins/hoster/ARD.py +++ b/pyload/plugins/hoster/ARD.py @@ -39,7 +39,7 @@ class RTMP: class ARD(Hoster): __name__ = "ARD Mediathek" - __version__ = "0.1" + __version__ = "0.11" __pattern__ = r"http://www\.ardmediathek\.de/.*" __config__ = [] @@ -73,7 +73,7 @@ class ARD(Hoster): chown(location, uid, gid) except Exception, e: - self.log.warning(_("Setting User and Group failed: %s") % str(e)) + self.logWarning(_("Setting User and Group failed: %s") % str(e)) output_file = save_join(location, save_path(pyfile.name)) + os.path.splitext(playpath)[1] diff --git a/pyload/plugins/hoster/AlldebridCom.py b/pyload/plugins/hoster/AlldebridCom.py index e5223b011..cdb5ccc08 100644 --- a/pyload/plugins/hoster/AlldebridCom.py +++ b/pyload/plugins/hoster/AlldebridCom.py @@ -10,7 +10,7 @@ from module.utils import parseFileSize class AlldebridCom(Hoster): __name__ = "AlldebridCom" - __version__ = "0.31" + __version__ = "0.33" __type__ = "hoster" __pattern__ = r"https?://.*alldebrid\..*" @@ -34,10 +34,10 @@ class AlldebridCom(Hoster): def process(self, pyfile): if not self.account: - self.logError("Please enter your AllDebrid account or deactivate this plugin") + self.logError(_("Please enter your %s account or deactivate this plugin") % "AllDebrid") self.fail("No AllDebrid account provided") - self.log.debug("AllDebrid: Old URL: %s" % pyfile.url) + self.logDebug("AllDebrid: Old URL: %s" % pyfile.url) if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url else: diff --git a/pyload/plugins/hoster/BitshareCom.py b/pyload/plugins/hoster/BitshareCom.py index 8b81c28cd..5e117ff45 100644 --- a/pyload/plugins/hoster/BitshareCom.py +++ b/pyload/plugins/hoster/BitshareCom.py @@ -2,58 +2,24 @@ from __future__ import with_statement import re -from pycurl import FOLLOWLOCATION -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.plugins.internal.CaptchaService import ReCaptcha -from module.network.RequestFactory import getRequest -def getInfo(urls): - result = [] - - for url in urls: - - # Get file info html - req = getRequest() - req.cj.setCookie(BitshareCom.HOSTER_DOMAIN, "language_selection", "EN") - html = req.load(url) - req.close() - - # Check online - if re.search(BitshareCom.FILE_OFFLINE_PATTERN, html): - result.append((url, 0, 1, url)) - continue - - # Name - name1 = re.search(BitshareCom.__pattern__, url).group('name') - m = re.search(BitshareCom.FILE_INFO_PATTERN, html) - name2 = m.group('name') - name = max(name1, name2) - - # Size - value = float(m.group('size')) - units = m.group('units') - pow = {'KB' : 1, 'MB' : 2, 'GB' : 3}[units] - size = int(value*1024**pow) - - # Return info - result.append((name, size, 2, url)) - - yield result - -class BitshareCom(Hoster): +class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" __pattern__ = r"http://(www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))" - __version__ = "0.47" + __version__ = "0.48" __description__ = """Bitshare.Com File Download Hoster""" __author_name__ = ("paulking", "fragonib") __author_mail__ = (None, "fragonib[AT]yahoo[DOT]es") HOSTER_DOMAIN = "bitshare.com" FILE_OFFLINE_PATTERN = r'''(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)''' - FILE_INFO_PATTERN = r'<h1>(Downloading|Streaming)\s(?P<name>.+?)\s-\s(?P<size>[\d.]+)\s(?P<units>..)yte</h1>' + FILE_NAME_PATTERN = r'Download:</td>\s*<td><input type="text" value="http://bitshare\.com/files/\w+/(?P<N>[^"]+)\.html"' + FILE_SIZE_PATTERN = r'- (?P<S>[\d.]+) (?P<U>\w+)</h1>' FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) " TRAFFIC_USED_UP = r"Your Traffic is used up for today. Upgrade to premium to continue!" @@ -177,3 +143,5 @@ class BitshareCom(Hoster): self.retry() self.logDebug("Wrong captcha") self.invalidCaptcha() + +getInfo = create_getInfo(BitshareCom) diff --git a/pyload/plugins/hoster/DebridItaliaCom.py b/pyload/plugins/hoster/DebridItaliaCom.py index 470c4ae5d..1c2f4246b 100644 --- a/pyload/plugins/hoster/DebridItaliaCom.py +++ b/pyload/plugins/hoster/DebridItaliaCom.py @@ -22,7 +22,7 @@ from module.plugins.Hoster import Hoster class DebridItaliaCom(Hoster): __name__ = "DebridItaliaCom" - __version__ = "0.03" + __version__ = "0.04" __type__ = "hoster" __pattern__ = r"https?://.*debriditalia\.com" __description__ = """Debriditalia.com hoster plugin""" @@ -35,7 +35,7 @@ class DebridItaliaCom(Hoster): def process(self, pyfile): if not self.account: - self.logError("Please enter your DebridItalia account or deactivate this plugin") + self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia") self.fail("No DebridItalia account provided") self.logDebug("Old URL: %s" % pyfile.url) diff --git a/pyload/plugins/hoster/DepositfilesCom.py b/pyload/plugins/hoster/DepositfilesCom.py index 850812c5d..ee5fdf6af 100644 --- a/pyload/plugins/hoster/DepositfilesCom.py +++ b/pyload/plugins/hoster/DepositfilesCom.py @@ -11,7 +11,7 @@ class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?(depositfiles\.com|dfiles\.eu)(/\w{1,3})?/files/[\w]+" - __version__ = "0.43" + __version__ = "0.44" __description__ = """Depositfiles.com Download Hoster""" __author_name__ = ("spoob", "zoidberg") __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") @@ -35,7 +35,7 @@ class DepositfilesCom(SimpleHoster): if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline() if re.search(r'File is checked, please try again in a minute.', self.html) is not None: - self.log.info("DepositFiles.com: The file is being checked. Waiting 1 minute.") + self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.") self.setWait(61) self.wait() self.retry() @@ -43,7 +43,7 @@ class DepositfilesCom(SimpleHoster): wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) if wait: wait_time = int(wait.group(1)) - self.log.info( "%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time) ) + self.logInfo( "%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time) ) self.setWait(wait_time) self.wantReconnect = True self.wait() @@ -52,7 +52,7 @@ class DepositfilesCom(SimpleHoster): wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) if wait: wait_time = int(wait.group(1)) - self.log.info( "%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time) ) + self.logInfo( "%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time) ) self.setWait(wait_time * 60, False) wait = re.search(r'Please wait (\d+) sec', self.html) diff --git a/pyload/plugins/hoster/FileApeCom.py b/pyload/plugins/hoster/FileApeCom.py index 1f933e776..f5182a788 100644 --- a/pyload/plugins/hoster/FileApeCom.py +++ b/pyload/plugins/hoster/FileApeCom.py @@ -9,7 +9,7 @@ class FileApeCom(Hoster): __name__ = "FileApeCom" __type__ = "hoster" __pattern__ = r"http://(www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+" - __version__ = "0.1" + __version__ = "0.11" __description__ = """FileApe Download Hoster""" __author_name__ = ("espes") @@ -58,5 +58,5 @@ class FileApeCom(Hoster): check = self.checkDownload({"exp": "Download ticket expired"}) if check == "exp": - self.log.info("Ticket expired, retrying...") + self.logInfo("Ticket expired, retrying...") self.retry()
\ No newline at end of file diff --git a/pyload/plugins/hoster/FilesMailRu.py b/pyload/plugins/hoster/FilesMailRu.py index ee4ea4953..c7232f5dd 100644 --- a/pyload/plugins/hoster/FilesMailRu.py +++ b/pyload/plugins/hoster/FilesMailRu.py @@ -31,7 +31,7 @@ class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" __pattern__ = r"http://files\.mail\.ru/.*" - __version__ = "0.3" + __version__ = "0.31" __description__ = """Files.Mail.Ru One-Klick Hoster""" __author_name__ = ("oZiRiz") __author_mail__ = ("ich@oziriz.de") @@ -95,5 +95,5 @@ class FilesMailRu(Hoster): # (Loading 100MB in to ram is not an option) check = self.checkDownload({"html": "<meta name="}, read_size=50000) if check == "html": - self.log.info(_("There was HTML Code in the Downloaded File("+ self.pyfile.name +")...redirect error? The Download will be restarted.")) + self.logInfo(_("There was HTML Code in the Downloaded File(%s)...redirect error? The Download will be restarted." % self.pyfile.name)) self.retry() diff --git a/pyload/plugins/hoster/MultiDebridCom.py b/pyload/plugins/hoster/MultiDebridCom.py index ca98e8a0e..7280504cb 100644 --- a/pyload/plugins/hoster/MultiDebridCom.py +++ b/pyload/plugins/hoster/MultiDebridCom.py @@ -23,7 +23,7 @@ from module.common.json_layer import json_loads class MultiDebridCom(Hoster): __name__ = "MultiDebridCom" - __version__ = "0.01" + __version__ = "0.02" __type__ = "hoster" __pattern__ = r"http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/" __description__ = """Multi-debrid.com hoster plugin""" @@ -36,7 +36,7 @@ class MultiDebridCom(Hoster): def process(self, pyfile): if not self.account: - self.logError("Please enter your Multi-debrid.com account or deactivate this plugin") + self.logError(_("Please enter your %s account or deactivate this plugin") % "Multi-debrid.com") self.fail("No Multi-debrid.com account provided") self.logDebug("Original URL: %s" % pyfile.url) diff --git a/pyload/plugins/hoster/NetloadIn.py b/pyload/plugins/hoster/NetloadIn.py index 39338c88d..c59080158 100644 --- a/pyload/plugins/hoster/NetloadIn.py +++ b/pyload/plugins/hoster/NetloadIn.py @@ -53,7 +53,7 @@ class NetloadIn(Hoster): __name__ = "NetloadIn" __type__ = "hoster" __pattern__ = r"https?://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)" - __version__ = "0.42" + __version__ = "0.43" __description__ = """Netload.in Download Hoster""" __author_name__ = ("spoob", "RaNaN", "Gregy") __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") @@ -78,7 +78,7 @@ class NetloadIn(Hoster): self.pyfile.name = self.api_data["filename"] if self.premium: - self.log.debug("Netload: Use Premium Account") + self.logDebug("Netload: Use Premium Account") return True if self.download_html(): @@ -107,7 +107,7 @@ class NetloadIn(Hoster): self.download_api_data(n+1) return - self.log.debug("Netload: APIDATA: "+src) + self.logDebug("Netload: APIDATA: "+src) self.api_data = {} if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): lines = src.split(";") @@ -129,21 +129,21 @@ class NetloadIn(Hoster): def final_wait(self, page): wait_time = self.get_wait_time(page) self.setWait(wait_time) - self.log.debug("Netload: final wait %d seconds" % wait_time) + self.logDebug("Netload: final wait %d seconds" % wait_time) self.wait() self.url = self.get_file_url(page) def download_html(self): - self.log.debug("Netload: Entering download_html") + self.logDebug("Netload: Entering download_html") page = self.load(self.url, decode=True) t = time() + 30 if "/share/templates/download_hddcrash.tpl" in page: - self.log.error("Netload HDD Crash") + self.logError("Netload HDD Crash") self.fail(_("File temporarily not available")) if not self.api_data: - self.log.debug("API Data may be useless, get details from html page") + self.logDebug("API Data may be useless, get details from html page") if "* The file was deleted" in page: self.offline() @@ -163,21 +163,21 @@ class NetloadIn(Hoster): t = time() + 30 if "/share/templates/download_hddcrash.tpl" in page: - self.log.error("Netload HDD Crash") + self.logError("Netload HDD Crash") self.fail(_("File temporarily not available")) - self.log.debug("Netload: try number %d " % i) + self.logDebug("Netload: try number %d " % i) if ">Your download is being prepared.<" in page: - self.log.debug("Netload: We will prepare your download") + self.logDebug("Netload: We will prepare your download") self.final_wait(page) return True if ">An access request has been made from IP address <" in page: wait = self.get_wait_time(page) if wait == 0: - self.log.debug("Netload: Wait was 0 setting 30") + self.logDebug("Netload: Wait was 0 setting 30") wait = 30 - self.log.info(_("Netload: waiting between downloads %d s." % wait)) + self.logInfo(_("Netload: waiting between downloads %d s." % wait)) self.wantReconnect = True self.setWait(wait) self.wait() @@ -185,7 +185,7 @@ class NetloadIn(Hoster): return self.download_html() - self.log.debug("Netload: Trying to find captcha") + self.logDebug("Netload: Trying to find captcha") try: url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") @@ -197,7 +197,7 @@ class NetloadIn(Hoster): page = self.load(url_captcha_html, cookies=True) captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1) except: - self.log.debug("Netload: Could not find captcha, try again from beginning") + self.logDebug("Netload: Could not find captcha, try again from beginning") captchawaited = False continue @@ -206,7 +206,7 @@ class NetloadIn(Hoster): wait = self.get_wait_time(page) if i == 0: self.pyfile.waitUntil = time() # don't wait contrary to time on web site else: self.pyfile.waitUntil = t - self.log.info(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time())) + self.logInfo(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time())) #self.setWait(wait) self.wait() captchawaited = True @@ -224,12 +224,12 @@ class NetloadIn(Hoster): if attempt is not None: return attempt.group(1) else: - self.log.debug("Netload: Backup try for final link") + self.logDebug("Netload: Backup try for final link") file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here" attempt = re.search(file_url_pattern, page) return "http://netload.in/"+attempt.group(1) except: - self.log.debug("Netload: Getting final link failed") + self.logDebug("Netload: Getting final link failed") return None def get_wait_time(self, page): @@ -238,7 +238,7 @@ class NetloadIn(Hoster): def proceed(self, url): - self.log.debug("Netload: Downloading..") + self.logDebug("Netload: Downloading..") self.download(url, disposition=True) diff --git a/pyload/plugins/hoster/Premium4Me.py b/pyload/plugins/hoster/Premium4Me.py index 582e3fc3a..0bdb22bd7 100644 --- a/pyload/plugins/hoster/Premium4Me.py +++ b/pyload/plugins/hoster/Premium4Me.py @@ -10,7 +10,7 @@ from pyload.utils.fs import fs_encode class Premium4Me(Hoster): __name__ = "Premium4Me" - __version__ = "0.07" + __version__ = "0.08" __type__ = "hoster" __pattern__ = r"http://premium.to/.*" @@ -24,7 +24,7 @@ class Premium4Me(Hoster): def process(self, pyfile): if not self.account: - self.logError(_("Please enter your premium.to account or deactivate this plugin")) + self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to") self.fail("No premium.to account provided") self.logDebug("premium.to: Old URL: %s" % pyfile.url) diff --git a/pyload/plugins/hoster/PremiumizeMe.py b/pyload/plugins/hoster/PremiumizeMe.py index 85be4ec72..7f332e58b 100644 --- a/pyload/plugins/hoster/PremiumizeMe.py +++ b/pyload/plugins/hoster/PremiumizeMe.py @@ -3,7 +3,7 @@ from pyload.utils import json_loads class PremiumizeMe(Hoster): __name__ = "PremiumizeMe" - __version__ = "0.11" + __version__ = "0.12" __type__ = "hoster" __description__ = """Premiumize.Me hoster plugin""" @@ -16,7 +16,7 @@ class PremiumizeMe(Hoster): def process(self, pyfile): # Check account if not self.account or not self.account.isUsable(): - self.logError(_("Please enter a valid premiumize.me account or deactivate this plugin")) + self.logError(_("Please enter your %s account or deactivate this plugin") % "premiumize.me") self.fail("No valid premiumize.me account provided") # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare) diff --git a/pyload/plugins/hoster/RapidshareCom.py b/pyload/plugins/hoster/RapidshareCom.py index 6aacd684e..150dd425d 100644 --- a/pyload/plugins/hoster/RapidshareCom.py +++ b/pyload/plugins/hoster/RapidshareCom.py @@ -50,7 +50,7 @@ class RapidshareCom(Hoster): __name__ = "RapidshareCom" __type__ = "hoster" __pattern__ = r"https?://[\w\.]*?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))" - __version__ = "1.38" + __version__ = "1.39" __description__ = """Rapidshare.com Download Hoster""" __config__ = [("server", "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera", "Preferred Server", "None")] __author_name__ = ("spoob", "RaNaN", "mkaay") @@ -93,7 +93,7 @@ class RapidshareCom(Hoster): self.handleFree() elif self.api_data["status"] == "2": - self.log.info(_("Rapidshare: Traffic Share (direct download)")) + self.logInfo(_("Rapidshare: Traffic Share (direct download)")) self.pyfile.name = self.get_file_name() self.download(self.pyfile.url, get={"directstart":1}) @@ -113,24 +113,24 @@ class RapidshareCom(Hoster): #tmp = "#!download|%(server)s|%(id)s|%(name)s|%(size)s" download = "http://%(host)s/cgi-bin/rsapi.cgi?sub=download&editparentlocation=0&bin=1&fileid=%(id)s&filename=%(name)s&dlauth=%(auth)s" % self.dl_dict - self.log.debug("RS API Request: %s" % download) + self.logDebug("RS API Request: %s" % download) self.download(download, ref=False) check = self.checkDownload({"ip" : "You need RapidPro to download more files from your IP address", "auth" : "Download auth invalid"}) if check == "ip": self.setWait(60) - self.log.info(_("Already downloading from this ip address, waiting 60 seconds")) + self.logInfo(_("Already downloading from this ip address, waiting 60 seconds")) self.wait() self.handleFree() elif check == "auth": - self.log.info(_("Invalid Auth Code, download will be restarted")) + self.logInfo(_("Invalid Auth Code, download will be restarted")) self.offset += 5 self.handleFree() def handlePremium(self): - info = self.account.getAccountInfo(True) - self.log.debug("%s: Use Premium Account" % self.__name__) + info = self.account.getAccountInfo(self.user, True) + self.logDebug("%s: Use Premium Account" % self.__name__) url = self.api_data["mirror"] self.download(url, get={"directstart":1}) @@ -144,7 +144,7 @@ class RapidshareCom(Hoster): api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_file = {"sub": "checkfiles", "incmd5": "1", "files": self.id, "filenames": self.name} src = self.load(api_url_base, cookies=False, get=api_param_file).strip() - self.log.debug("RS INFO API: %s" % src) + self.logDebug("RS INFO API: %s" % src) if src.startswith("ERROR"): return fields = src.split(",") @@ -178,19 +178,19 @@ class RapidshareCom(Hoster): prepare = "https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=%(id)s&filename=%(name)s&try=1&cbf=RSAPIDispatcher&cbid=1" % {"name": name, "id" : id} - self.log.debug("RS API Request: %s" % prepare) + self.logDebug("RS API Request: %s" % prepare) result = self.load(prepare, ref=False) - self.log.debug("RS API Result: %s" % result) + self.logDebug("RS API Result: %s" % result) between_wait = re.search("You need to wait (\d+) seconds", result) 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.logInfo(_("Already downloading from this ip address, waiting 60 seconds")) self.wait() elif "Too many users downloading from this server right now" in result or "All free download slots are full" in result: self.setWait(120) - self.log.info(_("RapidShareCom: No free slots")) + self.logInfo(_("RapidShareCom: No free slots")) self.wait() elif "This file is too big to download it for free" in result: self.fail(_("You need a premium account for this file")) diff --git a/pyload/plugins/hoster/RealdebridCom.py b/pyload/plugins/hoster/RealdebridCom.py index 3c796232e..73baff5b3 100644 --- a/pyload/plugins/hoster/RealdebridCom.py +++ b/pyload/plugins/hoster/RealdebridCom.py @@ -12,7 +12,7 @@ from module.plugins.Hoster import Hoster class RealdebridCom(Hoster): __name__ = "RealdebridCom" - __version__ = "0.49" + __version__ = "0.51" __type__ = "hoster" __pattern__ = r"https?://.*real-debrid\..*" @@ -37,10 +37,10 @@ class RealdebridCom(Hoster): def process(self, pyfile): if not self.account: - self.logError(_("Please enter your Real-debrid account or deactivate this plugin")) + self.logError(_("Please enter your %s account or deactivate this plugin") % "Real-debrid") self.fail("No Real-debrid account provided") - self.log.debug("Real-Debrid: Old URL: %s" % pyfile.url) + self.logDebug("Real-Debrid: Old URL: %s" % pyfile.url) if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url else: @@ -71,7 +71,7 @@ class RealdebridCom(Hoster): else: new_url = new_url.replace("https://", "http://") - self.log.debug("Real-Debrid: New URL: %s" % new_url) + self.logDebug("Real-Debrid: New URL: %s" % new_url) if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): #only use when name wasnt already set diff --git a/pyload/plugins/hoster/RehostTo.py b/pyload/plugins/hoster/RehostTo.py index 141dcb8c8..7d1b1c3ea 100644 --- a/pyload/plugins/hoster/RehostTo.py +++ b/pyload/plugins/hoster/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.Hoster import Hoster class RehostTo(Hoster): __name__ = "RehostTo" - __version__ = "0.11" + __version__ = "0.13" __type__ = "hoster" __pattern__ = r"https?://.*rehost.to\..*" __description__ = """rehost.com hoster plugin""" @@ -22,13 +22,13 @@ class RehostTo(Hoster): def process(self, pyfile): if not self.account: - self.log.error(_("Please enter your rehost.to account or deactivate this plugin")) + self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to") self.fail("No rehost.to account provided") data = self.account.getAccountInfo(self.user) long_ses = data["long_ses"] - self.log.debug("Rehost.to: Old URL: %s" % pyfile.url) + self.logDebug("Rehost.to: Old URL: %s" % pyfile.url) new_url = "http://rehost.to/process_download.php?user=cookie&pass=%s&dl=%s" % (long_ses, quote(pyfile.url, "")) #raise timeout to 2min diff --git a/pyload/plugins/hoster/ReloadCc.py b/pyload/plugins/hoster/ReloadCc.py index 7dc6d9bb6..b39c2812c 100644 --- a/pyload/plugins/hoster/ReloadCc.py +++ b/pyload/plugins/hoster/ReloadCc.py @@ -6,7 +6,7 @@ from module.network.HTTPRequest import BadHeader class ReloadCc(Hoster): __name__ = "ReloadCc" - __version__ = "0.4" + __version__ = "0.5" __type__ = "hoster" __description__ = """Reload.Cc hoster plugin""" @@ -19,7 +19,7 @@ class ReloadCc(Hoster): def process(self, pyfile): # Check account if not self.account or not self.account.canUse(): - self.logError("Please enter a valid reload.cc account or deactivate this plugin") + self.logError(_("Please enter your %s account or deactivate this plugin") % "reload.cc") self.fail("No valid reload.cc account provided") # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare) diff --git a/pyload/plugins/hoster/ShareplaceCom.py b/pyload/plugins/hoster/ShareplaceCom.py index 1d4441925..c55f6703a 100644 --- a/pyload/plugins/hoster/ShareplaceCom.py +++ b/pyload/plugins/hoster/ShareplaceCom.py @@ -9,7 +9,7 @@ class ShareplaceCom(Hoster): __name__ = "ShareplaceCom" __type__ = "hoster" __pattern__ = r"(http://)?(www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+" - __version__ = "0.1" + __version__ = "0.11" __description__ = """Shareplace.com Download Hoster""" __author_name__ = ("ACCakut, based on YourfilesTo by jeix and skydancer") __author_mail__ = ("none") @@ -31,7 +31,7 @@ class ShareplaceCom(Hoster): wait_time = self.get_waiting_time() self.setWait(wait_time) - self.log.debug("%s: Waiting %d seconds." % (self.__name__,wait_time)) + self.logDebug("%s: Waiting %d seconds." % (self.__name__,wait_time)) self.wait() def get_waiting_time(self): diff --git a/pyload/plugins/hoster/UlozTo.py b/pyload/plugins/hoster/UlozTo.py index 5c38fdaad..1c3891eb1 100644 --- a/pyload/plugins/hoster/UlozTo.py +++ b/pyload/plugins/hoster/UlozTo.py @@ -27,7 +27,7 @@ class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" __pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?:live/)?(?P<id>\w+/[^/?]*)" - __version__ = "0.92" + __version__ = "0.93" __description__ = """uloz.to""" __author_name__ = ("zoidberg") @@ -101,7 +101,7 @@ class UlozTo(SimpleHoster): captcha_id = inputs[captcha_id_field] captcha_text = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % captcha_id) - self.log.debug(' CAPTCHA ID:' + captcha_id + ' CAPTCHA TEXT:' + captcha_text) + self.logDebug(' CAPTCHA ID:' + captcha_id + ' CAPTCHA TEXT:' + captcha_text) """ self.setStorage("captcha_id", captcha_id) diff --git a/pyload/plugins/hoster/UploadedTo.py b/pyload/plugins/hoster/UploadedTo.py index 4ae075cfa..f38336773 100644 --- a/pyload/plugins/hoster/UploadedTo.py +++ b/pyload/plugins/hoster/UploadedTo.py @@ -7,10 +7,11 @@ import re from time import sleep -from module.utils import html_unescape, parseFileSize, chunks +from module.utils import html_unescape, parseFileSize from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL +from module.plugins.Plugin import chunks from module.plugins.internal.CaptchaService import ReCaptcha key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64') @@ -87,7 +88,7 @@ class UploadedTo(Hoster): __name__ = "UploadedTo" __type__ = "hoster" __pattern__ = r"https?://[\w\.-]*?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)" - __version__ = "0.70" + __version__ = "0.71" __description__ = """Uploaded.net Download Hoster""" __author_name__ = ("spoob", "mkaay", "zoidberg", "netpok", "stickell") __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "netpok@gmail.com", "l.stickell@yahoo.it") @@ -153,10 +154,10 @@ class UploadedTo(Hoster): def handlePremium(self): info = self.account.getAccountInfo(self.user, True) - self.log.debug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, + self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, "left": info["trafficleft"] / 1024 / 1024}) if int(self.data[1]) / 1024 > info["trafficleft"]: - self.log.info(_("%s: Not enough traffic left" % self.__name__)) + self.logInfo(_("%s: Not enough traffic left" % self.__name__)) self.account.empty(self.user) self.resetAccount() self.fail(_("Traffic exceeded")) diff --git a/pyload/plugins/hoster/UploadheroCom.py b/pyload/plugins/hoster/UploadheroCom.py index a2348b9f9..65d6cc4e9 100644 --- a/pyload/plugins/hoster/UploadheroCom.py +++ b/pyload/plugins/hoster/UploadheroCom.py @@ -26,7 +26,7 @@ class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?uploadhero\.com?/dl/\w+" - __version__ = "0.13" + __version__ = "0.14" __description__ = """UploadHero.com plugin""" __author_name__ = ("mcmyst", "zoidberg") __author_mail__ = ("mcmyst@hotmail.fr", "zoidberg@mujmail.cz") @@ -67,10 +67,10 @@ class UploadheroCom(SimpleHoster): self.download(download_url) def handlePremium(self): - self.log.debug("%s: Use Premium Account" % self.__name__) + self.logDebug("%s: Use Premium Account" % self.__name__) self.html = self.load(self.pyfile.url) link = re.search(self.DOWNLOAD_URL_PATTERN, self.html).group(1) - self.log.debug("Downloading link : '%s'" % link) + self.logDebug("Downloading link : '%s'" % link) self.download(link) def checkErrors(self): diff --git a/pyload/plugins/hoster/UploadingCom.py b/pyload/plugins/hoster/UploadingCom.py index 84040eb4d..a98c3bf71 100644 --- a/pyload/plugins/hoster/UploadingCom.py +++ b/pyload/plugins/hoster/UploadingCom.py @@ -26,7 +26,7 @@ class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)" - __version__ = "0.32" + __version__ = "0.33" __description__ = """Uploading.Com File Download Hoster""" __author_name__ = ("jeix", "mkaay", "zoidberg") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz") @@ -80,7 +80,7 @@ class UploadingCom(SimpleHoster): response = json_loads(self.load(ajax_url, post = {'action': 'second_page', 'code': self.file_info['ID']})) if 'answer' in response and 'wait_time' in response['answer']: wait_time = int(response['answer']['wait_time']) - self.log.info("%s: Waiting %d seconds." % (self.__name__, wait_time)) + self.logInfo("%s: Waiting %d seconds." % (self.__name__, wait_time)) self.setWait(wait_time) self.wait() else: diff --git a/pyload/plugins/hoster/VeehdCom.py b/pyload/plugins/hoster/VeehdCom.py index d4422afc3..4486eb84a 100644 --- a/pyload/plugins/hoster/VeehdCom.py +++ b/pyload/plugins/hoster/VeehdCom.py @@ -11,13 +11,13 @@ class VeehdCom(Hoster): ('filename_spaces', 'bool', "Allow spaces in filename", 'False'), ('replacement_char', 'str', "Filename replacement character", '_'), ] - __version__ = '0.21' + __version__ = '0.22' __description__ = """Veehd.com Download Hoster""" __author_name__ = ('cat') __author_mail__ = ('cat@pyload') def _debug(self, msg): - self.log.debug('[%s] %s' % (self.__name__, msg)) + self.logDebug('[%s] %s' % (self.__name__, msg)) def setup(self): self.html = None diff --git a/pyload/plugins/hoster/WuploadCom.py b/pyload/plugins/hoster/WuploadCom.py index 5bc5e9ac7..3dab1b1bb 100644 --- a/pyload/plugins/hoster/WuploadCom.py +++ b/pyload/plugins/hoster/WuploadCom.py @@ -47,7 +47,7 @@ class WuploadCom(Hoster): __name__ = "WuploadCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?wupload\..*?/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?" - __version__ = "0.20" + __version__ = "0.21" __description__ = """Wupload com""" __author_name__ = ("jeix", "paulking") __author_mail__ = ("jeix@hasnomail.de", "") @@ -113,7 +113,7 @@ class WuploadCom(Hoster): def getDomain(self): result = json_loads( self.load(self.API_ADDRESS + "/utility?method=getWuploadDomainForCurrentIp&format=json", decode=True)) - self.log.debug("%s: response to get domain %s" % (self.__name__, result)) + self.logDebug("%s: response to get domain %s" % (self.__name__, result)) return result["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"] def downloadPremium(self): diff --git a/pyload/plugins/hoster/Xdcc.py b/pyload/plugins/hoster/Xdcc.py index 723623f52..d0630bd29 100644 --- a/pyload/plugins/hoster/Xdcc.py +++ b/pyload/plugins/hoster/Xdcc.py @@ -32,7 +32,7 @@ from module.plugins.Hoster import Hoster class Xdcc(Hoster): __name__ = "Xdcc" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'xdcc://.*?(/#?.*?)?/.*?/#?\d+/?' # xdcc://irc.Abjects.net/#channel/[XDCC]|Shit/#0004/ __type__ = "hoster" __config__ = [ @@ -59,7 +59,7 @@ class Xdcc(Hoster): for i in range(0,3): try: nmn = self.doDownload(pyfile.url) - self.log.debug("%s: Download of %s finished." % (self.__name__, nmn)) + self.logDebug("%s: Download of %s finished." % (self.__name__, nmn)) return except socket.error, e: if hasattr(e, "errno"): @@ -68,7 +68,7 @@ class Xdcc(Hoster): errno = e.args[0] if errno in (10054,): - self.log.debug("XDCC: Server blocked our ip, retry in 5 min") + self.logDebug("XDCC: Server blocked our ip, retry in 5 min") self.setWait(300) self.wait() continue @@ -176,10 +176,10 @@ class Xdcc(Hoster): if nick == msg["target"][0:len(nick)] and "PRIVMSG" == msg["action"]: if msg["text"] == "\x01VERSION\x01": - self.log.debug("XDCC: Sending CTCP VERSION.") + self.logDebug("XDCC: Sending CTCP VERSION.") sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) elif msg["text"] == "\x01TIME\x01": - self.log.debug("Sending CTCP TIME.") + self.logDebug("Sending CTCP TIME.") sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) elif msg["text"] == "\x01LAG\x01": pass # don't know how to answer @@ -212,12 +212,12 @@ class Xdcc(Hoster): self.pyfile.name = packname filename = save_join(location, packname) - self.log.info("XDCC: Downloading %s from %s:%d" % (packname, ip, port)) + self.logInfo("XDCC: Downloading %s from %s:%d" % (packname, ip, port)) self.pyfile.setStatus("downloading") newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress) if newname and newname != filename: - self.log.info("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname}) + self.logInfo("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname}) filename = newname # kill IRC socket diff --git a/pyload/plugins/hoster/YourfilesTo.py b/pyload/plugins/hoster/YourfilesTo.py index 7a8f327ca..4a192b32a 100644 --- a/pyload/plugins/hoster/YourfilesTo.py +++ b/pyload/plugins/hoster/YourfilesTo.py @@ -9,7 +9,7 @@ class YourfilesTo(Hoster): __name__ = "YourfilesTo" __type__ = "hoster" __pattern__ = r"(http://)?(www\.)?yourfiles\.(to|biz)/\?d=[a-zA-Z0-9]+" - __version__ = "0.2" + __version__ = "0.21" __description__ = """Youfiles.to Download Hoster""" __author_name__ = ("jeix", "skydancer") __author_mail__ = ("jeix@hasnomail.de", "skydancer@hasnomail.de") @@ -31,7 +31,7 @@ class YourfilesTo(Hoster): wait_time = self.get_waiting_time() self.setWait(wait_time) - self.log.debug("%s: Waiting %d seconds." % (self.__name__,wait_time)) + self.logDebug("%s: Waiting %d seconds." % (self.__name__,wait_time)) self.wait() def get_waiting_time(self): diff --git a/pyload/plugins/hoster/ZeveraCom.py b/pyload/plugins/hoster/ZeveraCom.py index 8be725d2f..92f9e4dcd 100644 --- a/pyload/plugins/hoster/ZeveraCom.py +++ b/pyload/plugins/hoster/ZeveraCom.py @@ -8,7 +8,7 @@ from time import sleep class ZeveraCom(Hoster): __name__ = "ZeveraCom" - __version__ = "0.20" + __version__ = "0.21" __type__ = "hoster" __pattern__ = r"http://zevera.com/.*" __description__ = """zevera.com hoster plugin""" @@ -21,7 +21,7 @@ class ZeveraCom(Hoster): def process(self, pyfile): if not self.account: - self.logError(_("Please enter your zevera.com account or deactivate this plugin")) + self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com") self.fail("No zevera.com account provided") self.logDebug("zevera.com: Old URL: %s" % pyfile.url) diff --git a/pyload/plugins/internal/SimpleCrypter.py b/pyload/plugins/internal/SimpleCrypter.py index d935bf1da..546b920e0 100644 --- a/pyload/plugins/internal/SimpleCrypter.py +++ b/pyload/plugins/internal/SimpleCrypter.py @@ -25,7 +25,7 @@ from module.utils import html_unescape class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = None __type__ = "crypter" __description__ = """Base crypter plugin""" @@ -39,6 +39,15 @@ class SimpleCrypter(Crypter): TITLE_PATTERN: (optional) the group defined by 'title' should be the title example: <title>Files of: (?P<title>[^<]+) folder</title> + + If the links are disposed on multiple pages you need to define a pattern: + + PAGES_PATTERN: the group defined by 'pages' must be the total number of pages + + and a function: + + loadPage(self, page_n): + must return the html of the page number 'page_n' """ def decrypt(self, pyfile): @@ -46,11 +55,15 @@ class SimpleCrypter(Crypter): package_name, folder_name = self.getPackageNameAndFolder() - package_links = re.findall(self.LINK_PATTERN, self.html) - self.logDebug('Package has %d links' % len(package_links)) + self.package_links = re.findall(self.LINK_PATTERN, self.html) + + if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'): + self.handleMultiPages() - if package_links: - self.packages = [(package_name, package_links, folder_name)] + self.logDebug('Package has %d links' % len(self.package_links)) + + if self.package_links: + self.packages = [(package_name, self.package_links, folder_name)] else: self.fail('Could not extract any links') @@ -66,3 +79,14 @@ class SimpleCrypter(Crypter): folder = self.pyfile.package().folder self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) return name, folder + + def handleMultiPages(self): + pages = re.search(self.PAGES_PATTERN, self.html) + if pages: + pages = int(pages.group('pages')) + else: + pages = 1 + + for p in range(2, pages + 1): + self.html = self.loadPage(p) + self.package_links += re.findall(self.LINK_PATTERN, self.html) |