diff options
author | stickell <l.stickell@yahoo.it> | 2015-02-06 19:03:53 +0100 |
---|---|---|
committer | stickell <l.stickell@yahoo.it> | 2015-02-06 19:03:53 +0100 |
commit | 5b9c273945d41ce91f16e8bf321741b9140de8e4 (patch) | |
tree | 2216aae148db69119266b3706a18bdb10f5e3232 /module/plugins/hooks | |
parent | [GoogledriveCom] Fixed syntax error (diff) | |
parent | [ExtractArchive] Error Handling when broken ExtractArchive was used (diff) | |
download | pyload-5b9c273945d41ce91f16e8bf321741b9140de8e4.tar.xz |
Merge pull request #1141 from immenz/dev_extract
Addressed some Extractor Issues
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 47325608d..4756d359c 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -63,7 +63,10 @@ class ArchiveQueue(object): def get(self): - return self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split() + try: + return [int(pid) for pid in self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split()] + except Exception: + return [] def set(self, value): @@ -103,7 +106,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.24" + __version__ = "1.25" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -140,7 +143,7 @@ class ExtractArchive(Hook): self.queue = ArchiveQueue(self, "Queue") self.failed = ArchiveQueue(self, "Failed") - self.interval = 300 + self.interval = 60 self.extracting = False self.extractors = [] self.passwords = [] @@ -276,16 +279,16 @@ class ExtractArchive(Hook): for fname, fid in targets: name = os.path.basename(fname) - if not os.path.exists(fname): - self.logDebug(name, "File not found") - continue - pname = replace_patterns(fname, self.NAME_REPLACEMENTS) if pname not in processed: processed.append(pname) #: prevent extracting same file twice else: self.logDebug(name, "Skipped") continue + + if not os.path.exists(fname): + self.logDebug(name, "File not found") + continue self.logInfo(name, _("Extract to: %s") % out) try: @@ -312,7 +315,7 @@ class ExtractArchive(Hook): self.setPermissions(new_files) for filename in new_files: - file = fs_encode(filename) + file = fs_encode(save_join(filename, os.path.dirname(archive.filename))) if not os.path.exists(file): self.logDebug("New file %s does not exists" % filename) continue @@ -390,7 +393,7 @@ class ExtractArchive(Hook): if not encrypted or not self.getConfig("usepasswordfile"): archive.extract(password) else: - for pw in set(self.getPasswords(False) + [password]): + for pw in uniqify([password] + self.getPasswords(False)): try: self.logDebug("Try password: %s" % pw) @@ -465,7 +468,7 @@ class ExtractArchive(Hook): file = fs_encode(self.getConfig("passwordfile")) with open(file) as f: - for pw in f.read().splitlines()[:-1]: + for pw in f.read().splitlines(): passwords.append(pw) except IOError, e: |