ranan avatar ranan committed a90ac9a

closed #257, files.mail.ru premium

Comments (0)

Files changed (4)

module/plugins/accounts/FilesMailRu.py

+# -*- 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 <http://www.gnu.org/licenses/>.
+
+    @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()

module/plugins/hoster/FilesMailRu.py

 
     
     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)
         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'''
         file_name = re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[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"
         # (Loading 100MB in to ram is not an option)
         check = self.checkDownload({"html": "<meta name="}, read_size=50000)
         if check == "html":
-            self.log.info(_("There was HTML Code in the Downloaded File("+ filename +")...redirect error? The Download will be restarted."))
+            self.log.info(_("There was HTML Code in the Downloaded File("+ pyfile.name +")...redirect error? The Download will be restarted."))
             self.retry()

module/plugins/hoster/NetloadIn.py

 
 
     apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id="
-    id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)")
+    id_regex = re.compile(NetloadIn.__pattern__)
     urls_per_query = 80
 
     for chunk in chunks(urls, urls_per_query):
             
     def download_api_data(self, n=0):
         url = self.url
-        id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)")
+        id_regex = re.compile(self.__pattern__)
         match = id_regex.search(url)
 
         if not match:
 
         self.log.debug("Netload: APIDATA: "+src)
         self.api_data = {}
-        if src and src != "unknown file_data":
+        if src and src not in ("unknown file_data", "unknown_server_data"):
             lines = src.split(";")
             self.api_data["exists"] = True
             self.api_data["fileid"] = lines[0]

module/web/templates/default/settings.html

 <label for="account_password">{{_("Password")}}
 <span class="small">The password for this account.</span>
 </label>
-<input id="account_password" name="account_password" type="text" size="20" />
+<input id="account_password" name="account_password" type="password" size="20" />
 
 <label for="account_type">{{_("Type")}}
 <span class="small">{{_("Choose the hoster for your account.")}}</span>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.