summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-05 19:49:39 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-05 19:49:39 +0200
commit439a9598c1d1db9efa64f8e11bd120d5e0b289ae (patch)
tree0860a5f2cdea5129136f65e81cd11017d7373b1d
parentFix https://github.com/pyload/pyload/issues/1351 (diff)
parent[SimpleHoster] Why Premium download fails? (diff)
downloadpyload-439a9598c1d1db9efa64f8e11bd120d5e0b289ae.tar.xz
Merge pull request #1 from pyload/stable
sync
-rw-r--r--module/plugins/hooks/AntiVirus.py14
-rw-r--r--module/plugins/hooks/ExtractArchive.py24
-rw-r--r--module/plugins/hoster/GoogledriveCom.py4
-rw-r--r--module/plugins/hoster/OneFichierCom.py10
-rw-r--r--module/plugins/hoster/SizedriveCom.py41
-rw-r--r--module/plugins/hoster/UlozTo.py3
-rw-r--r--module/plugins/hoster/ZippyshareCom.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py4
8 files changed, 82 insertions, 20 deletions
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index ac9373a37..c620f556d 100644
--- a/module/plugins/hooks/AntiVirus.py
+++ b/module/plugins/hooks/AntiVirus.py
@@ -16,7 +16,7 @@ from module.utils import fs_encode, save_join
class AntiVirus(Hook):
__name__ = "AntiVirus"
__type__ = "hook"
- __version__ = "0.08"
+ __version__ = "0.09"
#@TODO: add trash option (use Send2Trash lib)
__config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"),
@@ -80,11 +80,19 @@ class AntiVirus(Hook):
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/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 05a1e368a..07a2ba228 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -110,7 +110,7 @@ class ArchiveQueue(object):
class ExtractArchive(Hook):
__name__ = "ExtractArchive"
__type__ = "hook"
- __version__ = "1.42"
+ __version__ = "1.43"
__config__ = [("activated" , "bool" , "Activated" , True ),
("fullpath" , "bool" , "Extract with full paths" , True ),
@@ -187,6 +187,11 @@ class ExtractArchive(Hook):
@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
@@ -200,6 +205,8 @@ class ExtractArchive(Hook):
packages = self.queue.get() #: check for packages added during extraction
+ self.extracting = False
+
@Expose
def extractPackage(self, *ids):
@@ -222,7 +229,7 @@ class ExtractArchive(Hook):
def allDownloadsProcessed(self):
self.lastPackage = True
- if not self.extracting:
+ if self.getConfig('waitall') and not self.extracting:
self.extractQueued()
@@ -231,8 +238,6 @@ class ExtractArchive(Hook):
if not ids:
return False
- self.extracting = True
-
processed = []
extracted = []
failed = []
@@ -374,7 +379,6 @@ class ExtractArchive(Hook):
self.queue.remove(pid)
- self.extracting = False
return True if not failed else False
@@ -472,8 +476,14 @@ class ExtractArchive(Hook):
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/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py
index 66f36e6c0..09c54a8da 100644
--- a/module/plugins/hoster/GoogledriveCom.py
+++ b/module/plugins/hoster/GoogledriveCom.py
@@ -12,7 +12,7 @@ from module.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/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index 8a5fa9cae..4b947c554 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
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)]
@@ -25,13 +25,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/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py
new file mode 100644
index 000000000..3b9748fb6
--- /dev/null
+++ b/module/plugins/hoster/SizedriveCom.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+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)
+
+
+getInfo = create_getInfo(SizedriveCom)
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index c48873387..b43ff8d92 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/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/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index fbac432cd..c47ac4fe1 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -66,7 +66,7 @@ class ZippyshareCom(SimpleHoster):
initScripts = set()
def replElementById(element):
- id = element.group(1) # id might be either 'x' (a real id) or x (a variable)
+ id = element.group(1) # id might be either 'x' (a real id) or x (a variable)
attr = element.group(4) # attr might be None
varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr))
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index df3d66ea2..f77a31ae2 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -244,7 +244,7 @@ def secondsToMidnight(gmt=0):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "1.40"
+ __version__ = "1.41"
__pattern__ = r'^unmatchable$'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
@@ -489,7 +489,7 @@ class SimpleHoster(Hoster):
except Fail, e: #@TODO: Move to PluginThread in 0.4.10
if self.premium:
- self.logWarning(_("Premium download failed"))
+ self.logWarning(_("Premium download failed"), e)
self.retryFree()
else:
raise Fail(e)