From 8e7d14bae4d3c836f029a1235eb227380acc3f75 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Mon, 16 Feb 2015 21:59:10 +0100
Subject: Fix plugins to work on 0.4.10

---
 pyload/plugin/account/FastshareCz.py | 53 ++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 pyload/plugin/account/FastshareCz.py

(limited to 'pyload/plugin/account/FastshareCz.py')

diff --git a/pyload/plugin/account/FastshareCz.py b/pyload/plugin/account/FastshareCz.py
new file mode 100644
index 000000000..8fe98438b
--- /dev/null
+++ b/pyload/plugin/account/FastshareCz.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from pyload.plugin.Account import Account
+from pyload.utils import parseFileSize
+
+
+class FastshareCz(Account):
+    __name__    = "FastshareCz"
+    __type__    = "account"
+    __version__ = "0.05"
+
+    __description__ = """Fastshare.cz account plugin"""
+    __license__     = "GPLv3"
+    __authors__     = [("zoidberg", "zoidberg@mujmail.cz"),
+                       ("stickell", "l.stickell@yahoo.it")]
+
+
+    CREDIT_PATTERN = r'My account\s*\((.+?)\)'
+
+
+    def loadAccountInfo(self, user, req):
+        validuntil  = None
+        trafficleft = None
+        premium     = None
+
+        html = req.load("http://www.fastshare.cz/user", decode=True)
+
+        m = re.search(self.CREDIT_PATTERN, html)
+        if m:
+            trafficleft = self.parseTraffic(m.group(1))
+
+        if trafficleft:
+            premium = True
+            validuntil = -1
+        else:
+            premium = False
+
+        return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+
+    def login(self, user, data, req):
+        req.cj.setCookie("fastshare.cz", "lang", "en")
+
+        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={'login': user, 'heslo': data['password']},
+                        decode=True)
+
+        if ">Wrong username or password" in html:
+            self.wrongPassword()
-- 
cgit v1.2.3