summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SevenZip.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-03 00:10:11 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-03 00:10:11 +0100
commit8dfb7adc0fc3c858c0ddf9371c2f4580bb8be3c7 (patch)
tree724716e0820a71e8da356f77f300e728041027c5 /module/plugins/internal/SevenZip.py
parentMerge pull request #1137 from immenz/dev_Unzip (diff)
downloadpyload-8dfb7adc0fc3c858c0ddf9371c2f4580bb8be3c7.tar.xz
Update Extractor (3)
Diffstat (limited to 'module/plugins/internal/SevenZip.py')
-rw-r--r--module/plugins/internal/SevenZip.py42
1 files changed, 13 insertions, 29 deletions
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index 126958829..2f4dc5565 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -11,7 +11,7 @@ from module.utils import fs_encode, save_join
class SevenZip(UnRar):
__name__ = "SevenZip"
- __version__ = "0.05"
+ __version__ = "0.06"
__description__ = """7-Zip extractor plugin"""
__license__ = "GPLv3"
@@ -89,40 +89,24 @@ class SevenZip(UnRar):
renice(p.pid, self.renice)
- progressstring = ""
- while True:
- c = p.stdout.read(1)
- # quit loop on eof
- if not c:
- break
- # reading a percentage sign -> set progress and restart
- if c == '%':
- self.notifyProgress(int(progressstring))
- progressstring = ""
- # not reading a digit -> therefore restart
- elif c not in digits:
- progressstring = ""
- # add digit to progressstring
- else:
- progressstring += c
-
- # retrieve stderr
- err = p.stderr.read()
-
- if self.re_wrongpwd.search(err):
- raise PasswordError
+ # communicate and retrieve stderr
+ self._progress(p)
+ err = p.stderr.read().strip()
- elif self.re_wrongcrc.search(err):
- raise CRCError(err)
+ if err:
+ if self.re_wrongpwd.search(err):
+ raise PasswordError
+
+ elif self.re_wrongcrc.search(err):
+ raise CRCError(err)
- elif err.strip(): #: raise error if anything is on stderr
- raise ArchiveError(err)
+ else: #: raise error if anything is on stderr
+ raise ArchiveError(err)
if p.returncode > 1:
raise ArchiveError(_("Process return code: %d") % p.returncode)
- if not self.files:
- self.files = self.list(password)
+ self.files = self.list(password)
def list(self, password=None):