summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/ExtractArchive.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks/ExtractArchive.py')
-rw-r--r--module/plugins/hooks/ExtractArchive.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index d48496c14..74721d166 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -66,6 +66,9 @@ class WrongPassword(Exception):
class ExtractArchive(Hook):
+ """
+ Provides: unrarFinished (folder, filename)
+ """
__name__ = "ExtractArchive"
__version__ = "0.1"
__description__ = "Extract different kind of archives"
@@ -95,6 +98,14 @@ class ExtractArchive(Hook):
names.append(p)
self.plugins.append(klass)
+ except OSError, e:
+ if e.errno == 2:
+ self.logInfo(_("No %s installed") % p)
+ else:
+ self.logWarning(_("Could not activate %s") % p, str(e))
+ if self.core.debug:
+ print_exc()
+
except Exception, e:
self.logWarning(_("Could not activate %s") % p, str(e))
if self.core.debug:
@@ -140,6 +151,7 @@ class ExtractArchive(Hook):
#iterate packages -> plugins -> targets
for pid in ids:
p = self.core.files.getPackage(pid)
+ self.logInfo(_("Check package %s") % p.name)
if not p: continue
# determine output folder
@@ -148,7 +160,8 @@ class ExtractArchive(Hook):
if self.getConfig("destination") and self.getConfig("destination").lower() != "none":
if exists(self.getConfig("destination")):
- out = save_join(self.getConfig("destination"), "")
+ out = save_join(dl, p.folder, self.getConfig("destination"), "")
+ #relative to package folder if destination is relative, otherwise absolute path overwrites them
files_ids = [(save_join(dl, p.folder, x["name"]), x["id"]) for x in p.getChildren().itervalues()]
@@ -158,7 +171,7 @@ class ExtractArchive(Hook):
for plugin in self.plugins:
targets = plugin.getTargets(files_ids)
- self.logDebug("Targets: %s" % targets)
+ if targets: self.logDebug("Targets: %s" % targets)
for target, fid in targets:
if target in extracted:
self.logDebug(basename(target), "skipped")
@@ -201,12 +214,12 @@ class ExtractArchive(Hook):
else:
self.logInfo(basename(plugin.file), _("Password protected"))
self.logDebug("Passwords: %s" % str(passwords))
-
+
pwlist = copy(self.getPasswords())
#remove already supplied pws from list (only local)
for pw in passwords:
if pw in pwlist: pwlist.remove(pw)
-
+
for pw in passwords + pwlist:
try:
self.logDebug("Try password: %s" % pw)
@@ -233,7 +246,7 @@ class ExtractArchive(Hook):
else: self.logDebug("%s does not exists" % f)
self.logInfo(basename(plugin.file), _("Extracting finished"))
- self.core.hookManager.unrarFinished(plugin.out, plugin.file)
+ self.manager.dispatchEvent("unrarFinished", plugin.out, plugin.file)
return plugin.getExtractedFiles()
@@ -327,7 +340,7 @@ class AbtractExtractor:
def __init__(self, m, file, out, fullpath, overwrite, renice):
- """Initialize extractor for specifiy file
+ """Initialize extractor for specific file
:param m: ExtractArchive Hook plugin
:param file: Absolute filepath