# -*- coding: utf-8 -*-

import re

from time import mktime, strptime, gmtime

from module.plugins.internal.XFSPAccount import XFSPAccount


class EasybytezCom(XFSPAccount):
    __name__    = "EasybytezCom"
    __type__    = "account"
    __version__ = "0.08"

    __description__ = """EasyBytez.com account plugin"""
    __license__     = "GPLv3"
    __authors__     = [("zoidberg", "zoidberg@mujmail.cz"),
                       ("guidobelix", "guidobelix@hotmail.it")]


    HOSTER_NAME = "easybytez.com"


    def loadAccountInfo(self, user, req):
        html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True)

        validuntil = None
        trafficleft = None
        premium = False

        m = re.search(self.VALID_UNTIL_PATTERN, html)
        if m:
            expiredate = m.group(1)
            self.logDebug("Expire date: " + expiredate)

            try:
                validuntil = mktime(strptime(expiredate, "%d %B %Y"))
            except Exception, e:
                self.logError(e)

            if validuntil > mktime(gmtime()):
                premium = True
                trafficleft = -1
            else:
                premium = False
                validuntil = -1

        m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
        if m:
            trafficleft = m.group(1)
            if "Unlimited" in trafficleft:
                trafficleft = -1
            else:
                trafficleft = self.parseTraffic(trafficleft)

        return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}

@@ -505,1067 +505,4 @@
 om%22%0A
-%0A%0A    def loadAccountInfo(self, user, req):%0A        html = req.load(self.HOSTER_URL, get=%7B'op': %22my_account%22%7D, decode=True)%0A%0A        validuntil = None%0A        trafficleft = None%0A        premium = False%0A%0A        m = re.search(self.VALID_UNTIL_PATTERN, html)%0A        if m:%0A            expiredate = m.group(1)%0A            self.logDebug(%22Expire date: %22 + expiredate)%0A%0A            try:%0A                validuntil = mktime(strptime(expiredate, %22%25d %25B %25Y%22))%0A            except Exception, e:%0A                self.logError(e)%0A%0A            if validuntil %3E mktime(gmtime()):%0A                premium = True%0A                trafficleft = -1%0A            else:%0A                premium = False%0A                validuntil = -1%0A%0A        m = re.search(self.TRAFFIC_LEFT_PATTERN, html)%0A        if m:%0A            trafficleft = m.group(1)%0A            if %22Unlimited%22 in trafficleft:%0A                trafficleft = -1%0A            else:%0A                trafficleft = self.parseTraffic(trafficleft)%0A%0A        return %7B%22validuntil%22: validuntil, %22trafficleft%22: trafficleft, %22premium%22: premium%7D%0A

Remove unnecessary loadAccountInfo method