diff options
author | GammaC0de <GammaC0de@users.noreply.github.com> | 2015-05-02 21:36:02 +0200 |
---|---|---|
committer | GammaC0de <GammaC0de@users.noreply.github.com> | 2015-05-02 21:36:02 +0200 |
commit | fc36aa1a426fb8c75897debdc6cb4104dbff8200 (patch) | |
tree | 679248e19116278eba4dbcf26ce1347d4415c33a | |
parent | Fix https://github.com/pyload/pyload/issues/1351 (diff) | |
download | pyload-fc36aa1a426fb8c75897debdc6cb4104dbff8200.tar.xz |
[AntiVirus] report missing send2trash
-rw-r--r-- | module/plugins/hooks/AntiVirus.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index ac9373a37..69dffbe73 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,8 +80,13 @@ 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: + self.logWarning(_("Unable to move file to trash, moving to quarantine instead")) pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) |