summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-11-12 23:33:28 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-11-12 23:33:28 +0100
commitd15f1d61c74dec1b566eb5d8b312f0b2c9eefd99 (patch)
treed43555ce368bbe8fc9f8d96482ffb57b86ead2f0
parentbetter exception handling for sockets (diff)
downloadpyload-d15f1d61c74dec1b566eb5d8b312f0b2c9eefd99.tar.xz
config includes max download time
-rw-r--r--config1
-rw-r--r--module/download_thread.py1
-rwxr-xr-xmodule/network/Request.py6
-rw-r--r--module/plugins/FourChanOrg.py (renamed from module/plugins/FourChan.py)4
4 files changed, 9 insertions, 3 deletions
diff --git a/config b/config
index fd543b602..60249b162 100644
--- a/config
+++ b/config
@@ -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"