diff options
author | mkaay <mkaay@mkaay.de> | 2009-11-12 23:35:18 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2009-11-12 23:35:18 +0100 |
commit | 8e1b5b4d192245cffc392c66fe4ee49d15e9282d (patch) | |
tree | b88ced5a650971f01470ba1c2869307eff27a456 | |
parent | easier local cli use (diff) | |
parent | config includes max download time (diff) | |
download | pyload-8e1b5b4d192245cffc392c66fe4ee49d15e9282d.tar.xz |
merge
-rw-r--r-- | config | 1 | ||||
-rw-r--r-- | module/download_thread.py | 1 | ||||
-rwxr-xr-x | module/network/Request.py | 6 | ||||
-rw-r--r-- | module/plugins/FourChanOrg.py (renamed from module/plugins/FourChan.py) | 4 |
4 files changed, 9 insertions, 3 deletions
@@ -23,6 +23,7 @@ link_file = links.txt failed_file = failed_links.txt reconnect_method = reconnect_method debug_mode = False +max_download_time = 18000 [updates] search_updates = True diff --git a/module/download_thread.py b/module/download_thread.py index 158d40147..6a31030ca 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -119,6 +119,7 @@ class Download_Thread(threading.Thread): pyfile.init_download() pyfile.plugin.prepare(self) + pyfile.plugin.req.set_timeout(self.parent.parent.config['general']['max_download_time']) if status.url == "": status.url = pyfile.plugin.get_file_url() diff --git a/module/network/Request.py b/module/network/Request.py index 37837fcaa..985abe8e9 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -49,6 +49,8 @@ class Request: self.lastURL = None self.auth = False + + self.timeout = 5*3600 try: if pycurl: self.curl = True @@ -81,6 +83,8 @@ class Request: ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7")] + def set_timeout(self, timeout): + self.timeout = timeout def init_curl(self): self.rep = StringIO() @@ -89,7 +93,7 @@ class Request: self.pycurl = pycurl.Curl() self.pycurl.setopt(pycurl.FOLLOWLOCATION, 1) self.pycurl.setopt(pycurl.MAXREDIRS, 5) - self.pycurl.setopt(pycurl.TIMEOUT, 5*3600) + self.pycurl.setopt(pycurl.TIMEOUT, self.timeout) self.pycurl.setopt(pycurl.CONNECTTIMEOUT, 30) self.pycurl.setopt(pycurl.NOSIGNAL, 1) self.pycurl.setopt(pycurl.NOPROGRESS, 0) diff --git a/module/plugins/FourChan.py b/module/plugins/FourChanOrg.py index 840274457..383785951 100644 --- a/module/plugins/FourChan.py +++ b/module/plugins/FourChanOrg.py @@ -5,12 +5,12 @@ import re from Plugin import Plugin -class FourChan(Plugin): +class FourChanOrg(Plugin): def __init__(self, parent): Plugin.__init__(self, parent) props = {} - props['name'] = "FourChan" + props['name'] = "FourChanOrg" props['type'] = "container" props['pattern'] = r"http://(www\.)?(img\.)?(zip\.)?4chan.org/\w+/(res/|imgboard\.html)" props['version'] = "0.1" |