summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-05 11:52:35 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-05 11:52:35 +0200
commit44063bfd99228ef1e2570750f5d2d3621698160c (patch)
treebb262de04ee8d2659e29424101614d6d50c182a5
parentfix #324 (diff)
downloadpyload-44063bfd99228ef1e2570750f5d2d3621698160c.tar.xz
closed #323
-rw-r--r--module/PyFile.py12
-rw-r--r--module/plugins/hooks/CaptchaTrader.py2
-rw-r--r--module/plugins/hoster/YoutubeCom.py20
3 files changed, 16 insertions, 18 deletions
diff --git a/module/PyFile.py b/module/PyFile.py
index 25e65e34a..90bbcbc42 100644
--- a/module/PyFile.py
+++ b/module/PyFile.py
@@ -234,13 +234,13 @@ class PyFile(object):
def getSize(self):
""" get size of download """
- if self.size:
- return self.size
- else:
- try:
+ try:
+ if self.plugin.req.size:
return self.plugin.req.size
- except:
- return 0
+ else:
+ return self.size
+ except:
+ return self.size
def notifyChange(self):
e = UpdateEvent("file", self.id, "collector" if not self.package().queue else "queue")
diff --git a/module/plugins/hooks/CaptchaTrader.py b/module/plugins/hooks/CaptchaTrader.py
index 88b928a50..00f517751 100644
--- a/module/plugins/hooks/CaptchaTrader.py
+++ b/module/plugins/hooks/CaptchaTrader.py
@@ -66,7 +66,7 @@ class CaptchaTrader(Hook):
if response[0] < 0:
raise CaptchaTraderException(response[1])
else:
- self.log.debug("CaptchaTrader: %s credits left" % response[1])
+ self.logInfo(_("%s credits left") % response[1])
return response[1]
def submit(self, captcha, captchaType="file", match=None):
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index b94340fe3..8eab8f384 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -10,13 +10,14 @@ class YoutubeCom(Hoster):
__type__ = "hoster"
__pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*"
__version__ = "0.2"
- __config__ = [("quality", "sd,hd,fullhd", "Quality Setting", "hd")]
+ __config__ = [("quality", "sd;hd;fullhd", "Quality Setting", "hd"),
+ ("fmt", "int", "FMT Number 0-38", 0)]
__description__ = """Youtube.com Video Download Hoster"""
__author_name__ = ("spoob")
__author_mail__ = ("spoob@pyload.org")
def process(self, pyfile):
- html = self.load(pyfile.url, utf8=True)
+ html = self.load(pyfile.url, decode=True)
if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) is not None:
self.offline()
@@ -46,6 +47,9 @@ class YoutubeCom(Hoster):
elif self.getConf("quality") == "fullhd" and hd_available:
desired_fmt = 37
+ if self.getConfig("fmt"):
+ desired_fmt = self.getConf("fmt")
+
fmt_pattern = 'fmt_url_map=(.+?)&'
fmt_url_map = re.search(fmt_pattern, html).group(1)
links = urllib.unquote(fmt_url_map).split(",")
@@ -62,13 +66,7 @@ class YoutubeCom(Hoster):
self.logDebug("Found links: %s" % fmt_dict)
- file_url = ""
- file_fmt = 0
-
- for fmt in sorted(fmt_dict.keys()):
- if abs(fmt - desired_fmt) <= abs(file_fmt - desired_fmt):
- file_url = fmt_dict[fmt]
- file_fmt = fmt
+ fmt = reduce(lambda x,y: x if abs(x-desired_fmt) <= abs(y-desired_fmt) else y, fmt_dict.keys())
- self.logDebug("Choosed fmt: %s" % file_fmt)
- self.download(file_url)
+ self.logDebug("Choose fmt: %s" % fmt)
+ self.download(fmt_dict[fmt])