From 8e7d14bae4d3c836f029a1235eb227380acc3f75 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 16 Feb 2015 21:59:10 +0100 Subject: Fix plugins to work on 0.4.10 --- pyload/plugin/hoster/OverLoadMe.py | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 pyload/plugin/hoster/OverLoadMe.py (limited to 'pyload/plugin/hoster/OverLoadMe.py') diff --git a/pyload/plugin/hoster/OverLoadMe.py b/pyload/plugin/hoster/OverLoadMe.py new file mode 100644 index 000000000..8c0436d78 --- /dev/null +++ b/pyload/plugin/hoster/OverLoadMe.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +import re + +from random import randrange +from urllib import unquote + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import parseFileSize + + +class OverLoadMe(MultiHoster): + __name__ = "OverLoadMe" + __type__ = "hoster" + __version__ = "0.09" + + __pattern__ = r'https?://.*overload\.me/.+' + + __description__ = """Over-Load.me multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] + + + def getFilename(self, url): + try: + name = unquote(url.rsplit("/", 1)[1]) + except IndexError: + name = "Unknown_Filename..." + + if name.endswith("..."): #: incomplete filename, append random stuff + name += "%s.tmp" % randrange(100, 999) + + return name + + + def setup(self): + self.chunkLimit = 5 + + + def handlePremium(self, pyfile): + https = "https" if self.getConfig("ssl") else "http" + data = self.account.getAccountData(self.user) + page = self.load(https + "://api.over-load.me/getdownload.php", + get={'auth': data['password'], + 'link': pyfile.url}) + + data = json_loads(page) + + self.logDebug(data) + + if data['error'] == 1: + self.logWarning(data['msg']) + self.tempOffline() + else: + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + + http_repl = ["http://", "https://"] + self.link = data['downloadlink'].replace(*http_repl if self.getConfig("ssl") else *http_repl[::-1]) + + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): + # only use when name wasn't already set + pyfile.name = self.getFilename(self.link) + + + def checkFile(self): + if self.checkDownload({"error": "An error occured while processing your request"}) + # usual this download can safely be retried + self.retry(wait_time=60, reason=_("An error occured while generating link.")) + + return super(OverLoadMe, self).checkFile() -- cgit v1.2.3