add the PRIORITY_CONNECTION optimization (closes #319)
This commit is contained in:
parent
bc978b7112
commit
fd3ccda664
6 changed files with 174 additions and 13 deletions
|
|
@ -35,7 +35,8 @@ class HomePage(PageBase):
|
|||
error("Error: Unable to find my ID")
|
||||
return 0
|
||||
|
||||
def nb_available_charms(self):
|
||||
def __get_home_indicator(self, pos, what):
|
||||
|
||||
tables = self.document.getElementsByTagName('table')
|
||||
for table in tables:
|
||||
if table.hasAttribute('style') and table.getAttribute('style') == 'background-color:black;background-image:url(http://s.adopteunmec.com/img/barmec.gif);background-repeat:no-repeat':
|
||||
|
|
@ -44,7 +45,13 @@ class HomePage(PageBase):
|
|||
for font in fonts:
|
||||
if font.hasAttribute('color') and font.getAttribute('color') == '#ff0198':
|
||||
i += 1
|
||||
if i == 3:
|
||||
if i == pos:
|
||||
return int(font.firstChild.data)
|
||||
warning(u'Could not parse number of charms available')
|
||||
warning(u'Could not parse number of %s' % what)
|
||||
return 0
|
||||
|
||||
def nb_available_charms(self):
|
||||
return self.__get_home_indicator(3, 'available charms')
|
||||
|
||||
def nb_godchilds(self):
|
||||
return self.__get_home_indicator(2, 'godchilds')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue