From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/RapidshareCom.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hoster/RapidshareCom.py') diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index e5ab6b445..4ecd3c841 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -109,7 +109,6 @@ class RapidshareCom(Hoster): self.fail("Unknown response code.") def handleFree(self): - while self.no_download: self.dl_dict = self.freeWait() -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hoster/RapidshareCom.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'module/plugins/hoster/RapidshareCom.py') diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 4ecd3c841..b50f1c568 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -87,7 +87,7 @@ class RapidshareCom(Hoster): self.name = m.group("name_new") self.download_api_data() - if self.api_data["status"] == "1": + if self.api_data['status'] == "1": self.pyfile.name = self.get_file_name() if self.premium: @@ -95,15 +95,15 @@ class RapidshareCom(Hoster): else: self.handleFree() - elif self.api_data["status"] == "2": + elif self.api_data['status'] == "2": self.logInfo(_("Rapidshare: Traffic Share (direct download)")) self.pyfile.name = self.get_file_name() self.download(self.pyfile.url, get={"directstart": 1}) - elif self.api_data["status"] in ("0", "4", "5"): + elif self.api_data['status'] in ("0", "4", "5"): self.offline() - elif self.api_data["status"] == "3": + elif self.api_data['status'] == "3": self.tempOffline() else: self.fail("Unknown response code.") @@ -133,7 +133,7 @@ class RapidshareCom(Hoster): def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%s: Use Premium Account" % self.__name__) - url = self.api_data["mirror"] + url = self.api_data['mirror'] self.download(url, get={"directstart": 1}) def download_api_data(self, force=False): @@ -163,12 +163,12 @@ class RapidshareCom(Hoster): self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3], "status": fields[4], "shorthost": fields[5], "checksum": fields[6].strip().lower()} - if int(self.api_data["status"]) > 100: - self.api_data["status"] = str(int(self.api_data["status"]) - 100) - elif int(self.api_data["status"]) > 50: - self.api_data["status"] = str(int(self.api_data["status"]) - 50) + if int(self.api_data['status']) > 100: + self.api_data['status'] = str(int(self.api_data['status']) - 100) + elif int(self.api_data['status']) > 50: + self.api_data['status'] = str(int(self.api_data['status']) - 50) - self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data + self.api_data['mirror'] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data def freeWait(self): """downloads html with the important information @@ -214,14 +214,14 @@ class RapidshareCom(Hoster): "name": name, "host": data[0], "auth": data[1], - "server": self.api_data["serverid"], - "size": self.api_data["size"]} + "server": self.api_data['serverid'], + "size": self.api_data['size']} self.setWait(int(data[2]) + 2 + self.offset) self.wait() return dl_dict def get_file_name(self): - if self.api_data["filename"]: - return self.api_data["filename"] + if self.api_data['filename']: + return self.api_data['filename'] return self.url.split("/")[-1] -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/RapidshareCom.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'module/plugins/hoster/RapidshareCom.py') diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index b50f1c568..19d6cf772 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -1,12 +1,5 @@ # -*- coding: utf-8 -*- -# v1.36 -# * fixed call checkfiles subroutine -# v1.35 -# * fixed rs-urls in handleFree(..) and freeWait(..) -# * removed getInfo(..) function as it was not used anywhere (in this file) -# * removed some (old?) comment blocks - import re from module.network.RequestFactory import getURL @@ -51,15 +44,18 @@ def getInfo(urls): class RapidshareCom(Hoster): __name__ = "RapidshareCom" __type__ = "hoster" - __pattern__ = r'https?://(?:www\.)?rapidshare.com/(?:files/(?P\d*?)/(?P[^?]+)|#!download\|(?:\w+)\|(?P\d+)\|(?P[^|]+))' __version__ = "1.39" - __description__ = """Rapidshare.com hoster plugin""" + + __pattern__ = r'https?://(?:www\.)?rapidshare.com/(?:files/(?P\d*?)/(?P[^?]+)|#!download\|(?:\w+)\|(?P\d+)\|(?P[^|]+))' __config__ = [("server", "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera", "Preferred Server", "None")] + + __description__ = """Rapidshare.com hoster plugin""" __author_name__ = ("spoob", "RaNaN", "mkaay") __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "mkaay@mkaay.de") + def setup(self): self.no_download = True self.api_data = None -- cgit v1.2.3