diff options
author | hagg <devnull@localhost> | 2012-09-10 14:59:13 +0200 |
---|---|---|
committer | hagg <devnull@localhost> | 2012-09-10 14:59:13 +0200 |
commit | 55c14d4fe3df6719e18eaea940e5dca8e780bd5a (patch) | |
tree | f71b3e710fd9d3b851f0a01a82d636f721574ec0 /module/plugins/hoster | |
parent | update turbobit, 1fichier - closed #679, maybe #665 (diff) | |
download | pyload-55c14d4fe3df6719e18eaea940e5dca8e780bd5a.tar.xz |
BasePlugin: handle 404s by setting status to 'offline'
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index f1e3006d0..1ac33931f 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -12,10 +12,10 @@ class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.15" + __version__ = "0.151" __description__ = """Base Plugin when any other didnt fit""" - __author_name__ = ("RaNaN") - __author_mail__ = ("RaNaN@pyload.org") + __author_name__ = ("RaNaN", 'hagg') + __author_mail__ = ("RaNaN@pyload.org", '') def setup(self): self.chunkLimit = -1 @@ -54,6 +54,8 @@ class BasePlugin(Hoster): self.req.addAuth(pwd) self.downloadFile(pyfile) + elif e.code == 404: + self.offline() else: raise @@ -65,6 +67,10 @@ class BasePlugin(Hoster): header = self.load(pyfile.url, just_header = True) #self.logDebug(header) + # self.load does not raise a BadHeader on 404 responses, do it here + if header.has_key('code') and header['code'] == 404: + raise BadHeader(404) + if 'location' in header: self.logDebug("Location: " + header['location']) url = unquote(header['location']) @@ -86,4 +92,4 @@ class BasePlugin(Hoster): if not name: name = url pyfile.name = name self.logDebug("Filename: %s" % pyfile.name) - self.download(url, disposition=True)
\ No newline at end of file + self.download(url, disposition=True) |