From 0e1ef9bc01579328e17e79416fa3c1c7b77adcc8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Jun 2015 06:08:01 +0200 Subject: Update everything --- module/plugins/hooks/AntiVirus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index c620f556d..0b5eb1410 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -9,14 +9,14 @@ try: except ImportError: pass -from module.plugins.Hook import Hook, Expose, threaded +from module.plugins.internal.Hook import Hook, Expose, threaded from module.utils import fs_encode, save_join class AntiVirus(Hook): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), -- cgit v1.2.3 From da1180bc2d428ad52fbbecda8473fc1fb7267438 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 9 Jun 2015 01:52:24 +0200 Subject: [SimpleHoster] Improve checkFile --- module/plugins/hooks/AntiVirus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 0b5eb1410..09872650f 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -91,7 +91,7 @@ class AntiVirus(Hook): shutil.move(file, self.getConfig('quardir')) else: - self.logDebug(_("Successfully moved file to trash")) + self.logDebug("Successfully moved file to trash") elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) -- cgit v1.2.3 From 5a139055ae658d3a05cbb658cbd66aeae0d01db5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 21:06:10 +0200 Subject: Spare code cosmetics --- module/plugins/hooks/AntiVirus.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/AntiVirus.py') 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'): -- cgit v1.2.3 From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/hooks/AntiVirus.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hooks/AntiVirus.py') 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) -- cgit v1.2.3 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/hooks/AntiVirus.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 02b1df67b..cb9d5aaa6 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -16,7 +16,7 @@ from module.utils import fs_encode, save_join as fs_join class AntiVirus(Hook): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -44,8 +44,8 @@ class AntiVirus(Hook): def scan(self, pyfile, thread): file = fs_encode(pyfile.plugin.lastDownload) filename = os.path.basename(pyfile.plugin.lastDownload) - cmdfile = fs_encode(self.getConfig('cmdfile')) - cmdargs = fs_encode(self.getConfig('cmdargs').strip()) + cmdfile = fs_encode(self.get_config('cmdfile')) + cmdargs = fs_encode(self.get_config('cmdargs').strip()) if not os.path.isfile(file) or not os.path.isfile(cmdfile): return @@ -60,20 +60,20 @@ class AntiVirus(Hook): out, err = map(str.strip, p.communicate()) if out: - self.logInfo(filename, out) + self.log_info(filename, out) if err: - self.logWarning(filename, err) - if not self.getConfig('ignore-err'): - self.logDebug("Delete/Quarantine task is aborted") + self.log_warning(filename, err) + if not self.get_config('ignore-err'): + self.log_debug("Delete/Quarantine task is aborted") return if p.returncode: pyfile.error = _("infected file") - action = self.getConfig('action') + action = self.get_config('action') try: if action == "Delete": - if not self.getConfig('deltotrash'): + if not self.get_config('deltotrash'): os.remove(file) else: @@ -81,27 +81,27 @@ class AntiVirus(Hook): send2trash.send2trash(file) except NameError: - self.logWarning(_("Send2Trash lib not found, moving to quarantine instead")) + self.log_warning(_("Send2Trash lib not found, moving to quarantine instead")) pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.getConfig('quardir')) + shutil.move(file, self.get_config('quardir')) except Exception, e: - self.logWarning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message) + self.log_warning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message) pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.getConfig('quardir')) + shutil.move(file, self.get_config('quardir')) else: - self.logDebug("Successfully moved file to trash") + self.log_debug("Successfully moved file to trash") elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.getConfig('quardir')) + shutil.move(file, self.get_config('quardir')) except (IOError, shutil.Error), e: - self.logError(filename, action + " action failed!", e) + self.log_error(filename, action + " action failed!", e) elif not out and not err: - self.logDebug(filename, "No infected file found") + self.log_debug(filename, "No infected file found") finally: pyfile.setProgress(100) @@ -114,5 +114,5 @@ class AntiVirus(Hook): 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'): + if pyfile.status == 8 and self.get_config('scanfailed'): return self.scan(pyfile) -- cgit v1.2.3 From 502517f37c7540b0bddb092e69386d9d6f08800c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 09:42:34 +0200 Subject: Fix addons --- module/plugins/hooks/AntiVirus.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index cb9d5aaa6..8b19af84c 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -9,11 +9,11 @@ try: except ImportError: pass -from module.plugins.internal.Hook import Hook, Expose, threaded +from module.plugins.internal.Addon import Addon, Expose, threaded from module.utils import fs_encode, save_join as fs_join -class AntiVirus(Hook): +class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" __version__ = "0.11" @@ -32,13 +32,6 @@ class AntiVirus(Hook): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - interval = 0 #@TODO: Remove in 0.4.10 - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - @Expose @threaded def scan(self, pyfile, thread): -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/hooks/AntiVirus.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 8b19af84c..7097b87c8 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -17,6 +17,7 @@ class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" __version__ = "0.11" + __status__ = "stable" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/hooks/AntiVirus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 7097b87c8..80968c491 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -17,7 +17,7 @@ class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" __version__ = "0.11" - __status__ = "stable" + __status__ = "testing" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), -- cgit v1.2.3 From 2ec703256d3565e2b34c277dcee9fb80019f2f74 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Jul 2015 23:08:59 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1583 --- module/plugins/hooks/AntiVirus.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 80968c491..b6fd0ca2d 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -16,7 +16,7 @@ from module.utils import fs_encode, save_join as fs_join class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" #@TODO: add trash option (use Send2Trash lib) @@ -36,8 +36,8 @@ class AntiVirus(Addon): @Expose @threaded def scan(self, pyfile, thread): - file = fs_encode(pyfile.plugin.lastDownload) - filename = os.path.basename(pyfile.plugin.lastDownload) + file = fs_encode(pyfile.plugin.last_download) + filename = os.path.basename(pyfile.plugin.last_download) cmdfile = fs_encode(self.get_config('cmdfile')) cmdargs = fs_encode(self.get_config('cmdargs').strip()) -- cgit v1.2.3 From 9cb6b5d05ddcc15148bd5fab0fe02978159cfef5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Aug 2015 17:23:46 +0200 Subject: Tiny fixes --- module/plugins/hooks/AntiVirus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/AntiVirus.py') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index b6fd0ca2d..b58d0b61d 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -63,7 +63,7 @@ class AntiVirus(Addon): return if p.returncode: - pyfile.error = _("infected file") + pyfile.error = _("Infected file") action = self.get_config('action') try: if action == "Delete": -- cgit v1.2.3