summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/extractor
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-26 17:04:38 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-26 17:04:38 +0100
commitccb6aaee9d987b56faf19fb48dd06a04ff8ca721 (patch)
tree6a385417ff77f3ed17329e2d606f80b673bdb3c0 /pyload/plugin/extractor
parentPrepare to merging (diff)
parentTiny code cosmetics (diff)
downloadpyload-ccb6aaee9d987b56faf19fb48dd06a04ff8ca721.tar.xz
Merge branch 'stable' into 0.4.10
Conflicts: module/plugins/accounts/Keep2ShareCc.py module/plugins/captcha/OCR.py module/plugins/captcha/captcha.py module/plugins/crypter/DailymotionBatch.py module/plugins/crypter/DailymotionComFolder.py module/plugins/crypter/YoutubeBatch.py module/plugins/crypter/YoutubeComFolder.py module/plugins/internal/CaptchaService.py pyload/plugin/Extractor.py pyload/plugin/OCR.py pyload/plugin/account/DebridItaliaCom.py pyload/plugin/account/MegaRapidCz.py pyload/plugin/account/NoPremiumPl.py pyload/plugin/account/RapideoPl.py pyload/plugin/addon/AndroidPhoneNotify.py pyload/plugin/addon/Checksum.py pyload/plugin/addon/ClickAndLoad.py pyload/plugin/addon/DeleteFinished.py pyload/plugin/addon/DownloadScheduler.py pyload/plugin/addon/ExternalScripts.py pyload/plugin/addon/ExtractArchive.py pyload/plugin/addon/HotFolder.py pyload/plugin/addon/IRCInterface.py pyload/plugin/addon/JustPremium.py pyload/plugin/addon/MergeFiles.py pyload/plugin/addon/MultiHome.py pyload/plugin/addon/RestartFailed.py pyload/plugin/addon/RestartSlow.py pyload/plugin/addon/SkipRev.py pyload/plugin/addon/UnSkipOnFail.py pyload/plugin/addon/UpdateManager.py pyload/plugin/addon/WindowsPhoneNotify.py pyload/plugin/crypter/DDLMusicOrg.py pyload/plugin/crypter/DailymotionBatch.py pyload/plugin/crypter/DevhostSt.py pyload/plugin/crypter/EmbeduploadCom.py pyload/plugin/crypter/MultiloadCz.py pyload/plugin/crypter/YoutubeBatch.py pyload/plugin/extractor/SevenZip.py pyload/plugin/extractor/UnRar.py pyload/plugin/extractor/UnZip.py pyload/plugin/hook/BypassCaptcha.py pyload/plugin/hook/Captcha9Kw.py pyload/plugin/hook/CaptchaBrotherhood.py pyload/plugin/hook/DeathByCaptcha.py pyload/plugin/hook/ExpertDecoders.py pyload/plugin/hook/ImageTyperz.py pyload/plugin/hook/XFileSharingPro.py pyload/plugin/hoster/AlldebridCom.py pyload/plugin/hoster/CzshareCom.py pyload/plugin/hoster/EuroshareEu.py pyload/plugin/hoster/FastixRu.py pyload/plugin/hoster/FastshareCz.py pyload/plugin/hoster/GooIm.py pyload/plugin/hoster/MediafireCom.py pyload/plugin/hoster/MegaDebridEu.py pyload/plugin/hoster/NitroflareCom.py pyload/plugin/hoster/OverLoadMe.py pyload/plugin/hoster/PremiumTo.py pyload/plugin/hoster/PremiumizeMe.py pyload/plugin/hoster/RapidgatorNet.py pyload/plugin/hoster/RealdebridCom.py pyload/plugin/hoster/SimplyPremiumCom.py pyload/plugin/hoster/SimplydebridCom.py pyload/plugin/hoster/SmoozedCom.py pyload/plugin/hoster/SoundcloudCom.py pyload/plugin/hoster/UlozTo.py pyload/plugin/hoster/UploadableCh.py pyload/plugin/hoster/UploadedTo.py pyload/plugin/hoster/UploadheroCom.py pyload/plugin/hoster/VeehdCom.py pyload/plugin/hoster/VimeoCom.py pyload/plugin/hoster/ZeveraCom.py pyload/plugin/hoster/ZippyshareCom.py pyload/plugin/internal/BasePlugin.py pyload/plugin/internal/MultiHoster.py pyload/plugin/internal/SimpleDereferer.py pyload/plugin/internal/SimpleHoster.py pyload/plugin/internal/XFSHoster.py pyload/plugin/ocr/GigasizeCom.py pyload/plugin/ocr/LinksaveIn.py pyload/plugin/ocr/NetloadIn.py pyload/plugin/ocr/ShareonlineBiz.py
Diffstat (limited to 'pyload/plugin/extractor')
-rw-r--r--pyload/plugin/extractor/SevenZip.py28
-rw-r--r--pyload/plugin/extractor/UnRar.py50
-rw-r--r--pyload/plugin/extractor/UnZip.py4
3 files changed, 38 insertions, 44 deletions
diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py
index c1e8f82f4..cf397114f 100644
--- a/pyload/plugin/extractor/SevenZip.py
+++ b/pyload/plugin/extractor/SevenZip.py
@@ -2,8 +2,7 @@
import os
import re
-
-from subprocess import Popen, PIPE
+import subprocess
from pyload.plugin.extractor.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice
from pyload.utils import fs_encode, fs_join
@@ -12,11 +11,11 @@ from pyload.utils import fs_encode, fs_join
class SevenZip(UnRar):
__name__ = "SevenZip"
__type__ = "extractor"
- __version__ = "0.09"
+ __version__ = "0.11"
__description__ = """7-Zip extractor plugin"""
__license__ = "GPLv3"
- __authors__ = [("Michael Nowak", ""),
+ __authors__ = [("Michael Nowak" , "" ),
("Walter Purcaro", "vuolter@gmail.com")]
@@ -42,22 +41,21 @@ class SevenZip(UnRar):
def isUsable(cls):
if os.name == "nt":
cls.CMD = os.path.join(pypath, "7z.exe")
- p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE)
- out,err = p.communicate()
+ p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = p.communicate()
else:
- p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
- cls.VERSION = cls.re_version.search(out).group(1)
+ m = cls.re_version.search(out)
+ cls.VERSION = m.group(1) if m else '(version unknown)'
return True
- def test(self, password):
- file = fs_encode(self.filename)
-
+ def verify(self, password):
# 7z can't distinguish crc and pw error in test
- p = self.call_cmd("l", "-slt", file)
+ p = self.call_cmd("l", "-slt", fs_encode(self.filename))
out, err = p.communicate()
if self.re_wrongpwd.search(out):
@@ -72,9 +70,7 @@ class SevenZip(UnRar):
def check(self, password):
- file = fs_encode(self.filename)
-
- p = self.call_cmd("l", "-slt", file)
+ p = self.call_cmd("l", "-slt", fs_encode(self.filename))
out, err = p.communicate()
# check if output or error macthes the 'wrong password'-Regexp
@@ -154,5 +150,5 @@ class SevenZip(UnRar):
self.manager.logDebug(" ".join(call))
- p = Popen(call, stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p
diff --git a/pyload/plugin/extractor/UnRar.py b/pyload/plugin/extractor/UnRar.py
index fc452cf34..5b9052bff 100644
--- a/pyload/plugin/extractor/UnRar.py
+++ b/pyload/plugin/extractor/UnRar.py
@@ -2,19 +2,19 @@
import os
import re
+import subprocess
from glob import glob
from string import digits
-from subprocess import Popen, PIPE
from pyload.plugin.Extractor import Extractor, ArchiveError, CRCError, PasswordError
-from pyload.utils import decode, fs_encode, fs_join
+from pyload.utils import fs_decode, fs_encode, fs_join
def renice(pid, value):
if value and os.name != "nt":
try:
- Popen(["renice", str(value), str(pid)], stdout=PIPE, stderr=PIPE, bufsize=-1)
+ subprocess.Popen(["renice", str(value), str(pid)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
except Exception:
pass
@@ -23,13 +23,13 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
__type__ = "extractor"
- __version__ = "1.14"
+ __version__ = "1.20"
__description__ = """Rar extractor plugin"""
__license__ = "GPLv3"
- __authors__ = [("RaNaN", "RaNaN@pyload.org"),
+ __authors__ = [("RaNaN" , "RaNaN@pyload.org" ),
("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz", "immenz@gmx.net"),]
+ ("Immenz" , "immenz@gmx.net" )]
CMD = "unrar"
@@ -53,40 +53,38 @@ class UnRar(Extractor):
if os.name == "nt":
try:
cls.CMD = os.path.join(pypath, "RAR.exe")
- p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
cls.__name__ = "RAR"
cls.REPAIR = True
+
except OSError:
cls.CMD = os.path.join(pypath, "UnRAR.exe")
- p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
else:
try:
- p = Popen(["rar"], stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
cls.__name__ = "RAR"
cls.REPAIR = True
+
except OSError: #: fallback to unrar
- p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
- cls.VERSION = cls.re_version.search(out).group(1)
+ m = cls.re_version.search(out)
+ cls.VERSION = m.group(1) if m else '(version unknown)'
return True
@classmethod
- def isMultipart(cls,filename):
- multipart = cls.re_multipart.search(filename)
- if multipart:
- # First Multipart file (part1.rar for *.part1-9.rar format or *.rar for .r1-9 format) handled as normal Archive
- return False if (multipart.group(1) == "part" and int(multipart.group(2)) == 1 and not multipart.group(3)) else True
-
- return False
+ def isMultipart(cls, filename):
+ return True if cls.re_multipart.search(filename) else False
- def test(self, password):
+ def verify(self, password):
p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password)
self._progress(p)
err = p.stderr.read().strip()
@@ -199,14 +197,14 @@ class UnRar(Extractor):
result = set()
if not self.fullpath and self.VERSION.startswith('5'):
# NOTE: Unrar 5 always list full path
- for f in decode(out).splitlines():
- f = fs_join(self.out, os.path.basename(f.strip()))
+ for f in fs_decode(out).splitlines():
+ f = save_join(self.out, os.path.basename(f.strip()))
if os.path.isfile(f):
- result.add(fs_join(self.out, os.path.basename(f)))
+ result.add(save_join(self.out, os.path.basename(f)))
else:
- for f in decode(out).splitlines():
+ for f in fs_decode(out).splitlines():
f = f.strip()
- result.add(fs_join(self.out, f))
+ result.add(save_join(self.out, f))
return list(result)
@@ -219,7 +217,7 @@ class UnRar(Extractor):
args.append("-o+")
else:
args.append("-o-")
- if self.delete:
+ if self.delete != 'No':
args.append("-or")
for word in self.excludefiles:
@@ -242,5 +240,5 @@ class UnRar(Extractor):
self.manager.logDebug(" ".join(call))
- p = Popen(call, stdout=PIPE, stderr=PIPE)
+ p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p
diff --git a/pyload/plugin/extractor/UnZip.py b/pyload/plugin/extractor/UnZip.py
index 3c5f5ec8f..799af3926 100644
--- a/pyload/plugin/extractor/UnZip.py
+++ b/pyload/plugin/extractor/UnZip.py
@@ -13,7 +13,7 @@ from pyload.utils import fs_encode
class UnZip(Extractor):
__name__ = "UnZip"
__type__ = "extractor"
- __version__ = "1.11"
+ __version__ = "1.12"
__description__ = """Zip extractor plugin"""
__license__ = "GPLv3"
@@ -39,7 +39,7 @@ class UnZip(Extractor):
pass
- def test(self):
+ def verify(self):
with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z:
badfile = z.testzip()