summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/account/EgoFilesCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-03 19:58:02 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-03 19:58:02 +0200
commit43e6a6376625ac73067403ddae3b45a80618d6c8 (patch)
treeceb458c3da1f19e0a91731bc254ee3a158682d0b /pyload/plugins/account/EgoFilesCom.py
parent[ConfigParser] Remove IGNORE feature (diff)
downloadpyload-43e6a6376625ac73067403ddae3b45a80618d6c8.tar.xz
Rename accounts directory to account
Diffstat (limited to 'pyload/plugins/account/EgoFilesCom.py')
-rw-r--r--pyload/plugins/account/EgoFilesCom.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/pyload/plugins/account/EgoFilesCom.py b/pyload/plugins/account/EgoFilesCom.py
new file mode 100644
index 000000000..8947d24c7
--- /dev/null
+++ b/pyload/plugins/account/EgoFilesCom.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+import re
+import time
+
+from pyload.plugins.base.Account import Account
+from pyload.utils import parseFileSize
+
+
+class EgoFilesCom(Account):
+ __name__ = "EgoFilesCom"
+ __type__ = "account"
+ __version__ = "0.2"
+
+ __description__ = """Egofiles.com account plugin"""
+ __author_name__ = "stickell"
+ __author_mail__ = "l.stickell@yahoo.it"
+
+ PREMIUM_ACCOUNT_PATTERN = '<br/>\s*Premium: (?P<P>[^/]*) / Traffic left: (?P<T>[\d.]*) (?P<U>\w*)\s*\\n\s*<br/>'
+
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://egofiles.com")
+ if 'You are logged as a Free User' in html:
+ return {"premium": False, "validuntil": None, "trafficleft": None}
+
+ m = re.search(self.PREMIUM_ACCOUNT_PATTERN, html)
+ if m:
+ validuntil = int(time.mktime(time.strptime(m.group('P'), "%Y-%m-%d %H:%M:%S")))
+ trafficleft = parseFileSize(m.group('T'), m.group('U')) / 1024
+ return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft}
+ else:
+ self.logError("Unable to retrieve account information - Plugin may be out of date")
+
+ def login(self, user, data, req):
+ # Set English language
+ req.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
+
+ html = req.load("http://egofiles.com/ajax/register.php",
+ post={"log": 1,
+ "loginV": user,
+ "passV": data['password']})
+ if 'Login successful' not in html:
+ self.wrongPassword()