From ba4b5586168a8c1111ca071ca4acca1739bdba84 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 10 Mar 2011 17:27:42 +0100 Subject: closed #257, files.mail.ru premium --- module/plugins/accounts/FilesMailRu.py | 41 ++++++++++++++++++++++++++++++ module/plugins/hoster/FilesMailRu.py | 21 ++++++++------- module/plugins/hoster/NetloadIn.py | 6 ++--- module/web/templates/default/settings.html | 2 +- 4 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 module/plugins/accounts/FilesMailRu.py diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py new file mode 100644 index 000000000..98fe13248 --- /dev/null +++ b/module/plugins/accounts/FilesMailRu.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: RaNaN +""" + +from module.plugins.Account import Account +import re +from time import time + +class FilesMailRu(Account): + __name__ = "FilesMailRu" + __version__ = "0.1" + __type__ = "account" + __description__ = """filesmail.ru account plugin""" + __author_name__ = ("RaNaN") + __author_mail__ = ("RaNaN@pyload.org") + + def loadAccountInfo(self, user, req): + return {"validuntil": None, "trafficleft": None} + + def login(self, user, data,req): + user, domain = user.split("@") + + page = req.load("http://swa.mail.ru/cgi-bin/auth", None, { "Domain" : domain, "Login": user, "Password" : data['password'], "Page" : "http://files.mail.ru/"}, cookies=True) + + if "Неверное имя пользователя или пароль" in page: # @TODO seems not to work + self.wrongPassword() diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index ff6cb76a9..6002ab3dc 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -39,9 +39,9 @@ class FilesMailRu(Hoster): def setup(self): - self.multiDL = True - self.resumeDownload = True - self.chunkLimit = 1 + if not self.account: + self.multiDL = False + self.chunkLimit = 1 def process(self, pyfile): self.html = self.load(pyfile.url) @@ -58,10 +58,13 @@ class FilesMailRu(Hoster): pyfile.name = self.getFileName() #prepare and download''' - self.prepare() - self.download(self.getFileUrl()) - self.myPostProcess(pyfile.name) - + if not self.account: + self.prepare() + self.download(self.getFileUrl()) + self.myPostProcess() + else: + self.download(self.getFileUrl()) + self.myPostProcess() def prepare(self): '''You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected''' @@ -80,7 +83,7 @@ class FilesMailRu(Hoster): file_name = re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('')[0] return file_name - def myPostProcess(self,filename): + def myPostProcess(self): # searches the file for HTMl-Code. Sometimes the Redirect # doesn't work (maybe a curl Problem) and you get only a small # HTML file and the Download is marked as "finished" @@ -93,5 +96,5 @@ class FilesMailRu(Hoster): # (Loading 100MB in to ram is not an option) check = self.checkDownload({"html": "{{_("Password")}} The password for this account. - +