diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-06 00:31:46 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-06 00:31:46 +0200 |
commit | 8d60ae2be14be54d4f4d4775fe696a82f84a000c (patch) | |
tree | 57e3da3c2ac9e18d04366c833259cee39635dc7b | |
parent | Auto choose webserver (diff) | |
parent | [SimpleHoster] Fallback option (diff) | |
download | pyload-8d60ae2be14be54d4f4d4775fe696a82f84a000c.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
pyload/plugin/addon/AntiVirus.py
pyload/plugin/addon/ExtractArchive.py
pyload/plugin/hoster/GoogledriveCom.py
pyload/plugin/hoster/OneFichierCom.py
pyload/plugin/hoster/UlozTo.py
pyload/plugin/hoster/YadiSk.py
pyload/plugin/hoster/ZippyshareCom.py
pyload/plugin/internal/SimpleHoster.py
pyload/plugin/internal/XFSCrypter.py
pyload/plugin/internal/XFSHoster.py
-rw-r--r-- | pyload/plugin/addon/AntiVirus.py | 14 | ||||
-rw-r--r-- | pyload/plugin/addon/ExtractArchive.py | 24 | ||||
-rw-r--r-- | pyload/plugin/hoster/GoogledriveCom.py | 4 | ||||
-rw-r--r-- | pyload/plugin/hoster/OneFichierCom.py | 10 | ||||
-rw-r--r-- | pyload/plugin/hoster/SizedriveCom.py | 38 | ||||
-rw-r--r-- | pyload/plugin/hoster/UlozTo.py | 3 | ||||
-rw-r--r-- | pyload/plugin/hoster/YadiSk.py | 4 | ||||
-rw-r--r-- | pyload/plugin/internal/SimpleHoster.py | 11 | ||||
-rw-r--r-- | pyload/plugin/internal/XFSCrypter.py | 6 | ||||
-rw-r--r-- | pyload/plugin/internal/XFSHoster.py | 16 |
10 files changed, 92 insertions, 38 deletions
diff --git a/pyload/plugin/addon/AntiVirus.py b/pyload/plugin/addon/AntiVirus.py index e2280a0a5..e88dfd0f3 100644 --- a/pyload/plugin/addon/AntiVirus.py +++ b/pyload/plugin/addon/AntiVirus.py @@ -16,7 +16,7 @@ from pyload.utils import fs_encode, fs_join class AntiVirus(Addon): __name = "AntiVirus" __type = "addon" - __version = "0.08" + __version = "0.09" #@TODO: add trash option (use Send2Trash lib) __config = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -76,11 +76,19 @@ class AntiVirus(Addon): 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/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 71802cbfe..a2b22e90c 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -113,7 +113,7 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name = "ExtractArchive" __type = "addon" - __version = "1.42" + __version = "1.44" __config = [("activated" , "bool" , "Activated" , True), ("fullpath" , "bool" , "Extract with full paths" , True), @@ -188,6 +188,11 @@ class ExtractArchive(Addon): @threaded def extractQueued(self, thread): + if self.extracting: #@NOTE: doing the check here for safty (called by coreReady) + return + + self.extracting = True + packages = self.queue.get() while packages: if self.lastPackage: #: called from allDownloadsProcessed @@ -201,6 +206,8 @@ class ExtractArchive(Addon): packages = self.queue.get() #: check for packages added during extraction + self.extracting = False + @Expose def extractPackage(self, *ids): @@ -223,7 +230,7 @@ class ExtractArchive(Addon): def allDownloadsProcessed(self): self.lastPackage = True - if not self.extracting: + if self.getConfig('waitall') and not self.extracting: self.extractQueued() @@ -232,8 +239,6 @@ class ExtractArchive(Addon): if not ids: return False - self.extracting = True - processed = [] extracted = [] failed = [] @@ -375,7 +380,6 @@ class ExtractArchive(Addon): self.queue.remove(pid) - self.extracting = False return True if not failed else False @@ -473,8 +477,14 @@ class ExtractArchive(Addon): 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() diff --git a/pyload/plugin/hoster/GoogledriveCom.py b/pyload/plugin/hoster/GoogledriveCom.py index 6e38db427..db4ee788a 100644 --- a/pyload/plugin/hoster/GoogledriveCom.py +++ b/pyload/plugin/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from pyload.utils import html_unescape class GoogledriveCom(SimpleHoster): __name = "GoogledriveCom" __type = "hoster" - __version = "0.07" + __version = "0.08" __pattern = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,6 +22,8 @@ class GoogledriveCom(SimpleHoster): __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + DISPOSITION = False #: Remove in 0.4.10 + NAME_PATTERN = r'"og:title" content="(?P<N>.*?)">' OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' diff --git a/pyload/plugin/hoster/OneFichierCom.py b/pyload/plugin/hoster/OneFichierCom.py index b33a9e820..1fc89db10 100644 --- a/pyload/plugin/hoster/OneFichierCom.py +++ b/pyload/plugin/hoster/OneFichierCom.py @@ -6,7 +6,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class OneFichierCom(SimpleHoster): __name = "OneFichierCom" __type = "hoster" - __version = "0.83" + __version = "0.84" __pattern = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' __config = [("use_premium", "bool", "Use premium account if available", True)] @@ -23,13 +23,13 @@ class OneFichierCom(SimpleHoster): ("Ludovic Lehmann", "ludo.lehmann@gmail.com")] - NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' - SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + COOKIES = [("1fichier.com", "LG", "en")] + DISPOSITION = False #: Remove in 0.4.10 + NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' + SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'File not found !\s*<' - COOKIES = [("1fichier.com", "LG", "en")] - WAIT_PATTERN = r'>You must wait \d+ minutes' diff --git a/pyload/plugin/hoster/SizedriveCom.py b/pyload/plugin/hoster/SizedriveCom.py new file mode 100644 index 000000000..c9491d0ab --- /dev/null +++ b/pyload/plugin/hoster/SizedriveCom.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class SizedriveCom(SimpleHoster): + __name__ = "SizedriveCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?sizedrive\.com/[rd]/(?P<ID>\w+)' + + __description__ = """Sizedrive.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'>Nome:</b> (?P<N>.+?)<' + SIZE_PATTERN = r'>Tamanho:</b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'ARQUIVO DELATADO POR' + + + def setup(self): + self.resumeDownload = False + self.multiDL = False + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + self.wait(5) + self.html = self.load("http://www.sizedrive.com/getdownload.php", + post={'id': self.info['pattern']['ID']}) + + m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.html) + if m: + self.link = m.group(1) diff --git a/pyload/plugin/hoster/UlozTo.py b/pyload/plugin/hoster/UlozTo.py index 49d5d2ac1..611541990 100644 --- a/pyload/plugin/hoster/UlozTo.py +++ b/pyload/plugin/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name = "UlozTo" __type = "hoster" - __version = "1.08" + __version = "1.09" __pattern = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' __config = [("use_premium", "bool", "Use premium account if available", True)] @@ -34,6 +34,7 @@ class UlozTo(SimpleHoster): SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] CHECK_TRAFFIC = True + DISPOSITION = False #: Remove in 0.4.10 ADULT_PATTERN = r'<form action="(.+?)" method="post" id="frm-askAgeForm">' PASSWD_PATTERN = r'<div class="passwordProtectedFile">' diff --git a/pyload/plugin/hoster/YadiSk.py b/pyload/plugin/hoster/YadiSk.py index f68039e2e..a9d9e4706 100644 --- a/pyload/plugin/hoster/YadiSk.py +++ b/pyload/plugin/hoster/YadiSk.py @@ -10,9 +10,9 @@ from pyload.utils import json_loads class YadiSk(SimpleHoster): __name = "YadiSk" __type = "hoster" - __version = "0.04" + __version = "0.05" - __pattern = r'https?://yadi\.sk/d/\w+' + __pattern = r'https?://yadi\.sk/d/[\w-]+' __description = """Yadi.sk hoster plugin""" __license = "GPLv3" diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py index a87986330..d3e2edc48 100644 --- a/pyload/plugin/internal/SimpleHoster.py +++ b/pyload/plugin/internal/SimpleHoster.py @@ -244,10 +244,11 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name = "SimpleHoster" __type = "hoster" - __version = "1.40" + __version = "1.42" __pattern = r'^unmatchable$' - __config = [("use_premium", "bool", "Use premium account if available", True)] + __config = [("use_premium", "bool", "Use premium account if available" , True), + ("fallback" , "bool", "Fallback to free download if premium fails", True)] __description = """Simple hoster plugin""" __license = "GPLv3" @@ -487,8 +488,8 @@ class SimpleHoster(Hoster): self.checkFile() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 - if self.premium: - self.logWarning(_("Premium download failed")) + if self.getConfig('fallback', True) and self.premium: + self.logWarning(_("Premium download failed"), e) self.retryFree() else: raise Fail(e) @@ -745,7 +746,7 @@ class SimpleHoster(Hoster): self.premium = False self.account = None self.req = self.core.requestFactory.getRequest(self.getClassName()) - self.retries = 0 + self.retries = -1 raise Retry(_("Fallback to free download")) diff --git a/pyload/plugin/internal/XFSCrypter.py b/pyload/plugin/internal/XFSCrypter.py index 4297de842..85b99712a 100644 --- a/pyload/plugin/internal/XFSCrypter.py +++ b/pyload/plugin/internal/XFSCrypter.py @@ -6,7 +6,7 @@ from pyload.plugin.internal.SimpleCrypter import SimpleCrypter class XFSCrypter(SimpleCrypter): __name = "XFSCrypter" __type = "crypter" - __version = "0.07" + __version = "0.08" __pattern = r'^unmatchable$' @@ -19,8 +19,8 @@ class XFSCrypter(SimpleCrypter): URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] - LINK_PATTERN = r'<a href="(.+?)".*?>.+?(?:</a>)?\s*</(?:td|TD)>' - NAME_PATTERN = r'<[tT]itle>.*?\: (?P<N>.+) folder</[tT]itle>' + LINK_PATTERN = r'<a href="(.+?)".*?>.+?(?:</a>)?\s*(<.+>\s*)?</(?:td|TD)>' + NAME_PATTERN = r'<[Tt]itle>.*?\: (?P<N>.+) folder</[Tt]itle>' OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' diff --git a/pyload/plugin/internal/XFSHoster.py b/pyload/plugin/internal/XFSHoster.py index 3f7aeeee8..956f02b95 100644 --- a/pyload/plugin/internal/XFSHoster.py +++ b/pyload/plugin/internal/XFSHoster.py @@ -11,7 +11,7 @@ from pyload.utils import html_unescape class XFSHoster(SimpleHoster): __name = "XFSHoster" __type = "hoster" - __version = "0.46" + __version = "0.47" __pattern = r'^unmatchable$' @@ -34,7 +34,7 @@ class XFSHoster(SimpleHoster): OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' - WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>|id="countdown" value=".*?(\d+).*?"' + WAIT_PATTERN = r'<span id="countdown_str".*>(\d+)</span>|id="countdown" value=".*?(\d+).*?"' PREMIUM_ONLY_PATTERN = r'>This file is available for Premium Users only' ERROR_PATTERN = r'(?:class=["\']err["\'].*?>|<[Cc]enter><b>|>Error</td>|>\(ERROR:)(?:\s*<.+?>\s*)*(.+?)(?:["\']|<|\))' @@ -142,10 +142,7 @@ class XFSHoster(SimpleHoster): action, inputs = self.parseHtmlForm('F1') if not inputs: - if self.errmsg: - self.retry(reason=self.errmsg) - else: - self.error(_("TEXTAREA F1 not found")) + self.retry(reason=self.errmsg or _("TEXTAREA F1 not found")) self.logDebug(inputs) @@ -198,7 +195,7 @@ class XFSHoster(SimpleHoster): self.fail(_("File can be downloaded by premium users only")) elif 'limit' in self.errmsg: - if 'days' in self.errmsg: + if 'day' in self.errmsg: delay = secondsToMidnight(gmt=2) retries = 3 else: @@ -236,10 +233,7 @@ class XFSHoster(SimpleHoster): if not inputs: action, inputs = self.parseHtmlForm('F1') if not inputs: - if self.errmsg: - self.retry(reason=self.errmsg) - else: - self.error(_("TEXTAREA F1 not found")) + self.retry(reason=self.errmsg or _("TEXTAREA F1 not found")) self.logDebug(inputs) |