diff options
| author | 2015-05-01 13:05:40 +0200 | |
|---|---|---|
| committer | 2015-05-01 13:05:40 +0200 | |
| commit | 095ad393330d9ccb86adac4894fe3280caa44234 (patch) | |
| tree | f03b4a5674b4f6e79706350e06543ba565effd85 /pyload/plugin/addon/AntiVirus.py | |
| parent | Use bitmath lib to formatSize (diff) | |
| parent | Fix https://github.com/pyload/pyload/issues/1351 (diff) | |
| download | pyload-095ad393330d9ccb86adac4894fe3280caa44234.tar.xz | |
Merge branch 'stable' into 0.4.10
Conflicts:
module/plugins/hoster/RehostTo.py
module/plugins/hoster/XVideosCom.py
module/plugins/hoster/ZeveraCom.py
module/plugins/internal/CaptchaService.py
pyload/plugin/account/FilefactoryCom.py
pyload/plugin/account/OneFichierCom.py
pyload/plugin/account/WebshareCz.py
pyload/plugin/addon/AntiVirus.py
pyload/plugin/addon/Checksum.py
pyload/plugin/addon/ExtractArchive.py
pyload/plugin/container/CCF.py
pyload/plugin/crypter/Go4UpCom.py
pyload/plugin/hook/BypassCaptcha.py
pyload/plugin/hook/CaptchaBrotherhood.py
pyload/plugin/hook/ExpertDecoders.py
pyload/plugin/hook/ImageTyperz.py
pyload/plugin/hook/XFileSharingPro.py
pyload/plugin/hoster/Ftp.py
pyload/plugin/hoster/GigapetaCom.py
pyload/plugin/hoster/MegaRapidCz.py
pyload/plugin/hoster/MegaRapidoNet.py
pyload/plugin/hoster/MultishareCz.py
pyload/plugin/hoster/NarodRu.py
pyload/plugin/hoster/QuickshareCz.py
pyload/plugin/hoster/RapidgatorNet.py
pyload/plugin/hoster/RapiduNet.py
pyload/plugin/hoster/UnibytesCom.py
pyload/plugin/hoster/UploadingCom.py
pyload/plugin/hoster/WrzucTo.py
pyload/plugin/internal/BasePlugin.py
pyload/plugin/internal/SimpleDereferer.py
pyload/plugin/internal/SimpleHoster.py
pyload/plugin/internal/XFSCrypter.py
pyload/plugin/internal/XFSHoster.py
Diffstat (limited to 'pyload/plugin/addon/AntiVirus.py')
| -rw-r--r-- | pyload/plugin/addon/AntiVirus.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/pyload/plugin/addon/AntiVirus.py b/pyload/plugin/addon/AntiVirus.py index 87780e337..e2280a0a5 100644 --- a/pyload/plugin/addon/AntiVirus.py +++ b/pyload/plugin/addon/AntiVirus.py @@ -4,6 +4,11 @@ import os import shutil import subprocess +try: + import send2trash +except ImportError: + pass + from pyload.plugin.Addon import Addon, Expose, threaded from pyload.utils import fs_encode, fs_join @@ -11,7 +16,7 @@ from pyload.utils import fs_encode, fs_join class AntiVirus(Addon): __name = "AntiVirus" __type = "addon" - __version = "0.07" + __version = "0.08" #@TODO: add trash option (use Send2Trash lib) __config = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -27,16 +32,7 @@ class AntiVirus(Addon): __authors = [("Walter Purcaro", "vuolter@gmail.com")] - def setup(self): - try: - import send2trash - - except ImportError: - self.logDebug("Send2Trash lib not found") - self.trashable = False - else: - self.trashable = True @Expose @@ -76,13 +72,14 @@ class AntiVirus(Addon): if not self.getConfig('deltotrash'): os.remove(file) - elif self.trashable: - send2trash.send2trash(file) - else: - self.logWarning(_("Unable to move file to trash, move to quarantine instead")) - pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.getConfig('quardir')) + try: + send2trash.send2trash(file) + + except Exception: + self.logWarning(_("Unable to move file to trash, move to quarantine instead")) + pyfile.setCustomStatus(_("file moving")) + shutil.move(file, self.getConfig('quardir')) elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) |
