summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/AntiVirus.py
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-05 19:49:39 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-05 19:49:39 +0200
commit439a9598c1d1db9efa64f8e11bd120d5e0b289ae (patch)
tree0860a5f2cdea5129136f65e81cd11017d7373b1d /module/plugins/hooks/AntiVirus.py
parentFix https://github.com/pyload/pyload/issues/1351 (diff)
parent[SimpleHoster] Why Premium download fails? (diff)
downloadpyload-439a9598c1d1db9efa64f8e11bd120d5e0b289ae.tar.xz
Merge pull request #1 from pyload/stable
sync
Diffstat (limited to 'module/plugins/hooks/AntiVirus.py')
-rw-r--r--module/plugins/hooks/AntiVirus.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index ac9373a37..c620f556d 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
class AntiVirus(Hook):
__name__ = "AntiVirus"
__type__ = "hook"
- __version__ = "0.08"
+ __version__ = "0.09"
#@TODO: add trash option (use Send2Trash lib)
__config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"),
@@ -80,11 +80,19 @@ class AntiVirus(Hook):
try:
send2trash.send2trash(file)
- except Exception:
- self.logWarning(_("Unable to move file to trash, move to quarantine instead"))
+ except NameError:
+ self.logWarning(_("Send2Trash lib not found, moving to quarantine instead"))
pyfile.setCustomStatus(_("file moving"))
shutil.move(file, self.getConfig('quardir'))
+ except Exception, e:
+ self.logWarning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message)
+ pyfile.setCustomStatus(_("file moving"))
+ shutil.move(file, self.getConfig('quardir'))
+
+ else:
+ self.logDebug(_("Successfully moved file to trash"))
+
elif action == "Quarantine":
pyfile.setCustomStatus(_("file moving"))
shutil.move(file, self.getConfig('quardir'))