From a6e9a846137688bd7e5b1dea61e41831324ba3a7 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 4 Jun 2009 23:31:45 +0200 Subject: request fix --- Plugins/Plugin.py | 4 ++-- Plugins/ZippyshareCom.py | 5 +++-- module/network/Request.py | 5 ++++- module/thread_list.py | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Plugins/Plugin.py b/Plugins/Plugin.py index fdf33d3f8..c58976cd4 100644 --- a/Plugins/Plugin.py +++ b/Plugins/Plugin.py @@ -22,8 +22,8 @@ class Plugin(): self.props = props self.parent = parent self.req = Request() - self.html = None - self.time_plus_wait = None #time() + wait in seconds + self.html = 0 + self.time_plus_wait = 0 #time() + wait in seconds self.want_reconnect = False self.multi_dl = True diff --git a/Plugins/ZippyshareCom.py b/Plugins/ZippyshareCom.py index b059c836c..17e7288f9 100644 --- a/Plugins/ZippyshareCom.py +++ b/Plugins/ZippyshareCom.py @@ -35,7 +35,7 @@ class ZippyshareCom(Plugin): def download_html(self): url = self.parent.url self.html = self.req.load(url) - self.time_plus_wait = time() + 10 + self.time_plus_wait = time() + 12 def get_file_url(self): """ returns the absolute downloadable filepath @@ -53,7 +53,8 @@ class ZippyshareCom(Plugin): self.download_html() if not self.want_reconnect: file_name = re.search("Name: (.*)
", self.html).group(1) - print file_name + print "zippy",file_name + return file_name else: return self.parent.url diff --git a/module/network/Request.py b/module/network/Request.py index 8725d0607..1bf8c8255 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -102,7 +102,10 @@ class Request: file = open(filename, 'wb') req = urllib2.Request(url) conn = self.downloader.open(req, post) - self.dl_size = int(conn.headers["content-length"]) + if conn.headers.has_key("content-length"): + self.dl_size = int(conn.headers["content-length"]) + else: + self.dl_size = 0 self.dl_arrived = 0 self.dl_time = time.time() for chunk in conn: diff --git a/module/thread_list.py b/module/thread_list.py index 8ae78b089..dc77c6730 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -18,6 +18,7 @@ # ### #python +from __future__ import with_statement import re import subprocess import time -- cgit v1.2.3