diff options
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/AntiVirus.py | 3 | ||||
-rw-r--r-- | module/plugins/hooks/Checksum.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/ClickAndLoad.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/DeleteFinished.py | 14 | ||||
-rw-r--r-- | module/plugins/hooks/DownloadScheduler.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 18 | ||||
-rw-r--r-- | module/plugins/hooks/IRCInterface.py | 6 | ||||
-rw-r--r-- | module/plugins/hooks/PremiumizeMeHook.py | 10 | ||||
-rw-r--r-- | module/plugins/hooks/RPNetBizHook.py | 6 | ||||
-rw-r--r-- | module/plugins/hooks/RestartFailed.py | 22 | ||||
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/UnSkipOnFail.py | 17 | ||||
-rw-r--r-- | module/plugins/hooks/UpdateManager.py | 16 | ||||
-rw-r--r-- | module/plugins/hooks/XFileSharingPro.py | 22 | ||||
-rw-r--r-- | module/plugins/hooks/XMPPInterface.py | 10 |
15 files changed, 77 insertions, 80 deletions
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 1faa6ebe3..02b1df67b 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -113,7 +113,6 @@ class AntiVirus(Hook): def download_failed(self, pyfile): - #: Check if pyfile is still "failed", - # maybe might has been restarted in meantime + #: Check if pyfile is still "failed", maybe might has been restarted in meantime if pyfile.status == 8 and self.getConfig('scanfailed'): return self.scan(pyfile) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 912a1ba1f..df81be384 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -110,7 +110,7 @@ class Checksum(Hook): if not os.path.isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") - # validate file size + #: validate file size if "size" in data: api_size = int(data['size']) file_size = os.path.getsize(local_file) @@ -121,7 +121,7 @@ class Checksum(Hook): data.pop('size', None) - # validate checksum + #: validate checksum if data and self.getConfig('check_checksum'): if not 'md5' in data: diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index f7431ebac..b1009420a 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -22,7 +22,7 @@ def forward(source, destination): bufdata = source.recv(bufsize) finally: destination.shutdown(socket.SHUT_WR) - # destination.close() + #: destination.close() #@TODO: IPv6 support diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index 86532cdad..a3e171a43 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -23,7 +23,7 @@ class DeleteFinished(Hook): ## overwritten methods ## def setup(self): self.info = {} #@TODO: Remove in 0.4.10 - # self.event_list = ["pluginConfigChanged"] + #: self.event_list = ["pluginConfigChanged"] self.interval = self.MIN_CHECK_INTERVAL @@ -38,10 +38,10 @@ class DeleteFinished(Hook): self.addEvent('package_finished', self.wakeup) - # def pluginConfigChanged(self, plugin, name, value): - # if name == "interval" and value != self.interval: - # self.interval = value * 3600 - # self.init_periodical() + #: def pluginConfigChanged(self, plugin, name, value): + #: if name == "interval" and value != self.interval: + #: self.interval = value * 3600 + #: self.init_periodical() def deactivate(self): @@ -50,8 +50,8 @@ class DeleteFinished(Hook): def activate(self): self.info['sleep'] = True - # interval = self.getConfig('interval') - # self.pluginConfigChanged(self.__name__, 'interval', interval) + #: interval = self.getConfig('interval') + #: self.pluginConfigChanged(self.__name__, 'interval', interval) self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60 * 60) self.addEvent('package_finished', self.wakeup) diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index 773de7c4b..0ccc8a0ec 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -26,7 +26,7 @@ class DownloadScheduler(Hook): def setup(self): self.info = {} #@TODO: Remove in 0.4.10 - self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded + self.cb = None #: callback to scheduler job; will be by removed hookmanager when hook unloaded def activate(self): diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index ee41068eb..925976bc6 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -23,7 +23,7 @@ if sys.version_info < (2, 7) and os.name != "nt": raise - # unsued timeout option for older python version + #: unsued timeout option for older python version def wait(self, timeout=0): """ Wait for child process to terminate. Returns returncode @@ -36,9 +36,9 @@ if sys.version_info < (2, 7) and os.name != "nt": except OSError, e: if e.errno != errno.ECHILD: raise - # This happens if SIGCLD is set to be ignored or waiting - # for child processes has otherwise been disabled for our - # process. This child is dead, we can't get the status. + #: This happens if SIGCLD is set to be ignored or waiting + #: for child processes has otherwise been disabled for our + #: process. This child is dead, we can't get the status. sts = 0 self._handle_exitstatus(sts) return self.returncode @@ -262,12 +262,12 @@ class ExtractArchive(Hook): if extensions: self.logDebug("Use for extensions: %s" % "|.".join(extensions)) - # reload from txt file + #: reload from txt file self.reloadPasswords() download_folder = self.core.config.get("general", "download_folder") - # iterate packages -> extractors -> targets + #: iterate packages -> extractors -> targets for pid in ids: pypack = self.core.files.getPackage(pid) @@ -277,7 +277,7 @@ class ExtractArchive(Hook): self.logInfo(_("Check package: %s") % pypack.name) - # determine output folder + #: determine output folder out = fs_join(download_folder, pypack.folder, destination, "") #: force trailing slash if subfolder: @@ -291,7 +291,7 @@ class ExtractArchive(Hook): files_ids = dict((pylink['name'],((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: remove duplicates - # check as long there are unseen files + #: check as long there are unseen files while files_ids: new_files_ids = [] @@ -341,7 +341,7 @@ class ExtractArchive(Hook): success = False continue - # remove processed file and related multiparts from list + #: remove processed file and related multiparts from list files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ if fname not in archive.getDeleteFiles()] self.logDebug("Extracted files: %s" % new_files) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index d50fd6107..61922f657 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -84,7 +84,7 @@ class IRCInterface(Thread, Hook): def run(self): - # connect to IRC etc. + #: connect to IRC etc. self.sock = socket.socket() host = self.getConfig('host') self.sock.connect((host, self.getConfig('port'))) @@ -158,7 +158,7 @@ class IRCInterface(Thread, Hook): if msg['action'] != "PRIVMSG": return - # HANDLE CTCP ANTI FLOOD/BOT PROTECTION + #: HANDLE CTCP ANTI FLOOD/BOT PROTECTION if msg['text'] == "\x01VERSION\x01": self.logDebug("Sending CTCP VERSION") self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) @@ -344,7 +344,7 @@ class IRCInterface(Thread, Hook): return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack['name'], id)] except Exception: - # create new package + #: create new package id = self.core.api.addPackage(pack, links, 1) return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] diff --git a/module/plugins/hooks/PremiumizeMeHook.py b/module/plugins/hooks/PremiumizeMeHook.py index bc803b1f5..615c6c2d8 100644 --- a/module/plugins/hooks/PremiumizeMeHook.py +++ b/module/plugins/hooks/PremiumizeMeHook.py @@ -21,18 +21,18 @@ class PremiumizeMeHook(MultiHook): def getHosters(self): - # Get account data + #: Get account data user, data = self.account.selectAccount() - # Get supported hosters list from premiumize.me using the - # json API v1 (see https://secure.premiumize.me/?show=api) + #: Get supported hosters list from premiumize.me using the + #: json API v1 (see https://secure.premiumize.me/?show=api) answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 get={'method': "hosterlist", 'params[login]': user, 'params[pass]': data['password']}) data = json_loads(answer) - # If account is not valid thera are no hosters available + #: If account is not valid thera are no hosters available if data['status'] != 200: return [] - # Extract hosters from json file + #: Extract hosters from json file return data['result']['hosterlist'] diff --git a/module/plugins/hooks/RPNetBizHook.py b/module/plugins/hooks/RPNetBizHook.py index 872eb7e08..8b3dd6ea1 100644 --- a/module/plugins/hooks/RPNetBizHook.py +++ b/module/plugins/hooks/RPNetBizHook.py @@ -21,16 +21,16 @@ class RPNetBizHook(MultiHook): def getHosters(self): - # Get account data + #: Get account data user, data = self.account.selectAccount() res = self.load("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': data['password'], 'action': "showHosterList"}) hoster_list = json_loads(res) - # If account is not valid thera are no hosters available + #: If account is not valid thera are no hosters available if 'error' in hoster_list: return [] - # Extract hosters from json file + #: Extract hosters from json file return hoster_list['hosters'] diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index 153b4716c..0c74a544a 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -18,15 +18,15 @@ class RestartFailed(Hook): MIN_CHECK_INTERVAL = 15 * 60 #: 15 minutes - # def pluginConfigChanged(self, plugin, name, value): - # if name == "interval": - # interval = value * 60 - # if self.MIN_CHECK_INTERVAL <= interval != self.interval: - # self.core.scheduler.removeJob(self.cb) - # self.interval = interval - # self.init_periodical() - # else: - # self.logDebug("Invalid interval value, kept current") + #: def pluginConfigChanged(self, plugin, name, value): + #: if name == "interval": + #: interval = value * 60 + #: if self.MIN_CHECK_INTERVAL <= interval != self.interval: + #: self.core.scheduler.removeJob(self.cb) + #: self.interval = interval + #: self.init_periodical() + #: else: + #: self.logDebug("Invalid interval value, kept current") def periodical(self): @@ -36,10 +36,10 @@ class RestartFailed(Hook): def setup(self): self.info = {} #@TODO: Remove in 0.4.10 - # self.event_list = ["pluginConfigChanged"] + #: self.event_list = ["pluginConfigChanged"] self.interval = self.MIN_CHECK_INTERVAL def activate(self): - # self.pluginConfigChanged(self.__name__, "interval", self.getConfig('interval')) + #: self.pluginConfigChanged(self.__name__, "interval", self.getConfig('interval')) self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60) diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 32454d255..503833d53 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -79,14 +79,13 @@ class SkipRev(Hook): pyfile.setCustomStatus("SkipRev", "skipped") if not hasattr(pyfile.plugin, "_setup"): - # Work-around: inject status checker inside the preprocessing routine of the plugin + #: Work-around: inject status checker inside the preprocessing routine of the plugin pyfile.plugin._setup = pyfile.plugin.setup pyfile.plugin.setup = MethodType(self._setup, pyfile.plugin) def download_failed(self, pyfile): - #: Check if pyfile is still "failed", - # maybe might has been restarted in meantime + #: Check if pyfile is still "failed", maybe might has been restarted in meantime if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): return diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 9ba53a698..cbfbff1b6 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -24,8 +24,7 @@ class UnSkipOnFail(Hook): def download_failed(self, pyfile): - #: Check if pyfile is still "failed", - # maybe might has been restarted in meantime + #: Check if pyfile is still "failed", maybe might has been restarted in meantime if pyfile.status != 8: return @@ -36,13 +35,13 @@ class UnSkipOnFail(Hook): if link: self.logInfo(_("Queue found duplicate: %s (pid:%s)") % (link.name, link.packageID)) - #: Change status of "link" to "new_status". - # "link" has to be a valid FileData object, - # "new_status" has to be a valid status name - # (i.e. "queued" for this Plugin) - # It creates a temporary PyFile object using - # "link" data, changes its status, and tells - # the core.files-manager to save its data. + # Change status of "link" to "new_status". + # "link" has to be a valid FileData object, + # "new_status" has to be a valid status name + # (i.e. "queued" for this Plugin) + # It creates a temporary PyFile object using + # "link" data, changes its status, and tells + # the core.files-manager to save its data. pylink = self._pyfile(link) pylink.setCustomStatus(_("unskipped"), "queued") diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 0a89405e7..a06ed97e9 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -174,10 +174,10 @@ class UpdateManager(Hook): exitcode = 3 # Exit codes: - # -1 = No plugin updated, new pyLoad version available - # 0 = No plugin updated - # 1 = Plugins updated - # 2 = Plugins updated, but restart required + # -1 = No plugin updated, new pyLoad version available + # 0 = No plugin updated + # 1 = Plugins updated + # 2 = Plugins updated, but restart required return exitcode @@ -206,7 +206,7 @@ class UpdateManager(Hook): if blacklist: type_plugins = [(plugin['type'], plugin['name'].rsplit('.', 1)[0]) for plugin in blacklist] - # Protect UpdateManager from self-removing + #: Protect UpdateManager from self-removing try: type_plugins.remove(("hook", "UpdateManager")) except ValueError: @@ -286,9 +286,9 @@ class UpdateManager(Hook): self.logInfo(_("No plugin updates available")) # Exit codes: - # 0 = No plugin updated - # 1 = Plugins updated - # 2 = Plugins updated, but restart required + # 0 = No plugin updated + # 1 = Plugins updated + # 2 = Plugins updated, but restart required return exitcode diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 8ef5941d1..0c103b56a 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -44,13 +44,13 @@ class XFileSharingPro(Hook): CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] - # def pluginConfigChanged(self, plugin, name, value): - # self.loadPattern() + #: def pluginConfigChanged(self, plugin, name, value): + #: self.loadPattern() def setup(self): self.info = {} #@TODO: Remove in 0.4.10 - # self.event_list = ["pluginConfigChanged"] + #: self.event_list = ["pluginConfigChanged"] def activate(self): @@ -105,7 +105,7 @@ class XFileSharingPro(Hook): def deactivate(self): - # self.unloadHoster("BasePlugin") + #: self.unloadHoster("BasePlugin") for type, plugin in (("hoster", "XFileSharingPro"), ("crypter", "XFileSharingProFolder")): self._unload(type, plugin) @@ -126,10 +126,10 @@ class XFileSharingPro(Hook): return False - # def download_failed(self, pyfile): - # if pyfile.pluginname == "BasePlugin" \ - # and pyfile.hasStatus("failed") \ - # and not self.getConfig('use_hoster_list') \ - # and self.unloadHoster("BasePlugin"): - # self.logDebug("Unloaded XFileSharingPro from BasePlugin") - # pyfile.setStatus("queued") + #: def download_failed(self, pyfile): + #: if pyfile.pluginname == "BasePlugin" \ + #: and pyfile.hasStatus("failed") \ + #: and not self.getConfig('use_hoster_list') \ + #: and self.unloadHoster("BasePlugin"): + #: self.logDebug("Unloaded XFileSharingPro from BasePlugin") + #: pyfile.setStatus("queued") diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index 847fb26c3..10a03603e 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -36,7 +36,7 @@ class XMPPInterface(IRCInterface, JabberClient): self.jid = JID(self.getConfig('jid')) password = self.getConfig('pw') - # if bare JID is provided add a resource -- it is required + #: if bare JID is provided add a resource -- it is required if not self.jid.resource: self.jid = JID(self.jid.node, self.jid.domain, "pyLoad") @@ -47,8 +47,8 @@ class XMPPInterface(IRCInterface, JabberClient): tls_settings = None auth = ("sasl:DIGEST-MD5", "digest") - # setup client with provided connection information - # and identity data + #: setup client with provided connection information + #: and identity data JabberClient.__init__(self, self.jid, password, disco_name="pyLoad XMPP Client", disco_type="bot", tls_settings=tls_settings, auth_methods=auth) @@ -83,7 +83,7 @@ class XMPPInterface(IRCInterface, JabberClient): def run(self): - # connect to IRC etc. + #: connect to IRC etc. self.connect() try: self.loop() @@ -133,7 +133,7 @@ class XMPPInterface(IRCInterface, JabberClient): self.logDebug("Body: %s Subject: %s Type: %s" % (body, subject, t)) if t == "headline": - # 'headline' messages should never be replied to + #: 'headline' messages should never be replied to return True if subject: subject = u"Re: " + subject |