summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-04 01:37:51 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-04 01:37:51 +0200
commit2bb3ece217c6a1f114ffdde9a237c730c599d089 (patch)
tree9265b7b16b8042f02e7a5da615434265f6b42d8d
parentMerge pull request #1389 from GammaC0de/GammaC0de-SizedriveCom (diff)
parenteven more (diff)
downloadpyload-2bb3ece217c6a1f114ffdde9a237c730c599d089.tar.xz
Merge pull request #1388 from GammaC0de/GammaC0de-report-no-send2trash
[ExtractArchive] [AntiVirus] report missing send2trash
-rw-r--r--module/plugins/hooks/AntiVirus.py14
-rw-r--r--module/plugins/hooks/ExtractArchive.py12
2 files changed, 20 insertions, 6 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'))
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 05a1e368a..5b90b28fc 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -110,7 +110,7 @@ class ArchiveQueue(object):
class ExtractArchive(Hook):
__name__ = "ExtractArchive"
__type__ = "hook"
- __version__ = "1.42"
+ __version__ = "1.43"
__config__ = [("activated" , "bool" , "Activated" , True ),
("fullpath" , "bool" , "Extract with full paths" , True ),
@@ -472,8 +472,14 @@ class ExtractArchive(Hook):
try:
send2trash.send2trash(file)
- except Exception:
- self.logWarning(_("Unable to move %s to trash") % os.path.basename(f))
+ except NameError:
+ self.logWarning(_("Unable to move %s to trash: Send2Trash lib not found") % os.path.basename(f))
+
+ except Exception, e:
+ self.logWarning(_("Unable to move %s to trash: %s") % (os.path.basename(f), e.message))
+
+ else:
+ self.logDebug(_("Successfully moved %s to trash") % os.path.basename(f))
self.logInfo(name, _("Extracting finished"))
extracted_files = archive.files or archive.list()