summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Christopher <4Christopher@gmx.de> 2013-03-11 20:59:56 +0100
committerGravatar Christopher <4Christopher@gmx.de> 2013-03-11 20:59:56 +0100
commit672baa5c6fd748d90a750495d025e3f7933bc195 (patch)
treeeb95b1f9dcb858d78f9bf04cc2086e0c90d9757d /module/plugins
parentadded setting to set how many URLs should be returned for each episode. (diff)
parentEgoFilesCom: fixed time import trouble (diff)
downloadpyload-672baa5c6fd748d90a750495d025e3f7933bc195.tar.xz
Merge branch 'stable' of git://github.com/pyload/pyload into stable
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/accounts/EgoFilesCom.py40
-rw-r--r--module/plugins/hoster/EgoFilesCom.py11
2 files changed, 50 insertions, 1 deletions
diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py
new file mode 100644
index 000000000..da1ed03ad
--- /dev/null
+++ b/module/plugins/accounts/EgoFilesCom.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Account import Account
+import re
+import time
+from module.utils import parseFileSize
+
+class EgoFilesCom(Account):
+ __name__ = "EgoFilesCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __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()
diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py
index 61203f9bd..2109c8ea7 100644
--- a/module/plugins/hoster/EgoFilesCom.py
+++ b/module/plugins/hoster/EgoFilesCom.py
@@ -13,7 +13,7 @@ class EgoFilesCom(SimpleHoster):
__name__ = "EgoFilesCom"
__type__ = "hoster"
__pattern__ = r"https?://(www\.)?egofiles.com/(\w+)"
- __version__ = "0.02"
+ __version__ = "0.03"
__description__ = """Egofiles.com Download Hoster"""
__author_name__ = ("stickell")
__author_mail__ = ("l.stickell@yahoo.it")
@@ -28,6 +28,12 @@ class EgoFilesCom(SimpleHoster):
# Set English language
self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
+ def process(self, pyfile):
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
def handleFree(self):
self.html = self.load(self.pyfile.url, decode=True)
@@ -60,4 +66,7 @@ class EgoFilesCom(SimpleHoster):
self.download(downloadURL)
+ def handlePremium(self):
+ self.download(self.pyfile.url)
+
getInfo = create_getInfo(EgoFilesCom)