summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/BitshareCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/hoster/BitshareCom.py
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/hoster/BitshareCom.py')
-rw-r--r--module/plugins/hoster/BitshareCom.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 2736d98a8..d312cf277 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class BitshareCom(SimpleHoster):
__name__ = "BitshareCom"
__type__ = "hoster"
- __version__ = "0.54"
+ __version__ = "0.55"
__pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
@@ -32,8 +32,8 @@ class BitshareCom(SimpleHoster):
def setup(self):
- self.multiDL = self.premium
- self.chunkLimit = 1
+ self.multi_dl = self.premium
+ self.chunk_limit = 1
def process(self, pyfile):
@@ -43,7 +43,7 @@ class BitshareCom(SimpleHoster):
#: File id
m = re.match(self.__pattern__, pyfile.url)
self.file_id = max(m.group('ID1'), m.group('ID2'))
- self.logDebug("File id is [%s]" % self.file_id)
+ self.log_debug("File id is [%s]" % self.file_id)
#: Load main page
self.html = self.load(pyfile.url, ref=False)
@@ -54,7 +54,7 @@ class BitshareCom(SimpleHoster):
#: Check Traffic used up
if re.search(self.TRAFFIC_USED_UP, self.html):
- self.logInfo(_("Your Traffic is used up for today"))
+ self.log_info(_("Your Traffic is used up for today"))
self.wait(30 * 60, True)
self.retry()
@@ -69,16 +69,16 @@ class BitshareCom(SimpleHoster):
#: Ajax file id
self.ajaxid = re.search(self.AJAXID_PATTERN, self.html).group(1)
- self.logDebug("File ajax id is [%s]" % self.ajaxid)
+ self.log_debug("File ajax id is [%s]" % self.ajaxid)
#: This may either download our file or forward us to an error page
- self.link = self.getDownloadUrl()
+ self.link = self.get_download_url()
- if self.checkDownload({"error": ">Error occured<"}):
+ if self.check_download({"error": ">Error occured<"}):
self.retry(5, 5 * 60, "Bitshare host : Error occured")
- def getDownloadUrl(self):
+ def get_download_url(self):
#: Return location if direct download is active
if self.premium:
header = self.load(self.pyfile.url, just_header=True)
@@ -86,22 +86,22 @@ class BitshareCom(SimpleHoster):
return header['location']
#: Get download info
- self.logDebug("Getting download info")
+ self.log_debug("Getting download info")
res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
post={"request": "generateID", "ajaxid": self.ajaxid})
- self.handleErrors(res, ':')
+ self.handle_errors(res, ':')
parts = res.split(":")
filetype = parts[0]
wait = int(parts[1])
captcha = int(parts[2])
- self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha))
+ self.log_debug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha))
#: Waiting
if wait > 0:
- self.logDebug("Waiting %d seconds." % wait)
+ self.log_debug("Waiting %d seconds." % wait)
if wait < 120:
self.wait(wait, False)
else:
@@ -110,7 +110,7 @@ class BitshareCom(SimpleHoster):
#: Resolve captcha
if captcha == 1:
- self.logDebug("File is captcha protected")
+ self.log_debug("File is captcha protected")
recaptcha = ReCaptcha(self)
#: Try up to 3 times
@@ -121,23 +121,23 @@ class BitshareCom(SimpleHoster):
"ajaxid" : self.ajaxid,
"recaptcha_challenge_field": challenge,
"recaptcha_response_field" : response})
- if self.handleCaptchaErrors(res):
+ if self.handle_captcha_errors(res):
break
#: Get download URL
- self.logDebug("Getting download url")
+ self.log_debug("Getting download url")
res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
post={"request": "getDownloadURL", "ajaxid": self.ajaxid})
- self.handleErrors(res, '#')
+ self.handle_errors(res, '#')
url = res.split("#")[-1]
return url
- def handleErrors(self, res, separator):
- self.logDebug("Checking response [%s]" % res)
+ def handle_errors(self, res, separator):
+ self.log_debug("Checking response [%s]" % res)
if "ERROR:Session timed out" in res:
self.retry()
elif "ERROR" in res:
@@ -145,15 +145,15 @@ class BitshareCom(SimpleHoster):
self.fail(msg)
- def handleCaptchaErrors(self, res):
- self.logDebug("Result of captcha resolving [%s]" % res)
+ def handle_captcha_errors(self, res):
+ self.log_debug("Result of captcha resolving [%s]" % res)
if "SUCCESS" in res:
- self.correctCaptcha()
+ self.correct_captcha()
return True
elif "ERROR:SESSION ERROR" in res:
self.retry()
- self.invalidCaptcha()
+ self.invalid_captcha()
getInfo = create_getInfo(BitshareCom)