summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/RPNetBiz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/RPNetBiz.py')
-rw-r--r--module/plugins/hoster/RPNetBiz.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py
index 47f255074..c1e536d39 100644
--- a/module/plugins/hoster/RPNetBiz.py
+++ b/module/plugins/hoster/RPNetBiz.py
@@ -7,39 +7,42 @@ from module.common.json_layer import json_loads
class RPNetBiz(Hoster):
- __name__ = "RPNetBiz"
- __type__ = "hoster"
+ __name__ = "RPNetBiz"
+ __type__ = "hoster"
__version__ = "0.1"
__description__ = """RPNet.biz hoster plugin"""
+ __license__ = "GPLv3"
__pattern__ = r'https?://.*rpnet\.biz'
- __author_name__ = "Dman"
- __author_mail__ = "dmanugm@gmail.com"
+ __authors__ = [("Dman", "dmanugm@gmail.com")]
def setup(self):
self.chunkLimit = -1
self.resumeDownload = True
+
def process(self, pyfile):
if re.match(self.__pattern__, pyfile.url):
link_status = {'generated': pyfile.url}
elif not self.account:
# Check account
self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet")
- self.fail("No rpnet account provided")
+ self.fail(_("No rpnet account provided"))
else:
(user, data) = self.account.selectAccount()
self.logDebug("Original URL: %s" % pyfile.url)
# Get the download link
- response = self.load("https://premium.rpnet.biz/client_api.php",
- get={"username": user, "password": data['password'],
- "action": "generate", "links": pyfile.url})
+ res = self.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user,
+ "password": data['password'],
+ "action": "generate",
+ "links": pyfile.url})
- self.logDebug("JSON data: %s" % response)
- link_status = json_loads(response)['links'][0] # get the first link... since we only queried one
+ self.logDebug("JSON data: %s" % res)
+ link_status = json_loads(res)['links'][0] # get the first link... since we only queried one
# Check if we only have an id as a HDD link
if 'id' in link_status:
@@ -52,11 +55,13 @@ class RPNetBiz(Hoster):
my_try = 0
while (my_try <= max_tries):
self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
- response = self.load("https://premium.rpnet.biz/client_api.php",
- get={"username": user, "password": data['password'],
- "action": "downloadInformation", "id": link_status['id']})
- self.logDebug("JSON data hdd query: %s" % response)
- download_status = json_loads(response)['download']
+ res = self.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user,
+ "password": data['password'],
+ "action": "downloadInformation",
+ "id": link_status['id']})
+ self.logDebug("JSON data hdd query: %s" % res)
+ download_status = json_loads(res)['download']
if download_status['status'] == '100':
link_status['generated'] = download_status['rpnet_link']
@@ -70,11 +75,11 @@ class RPNetBiz(Hoster):
my_try += 1
if my_try > max_tries: # We went over the limit!
- self.fail("Waited for about 15 minutes for download to finish but failed")
+ self.fail(_("Waited for about 15 minutes for download to finish but failed"))
if 'generated' in link_status:
self.download(link_status['generated'], disposition=True)
elif 'error' in link_status:
self.fail(link_status['error'])
else:
- self.fail("Something went wrong, not supposed to enter here")
+ self.fail(_("Something went wrong, not supposed to enter here"))