summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-05-20 20:19:00 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-05-20 20:19:00 +0200
commitd4451312d80b0443cf7a48142c00dcc7bf3be65a (patch)
treeb152f6dc0e5a98b4e944648590e34f2f12282a45 /module/plugins/accounts
parentsmaller footer (diff)
parentCloudzerNet: reconnect support (diff)
downloadpyload-d4451312d80b0443cf7a48142c00dcc7bf3be65a.tar.xz
Merge branch 'stable'
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r--module/plugins/accounts/CzshareCom.py41
-rw-r--r--module/plugins/accounts/FastshareCz.py28
-rw-r--r--module/plugins/accounts/FilefactoryCom.py10
-rw-r--r--module/plugins/accounts/MultiDebridCom.py47
-rw-r--r--module/plugins/accounts/RapidgatorNet.py6
5 files changed, 90 insertions, 42 deletions
diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py
index e68248aa8..7b1a8edc5 100644
--- a/module/plugins/accounts/CzshareCom.py
+++ b/module/plugins/accounts/CzshareCom.py
@@ -17,42 +17,41 @@
@author: zoidberg
"""
-from module.plugins.Account import Account
from time import mktime, strptime
-from string import replace
import re
+from module.plugins.Account import Account
+
+
class CzshareCom(Account):
__name__ = "CzshareCom"
- __version__ = "0.11"
+ __version__ = "0.13"
__type__ = "account"
__description__ = """czshare.com account plugin"""
- __author_name__ = ("zoidberg")
- __author_mail__ = ("zoidberg@mujmail.cz")
-
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([0-9 ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>'
def loadAccountInfo(self, user, req):
- self.relogin(user)
html = req.load("http://czshare.com/prehled_kreditu/")
-
+
found = re.search(self.CREDIT_LEFT_PATTERN, html)
- if found is None:
- credits, validuntil = 0, 0
+ if not found:
+ return {"validuntil": 0, "trafficleft": 0}
else:
- credits = float(found.group(1).replace(' ', '').replace(',','.'))
- credits = credits * 1024**{'KiB' : 0, 'MiB' : 1, 'GiB' : 2}[found.group(2)]
+ credits = float(found.group(1).replace(' ', '').replace(',', '.'))
+ credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[found.group(2)]
validuntil = mktime(strptime(found.group(3), '%d.%m.%y %H:%M'))
-
- return {"validuntil": validuntil, "trafficleft": credits}
-
+ return {"validuntil": validuntil, "trafficleft": credits}
+
def login(self, user, data, req):
-
+
html = req.load('https://czshare.com/index.php', post={
- "Prihlasit": "Prihlasit",
- "login-password": data["password"],
- "login-name": user
- })
-
+ "Prihlasit": "Prihlasit",
+ "login-password": data["password"],
+ "login-name": user
+ })
+
if '<div class="login' in html:
self.wrongPassword()
diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py
index 333ee3761..69bbb0827 100644
--- a/module/plugins/accounts/FastshareCz.py
+++ b/module/plugins/accounts/FastshareCz.py
@@ -21,32 +21,34 @@ import re
from module.plugins.Account import Account
from module.utils import parseFileSize
+
class FastshareCz(Account):
__name__ = "FastshareCz"
- __version__ = "0.01"
+ __version__ = "0.02"
__type__ = "account"
__description__ = """fastshare.cz account plugin"""
- __author_name__ = ("zoidberg")
- __author_mail__ = ("zoidberg@mujmail.cz")
-
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
def loadAccountInfo(self, user, req):
- html = req.load("http://www.fastshare.cz/user", decode = True)
-
- found = re.search(r'Kredit: </td><td>(.+?)&nbsp;', html)
+ html = req.load("http://www.fastshare.cz/user", decode=True)
+
+ found = re.search(r'(?:Kredit|Credit)\s*: </td><td>(.+?)&nbsp;', html)
if found:
- trafficleft = parseFileSize(found.group(1)) / 1024
+ trafficleft = parseFileSize(found.group(1)) / 1024
premium = True if trafficleft else False
else:
trafficleft = None
- premium = False
+ premium = False
return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium}
-
+
def login(self, user, data, req):
- html = req.load('http://www.fastshare.cz/sql.php', post = {
+ req.load('http://www.fastshare.cz/login') # Do not remove or it will not login
+ html = req.load('http://www.fastshare.cz/sql.php', post={
"heslo": data['password'],
"login": user
- }, decode = True)
-
+ }, decode=True)
+
if u'>Špatné uživatelské jméno nebo heslo.<' in html:
self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py
index 356c5d22a..8e163e2f6 100644
--- a/module/plugins/accounts/FilefactoryCom.py
+++ b/module/plugins/accounts/FilefactoryCom.py
@@ -23,13 +23,13 @@ from time import mktime, strptime
class FilefactoryCom(Account):
__name__ = "FilefactoryCom"
- __version__ = "0.12"
+ __version__ = "0.13"
__type__ = "account"
__description__ = """filefactory.com account plugin"""
- __author_name__ = ("zoidberg")
- __author_mail__ = ("zoidberg@mujmail.cz")
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
- ACCOUNT_INFO_PATTERN = r'<a href="/premium/">.*?datetime="(.*?)"'
+ ACCOUNT_INFO_PATTERN = r'<time datetime="([\d-]+)">'
def loadAccountInfo(self, user, req):
html = req.load("http://www.filefactory.com/member/")
@@ -37,7 +37,7 @@ class FilefactoryCom(Account):
found = re.search(self.ACCOUNT_INFO_PATTERN, html)
if found:
premium = True
- validuntil = mktime(strptime(re.sub(r"(\d)[a-z]{2} ", r"\1 ", found.group(1)),"%d %B, %Y"))
+ validuntil = mktime(strptime(found.group(1),"%Y-%m-%d"))
else:
premium = False
validuntil = -1
diff --git a/module/plugins/accounts/MultiDebridCom.py b/module/plugins/accounts/MultiDebridCom.py
new file mode 100644
index 000000000..904be5ee7
--- /dev/null
+++ b/module/plugins/accounts/MultiDebridCom.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from time import time
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class MultiDebridCom(Account):
+ __name__ = "MultiDebridCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Multi-debrid.com account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ if 'days_left' in self.json_data:
+ validuntil = int(time() + self.json_data['days_left'] * 86400)
+ return {"premium": True, "validuntil": validuntil, "trafficleft": -1}
+ else:
+ self.logError('Unable to get account information')
+
+ def login(self, user, data, req):
+ # Password to use is the API-Password written in http://multi-debrid.com/myaccount
+ self.html = req.load("http://multi-debrid.com/api.php",
+ get={"user": user, "pass": data["password"]})
+ self.logDebug('JSON data: ' + self.html)
+ self.json_data = json_loads(self.html)
+ if self.json_data['status'] != 'ok':
+ self.logError('Invalid login. The password to use is the API-Password you find in your "My Account" page')
+ self.wrongPassword()
diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py
index 74825a0f9..85adc71a3 100644
--- a/module/plugins/accounts/RapidgatorNet.py
+++ b/module/plugins/accounts/RapidgatorNet.py
@@ -24,7 +24,7 @@ from module.common.json_layer import json_loads
class RapidgatorNet(Account):
__name__ = "RapidgatorNet"
- __version__ = "0.03"
+ __version__ = "0.04"
__type__ = "account"
__description__ = """rapidgator.net account plugin"""
__author_name__ = ("zoidberg")
@@ -46,7 +46,7 @@ class RapidgatorNet(Account):
self.scheduleRefresh(user, json['response']['reset_in'])
return {"validuntil": json['response']['expire_date'],
- "trafficleft": json['response']['traffic_left'] / 1024,
+ "trafficleft": int(json['response']['traffic_left']) / 1024,
"premium": True}
else:
self.logError(json['response_details'])
@@ -71,4 +71,4 @@ class RapidgatorNet(Account):
except Exception, e:
self.logError(e)
- self.wrongPassword() \ No newline at end of file
+ self.wrongPassword()