diff options
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/accounts/FileserveCom.py | 33 | ||||
| -rw-r--r-- | module/plugins/accounts/HotfileCom.py | 43 | ||||
| -rw-r--r-- | module/plugins/accounts/RapidshareCom.py | 5 | ||||
| -rw-r--r-- | module/plugins/accounts/UploadedTo.py | 2 | 
4 files changed, 44 insertions, 39 deletions
| diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 2862e5ab0..a9b222a6a 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -31,21 +31,24 @@ class FileserveCom(Account):      __author_mail__ = ("mkaay@mkaay.de")      def getAccountInfo(self, user): -        req = self.core.requestFactory.getRequest(self.__name__, user) -         -        src = req.load("http://fileserve.com/dashboard.php", cookies=True) -         -        out = Account.getAccountInfo(self, user) -         -        m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src) -        if m: -            zone = -5 if m.group(2) == "S" else -4 -            validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600) -            tmp = {"validuntil":validuntil, "trafficleft":-1} -        else: -            tmp = {"trafficleft":-1} -        out.update(tmp) -        return out +        try: +            req = self.core.requestFactory.getRequest(self.__name__, user) +             +            src = req.load("http://fileserve.com/dashboard.php", cookies=True) +             +            out = Account.getAccountInfo(self, user) +             +            m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src) +            if m: +                zone = -5 if m.group(2) == "S" else -4 +                validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600) +                tmp = {"validuntil":validuntil, "trafficleft":-1} +            else: +                tmp = {"trafficleft":-1} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(user)      def login(self, user, data):          req = self.core.requestFactory.getRequest(self.__name__, user) diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index af38b56a3..e6e8ba517 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -31,27 +31,30 @@ class HotfileCom(Account):      __author_mail__ = ("mkaay@mkaay.de")      def getAccountInfo(self, user): -        req = self.core.requestFactory.getRequest(self.__name__, user) -         -        resp = self.apiCall("getuserinfo", user=user) -        if resp.startswith("."): -            self.core.debug("HotfileCom API Error: %s" % resp) -            return None -        info = {} -        for p in resp.split("&"): -            key, value = p.split("=") -            info[key] = value +        try: +            req = self.core.requestFactory.getRequest(self.__name__, user) -        info["premium_until"] = info["premium_until"].replace("T"," ") -        zone = info["premium_until"][19:] -        info["premium_until"] = info["premium_until"][:19] -        zone = int(zone[:3]) -         -        validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) -        out = Account.getAccountInfo(self, user) -        tmp = {"validuntil":validuntil, "trafficleft":-1} -        out.update(tmp) -        return out +            resp = self.apiCall("getuserinfo", user=user) +            if resp.startswith("."): +                self.core.debug("HotfileCom API Error: %s" % resp) +                raise Exception +            info = {} +            for p in resp.split("&"): +                key, value = p.split("=") +                info[key] = value +                 +            info["premium_until"] = info["premium_until"].replace("T"," ") +            zone = info["premium_until"][19:] +            info["premium_until"] = info["premium_until"][:19] +            zone = int(zone[:3]) +             +            validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) +            out = Account.getAccountInfo(self, user) +            tmp = {"validuntil":validuntil, "trafficleft":-1} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(user)      def apiCall(self, method, post={}, user=None):          if user: diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index b656bb763..c9766cd57 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -34,13 +34,13 @@ class RapidshareCom(Account):                  if account[0] == user:                      data = account[1]              if not data: -                return +                raise Exception              req = self.core.requestFactory.getRequest(self.__name__, user)              api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"              api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1}              src = req.load(api_url_base, cookies=False, get=api_param_prem)              if src.startswith("ERROR"): -                return +                raise Exception              fields = src.split("\n")              info = {}              for t in fields: @@ -54,7 +54,6 @@ class RapidshareCom(Account):              maxtraffic = int(info["rapids"])/14 * (5*1024*1024) + restkb              tmp = {"validuntil":int(info["billeduntil"]), "trafficleft":maxtraffic if int(info["autorefill"]) else restkb, "maxtraffic":maxtraffic}              out.update(tmp) -                          return out          except:              return Account.getAccountInfo(self, user) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 764cc50be..1311ee809 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -36,7 +36,7 @@ class UploadedTo(Account):                  if account[0] == user:                      data = account[1]              if not data: -                return +                raise Exception              req = self.core.requestFactory.getRequest(self.__name__, user)              html = req.load("http://uploaded.to/", cookies=True)              raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1) | 
