diff options
Diffstat (limited to 'module/plugins/hooks')
25 files changed, 96 insertions, 96 deletions
diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index c9493bfd0..e775b785b 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -67,7 +67,7 @@ class AndroidPhoneNotify(Hook): self.notify(_("Captcha"), _("New request waiting user input")) - def packageFinished(self, pypack): + def package_finished(self, pypack): if self.getConfig('notifypackage'): self.notify(_("Package finished"), pypack.name) diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 09872650f..1faa6ebe3 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -10,7 +10,7 @@ except ImportError: pass from module.plugins.internal.Hook import Hook, Expose, threaded -from module.utils import fs_encode, save_join +from module.utils import fs_encode, save_join as fs_join class AntiVirus(Hook): @@ -108,11 +108,11 @@ class AntiVirus(Hook): thread.finishFile(pyfile) - def downloadFinished(self, pyfile): + def download_finished(self, pyfile): return self.scan(pyfile) - def downloadFailed(self, pyfile): + def download_failed(self, pyfile): #: Check if pyfile is still "failed", # maybe might has been restarted in meantime if pyfile.status == 8 and self.getConfig('scanfailed'): diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 4b50ef800..bbbe96b73 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -118,12 +118,12 @@ class BypassCaptcha(Hook): self.logInfo(_("Your %s account has not enough credits") % self.__name__) - def captchaCorrect(self, task): + def captcha_correct(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], True) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], False) diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index ea15d7651..85bbb7924 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -246,9 +246,9 @@ class Captcha9Kw(Hook): self.logDebug("Could not send %s request: %s" % (type, res)) - def captchaCorrect(self, task): + def captcha_correct(self, task): self._captchaResponse(task, True) - def captchaInvalid(self, task): + def captcha_invalid(self, task): self._captchaResponse(task, False) diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index eecf49515..1f2bbf956 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -154,7 +154,7 @@ class CaptchaBrotherhood(Hook): self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: res = self.api_response("complainCaptcha", task.data['ticket']) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index f132c37d1..9287fda9c 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -8,7 +8,7 @@ import re import zlib from module.plugins.internal.Hook import Hook -from module.utils import save_join, fs_encode +from module.utils import save_join as fs_join, fs_encode def computeChecksum(local_file, algorithm): @@ -78,7 +78,7 @@ class Checksum(Hook): self.formats = self.algorithms + ["sfv", "crc", "hash"] - def downloadFinished(self, pyfile): + def download_finished(self, pyfile): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. pyfile.plugin.check_data should be a dictionary which can contain: @@ -104,8 +104,8 @@ class Checksum(Hook): self.checkFailed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.config['general']['download_folder'] - #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name)) + #download_folder = self.core.config['general']['download_folder'] + #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") @@ -164,8 +164,8 @@ class Checksum(Hook): pyfile.plugin.fail(reason=msg) - def packageFinished(self, pypack): - download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") + def package_finished(self, pypack): + download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = os.path.splitext(link['name'])[1][1:].lower() @@ -173,7 +173,7 @@ class Checksum(Hook): if file_type not in self.formats: continue - hash_file = fs_encode(save_join(download_folder, link['name'])) + hash_file = fs_encode(fs_join(download_folder, link['name'])) if not os.path.isfile(hash_file): self.logWarning(_("File not found"), link['name']) continue @@ -185,7 +185,7 @@ class Checksum(Hook): data = m.groupdict() self.logDebug(link['name'], data) - local_file = fs_encode(save_join(download_folder, data['NAME'])) + local_file = fs_encode(fs_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) if checksum == data['HASH']: diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index e9e231a28..81a446ef3 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -49,11 +49,11 @@ class ClickAndLoad(Hook): def activate(self): - if not self.config['webinterface']['activated']: + if not self.core.config['webinterface']['activated']: return ip = "" if self.getConfig('extern') else "127.0.0.1" - webport = self.config['webinterface']['port'] + webport = self.core.config['webinterface']['port'] cnlport = self.getConfig('port') self.proxy(ip, webport, cnlport) @@ -85,7 +85,7 @@ class ClickAndLoad(Hook): server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - if self.config['webinterface']['https']: + if self.core.config['webinterface']['https']: try: server_socket = ssl.wrap_socket(server_socket) diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 073f01d57..1ece35bdb 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -194,7 +194,7 @@ class DeathByCaptcha(Hook): self._processCaptcha(task) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: res = self.api_response("captcha/%d/report" % task.data['ticket'], True) diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index 29bd7a4e1..38d2a7ed0 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -35,17 +35,17 @@ class DeleteFinished(Hook): self.logInfo(msg % (_('including') if deloffline else _('excluding'))) self.deleteFinished(mode) self.info['sleep'] = True - self.addEvent('packageFinished', self.wakeup) + self.addEvent('package_finished', self.wakeup) # def pluginConfigChanged(self, plugin, name, value): # if name == "interval" and value != self.interval: # self.interval = value * 3600 - # self.initPeriodical() + # self.init_periodical() def deactivate(self): - self.manager.removeEvent('packageFinished', self.wakeup) + self.manager.removeEvent('package_finished', self.wakeup) def activate(self): @@ -53,7 +53,7 @@ class DeleteFinished(Hook): # interval = self.getConfig('interval') # self.pluginConfigChanged(self.__name__, 'interval', interval) self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60 * 60) - self.addEvent('packageFinished', self.wakeup) + self.addEvent('package_finished', self.wakeup) ## own methods ## @@ -64,7 +64,7 @@ class DeleteFinished(Hook): def wakeup(self, pypack): - self.manager.removeEvent('packageFinished', self.wakeup) + self.manager.removeEvent('package_finished', self.wakeup) self.info['sleep'] = False diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 8a2a836aa..13289f8d1 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -91,7 +91,7 @@ class ExpertDecoders(Hook): self.logInfo(_("Your ExpertDecoders Account has not enough credits")) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if "ticket" in task.data: try: diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 140dcb057..85df87a23 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -4,7 +4,7 @@ import os import subprocess from module.plugins.internal.Hook import Hook -from module.utils import fs_encode, save_join +from module.utils import fs_encode, save_join as fs_join class ExternalScripts(Hook): @@ -66,7 +66,7 @@ class ExternalScripts(Hook): return for filename in os.listdir(dir): - file = save_join(dir, filename) + file = fs_join(dir, filename) if not os.path.isfile(file): continue @@ -108,41 +108,41 @@ class ExternalScripts(Hook): self.callScript(script) - def beforeReconnecting(self, ip): + def before_reconnect(self, ip): for script in self.scripts['before_reconnect']: self.callScript(script, ip) self.info['oldip'] = ip - def afterReconnecting(self, ip): + def after_reconnect(self, ip): for script in self.scripts['after_reconnect']: self.callScript(script, ip, self.info['oldip']) #@TODO: Use built-in oldip in 0.4.10 - def downloadPreparing(self, pyfile): + def download_preparing(self, pyfile): for script in self.scripts['download_preparing']: self.callScript(script, pyfile.id, pyfile.name, None, pyfile.pluginname, pyfile.url) - def downloadFailed(self, pyfile): - if self.config['general']['folder_per_package']: - download_folder = save_join(self.config['general']['download_folder'], pyfile.package().folder) + def download_failed(self, pyfile): + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(self.core.config['general']['download_folder'], pyfile.package().folder) else: - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] for script in self.scripts['download_failed']: - file = save_join(download_folder, pyfile.name) + file = fs_join(download_folder, pyfile.name) self.callScript(script, pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url) - def downloadFinished(self, pyfile): - if self.config['general']['folder_per_package']: - download_folder = save_join(self.config['general']['download_folder'], pyfile.package().folder) + def download_finished(self, pyfile): + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(self.core.config['general']['download_folder'], pyfile.package().folder) else: - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] for script in self.scripts['download_finished']: - file = save_join(download_folder, pyfile.name) + file = fs_join(download_folder, pyfile.name) self.callScript(script, pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url) @@ -156,11 +156,11 @@ class ExternalScripts(Hook): self.callScript(script, pyfile.id, pyfile.name, archive.filename, archive.out, archive.files) - def packageFinished(self, pypack): - if self.config['general']['folder_per_package']: - download_folder = save_join(self.config['general']['download_folder'], pypack.folder) + def package_finished(self, pypack): + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder) else: - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] for script in self.scripts['package_finished']: self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password) @@ -169,30 +169,30 @@ class ExternalScripts(Hook): def packageDeleted(self, pid): pack = self.core.api.getPackageInfo(pid) - if self.config['general']['folder_per_package']: - download_folder = save_join(self.config['general']['download_folder'], pack.folder) + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(self.core.config['general']['download_folder'], pack.folder) else: - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] for script in self.scripts['package_deleted']: self.callScript(script, pack.id, pack.name, download_folder, pack.password) def package_extract_failed(self, pypack): - if self.config['general']['folder_per_package']: - download_folder = save_join(self.config['general']['download_folder'], pypack.folder) + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder) else: - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] for script in self.scripts['package_extract_failed']: self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password) def package_extracted(self, pypack): - if self.config['general']['folder_per_package']: - download_folder = save_join(self.config['general']['download_folder'], pypack.folder) + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder) else: - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] for script in self.scripts['package_extracted']: self.callScript(script, pypack.id, pypack.name, download_folder) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index dae04c811..2c0d68f3e 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -56,7 +56,7 @@ if os.name != "nt": from module.plugins.internal.Hook import Hook, Expose, threaded from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError from module.plugins.internal.SimpleHoster import replace_patterns -from module.utils import fs_encode, save_join, uniqify +from module.utils import fs_encode, save_join as fs_join, uniqify class ArchiveQueue(object): @@ -220,7 +220,7 @@ class ExtractArchive(Hook): self.queue.remove(pid) - def packageFinished(self, pypack): + def package_finished(self, pypack): self.queue.add(pypack.id) if not self.getConfig('waitall') and not self.extracting: self.extractQueued() @@ -261,7 +261,7 @@ class ExtractArchive(Hook): # reload from txt file self.reloadPasswords() - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] # iterate packages -> extractors -> targets for pid in ids: @@ -274,17 +274,17 @@ class ExtractArchive(Hook): self.logInfo(_("Check package: %s") % pypack.name) # determine output folder - out = save_join(download_folder, pypack.folder, destination, "") #: force trailing slash + out = fs_join(download_folder, pypack.folder, destination, "") #: force trailing slash if subfolder: - out = save_join(out, pypack.folder) + out = fs_join(out, pypack.folder) if not os.path.exists(out): os.makedirs(out) matched = False success = True - files_ids = dict((pylink['name'],((save_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ + 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 @@ -344,7 +344,7 @@ class ExtractArchive(Hook): self.setPermissions(new_files) for filename in new_files: - file = fs_encode(save_join(os.path.dirname(archive.filename), filename)) + file = fs_encode(fs_join(os.path.dirname(archive.filename), filename)) if not os.path.exists(file): self.logDebug("New file %s does not exists" % filename) continue @@ -554,16 +554,16 @@ class ExtractArchive(Hook): continue try: - if self.config['permission']['change_file']: + if self.core.config['permission']['change_file']: if os.path.isfile(f): - os.chmod(f, int(self.config['permission']['file'], 8)) + os.chmod(f, int(self.core.config['permission']['file'], 8)) elif os.path.isdir(f): - os.chmod(f, int(self.config['permission']['folder'], 8)) + os.chmod(f, int(self.core.config['permission']['folder'], 8)) - if self.config['permission']['change_dl'] and os.name != "nt": - uid = getpwnam(self.config['permission']['user'])[2] - gid = getgrnam(self.config['permission']['group'])[2] + if self.core.config['permission']['change_dl'] and os.name != "nt": + uid = getpwnam(self.core.config['permission']['user'])[2] + gid = getgrnam(self.core.config['permission']['group'])[2] os.chown(f, uid, gid) except Exception, e: diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index ff5240e35..8c922f47a 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -8,7 +8,7 @@ import time from shutil import move from module.plugins.internal.Hook import Hook -from module.utils import fs_encode, save_join +from module.utils import fs_encode, save_join as fs_join class HotFolder(Hook): @@ -50,7 +50,7 @@ class HotFolder(Hook): name = "%s_%s.txt" % (file, time.strftime("%H-%M-%S_%d%b%Y")) - with open(save_join(folder, "finished", name), "wb") as f: + with open(fs_join(folder, "finished", name), "wb") as f: f.write(content) self.core.api.addPackage(f.name, [f.name], 1) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index b3b3d9b89..e24691bde 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -54,7 +54,7 @@ class IRCInterface(Thread, Hook): self.start() - def packageFinished(self, pypack): + def package_finished(self, pypack): try: if self.getConfig('info_pack'): self.response(_("Package finished: %s") % pypack.name) @@ -62,7 +62,7 @@ class IRCInterface(Thread, Hook): pass - def downloadFinished(self, pyfile): + def download_finished(self, pyfile): try: if self.getConfig('info_file'): self.response( diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 06c371f1d..7fb642250 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -132,7 +132,7 @@ class ImageTyperz(Hook): self.logInfo(_("Your %s account has not enough credits") % self.__name__) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: res = getURL(self.RESPOND_URL, post={'action': "SETBADIMAGE", diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index db7432eac..0b0f7e475 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -7,7 +7,7 @@ import re import traceback from module.plugins.internal.Hook import Hook, threaded -from module.utils import save_join +from module.utils import save_join as fs_join class MergeFiles(Hook): @@ -32,7 +32,7 @@ class MergeFiles(Hook): @threaded - def packageFinished(self, pack): + def package_finished(self, pack): files = {} fid_dict = {} for fid, data in pack.getChildren().iteritems(): @@ -43,15 +43,15 @@ class MergeFiles(Hook): files[data['name'][:-4]].sort() fid_dict[data['name']] = fid - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] - if self.config['general']['folder_per_package']: - download_folder = save_join(download_folder, pack.folder) + if self.core.config['general']['folder_per_package']: + download_folder = fs_join(download_folder, pack.folder) for name, file_list in files.iteritems(): self.logInfo(_("Starting merging of"), name) - with open(save_join(download_folder, name), "wb") as final_file: + with open(fs_join(download_folder, name), "wb") as final_file: for splitted_file in file_list: self.logDebug("Merging part", splitted_file) @@ -60,7 +60,7 @@ class MergeFiles(Hook): pyfile.setStatus("processing") try: - with open(save_join(download_folder, splitted_file), "rb") as s_file: + with open(fs_join(download_folder, splitted_file), "rb") as s_file: size_written = 0 s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file))) while True: diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 63c1fee05..fe7f39a12 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -28,7 +28,7 @@ class MultiHome(Hook): self.parseInterfaces(self.getConfig('interfaces').split(";")) if not self.interfaces: - self.parseInterfaces([self.config['download']['interface']]) + self.parseInterfaces([self.core.config['download']['interface']]) self.setConfig("interfaces", self.toConfig()) diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index eb49a5418..153b4716c 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -24,7 +24,7 @@ class RestartFailed(Hook): # if self.MIN_CHECK_INTERVAL <= interval != self.interval: # self.core.scheduler.removeJob(self.cb) # self.interval = interval - # self.initPeriodical() + # self.init_periodical() # else: # self.logDebug("Invalid interval value, kept current") diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index da9f24883..0457f9b55 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -59,7 +59,7 @@ class SkipRev(Hook): link.order) - def downloadPreparing(self, pyfile): + def download_preparing(self, pyfile): name = self._name(pyfile) if pyfile.statusname is _("unskipped") or not name.endswith(".rev") or not ".part" in name: @@ -85,7 +85,7 @@ class SkipRev(Hook): pyfile.plugin.setup = MethodType(self._setup, pyfile.plugin) - def downloadFailed(self, pyfile): + def download_failed(self, pyfile): #: 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"): diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index b9ae93fee..234e1052b 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -23,7 +23,7 @@ class UnSkipOnFail(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def downloadFailed(self, pyfile): + def download_failed(self, pyfile): #: Check if pyfile is still "failed", # maybe might has been restarted in meantime if pyfile.status != 8: diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 958be4e12..f555e4ff3 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -11,7 +11,7 @@ from operator import itemgetter from module.network.RequestFactory import getURL from module.plugins.internal.Hook import Expose, Hook, threaded -from module.utils import save_join +from module.utils import save_join as fs_join # Case-sensitive os.path.exists @@ -57,7 +57,7 @@ class UpdateManager(Hook): if self.do_restart is False: self.core.api.unpauseServer() - self.initPeriodical() + self.init_periodical() def setup(self): @@ -257,7 +257,7 @@ class UpdateManager(Hook): m = VERSION.search(content) if m and m.group(2) == version: - with open(save_join("userplugins", prefix, filename), "wb") as f: + with open(fs_join("userplugins", prefix, filename), "wb") as f: f.write(content) updated.append((prefix, name)) @@ -303,7 +303,7 @@ class UpdateManager(Hook): rootplugins = os.path.join(pypath, "module", "plugins") for dir in ("userplugins", rootplugins): - py_filename = save_join(dir, type, name + ".py") + py_filename = fs_join(dir, type, name + ".py") pyc_filename = py_filename + "c" if type == "hook": diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index 0637936f9..0504ec9d0 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -27,7 +27,7 @@ class UserAgentSwitcher(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def downloadPreparing(self, pyfile): + def download_preparing(self, pyfile): connecttimeout = self.getConfig('connecttimeout') maxredirs = self.getConfig('maxredirs') useragent = self.getConfig('useragent').encode("utf8", "replace") #@TODO: Remove `encode` in 0.4.10 diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index 86a5f2308..713499322 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -68,7 +68,7 @@ class WindowsPhoneNotify(Hook): self.notify(_("Captcha"), _("New request waiting user input")) - def packageFinished(self, pypack): + def package_finished(self, pypack): if self.getConfig('notifypackage'): self.notify(_("Package finished"), pypack.name) diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index f13a78d4a..8ef5941d1 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -126,7 +126,7 @@ class XFileSharingPro(Hook): return False - # def downloadFailed(self, pyfile): + # def download_failed(self, pyfile): # if pyfile.pluginname == "BasePlugin" \ # and pyfile.hasStatus("failed") \ # and not self.getConfig('use_hoster_list') \ diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index e93da98bf..053817bef 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -65,7 +65,7 @@ class XMPPInterface(IRCInterface, JabberClient): self.start() - def packageFinished(self, pypack): + def package_finished(self, pypack): try: if self.getConfig('info_pack'): self.announce(_("Package finished: %s") % pypack.name) @@ -73,7 +73,7 @@ class XMPPInterface(IRCInterface, JabberClient): pass - def downloadFinished(self, pyfile): + def download_finished(self, pyfile): try: if self.getConfig('info_file'): self.announce( @@ -200,11 +200,11 @@ class XMPPInterface(IRCInterface, JabberClient): stream.send(m) - def beforeReconnecting(self, ip): + def before_reconnect(self, ip): self.disconnect() - def afterReconnecting(self, ip): + def after_reconnect(self, ip): self.connect() |