Mercurial > eagle-eye
comparison pyikriam/buildings.py @ 178:bff16e6ee3ef
Extract status of reearching for Academy.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 02 Nov 2008 16:33:01 +0800 |
parents | 6adad3bcca78 |
children | bf4ddf5bffb9 |
comparison
equal
deleted
inserted
replaced
177:6adad3bcca78 | 178:bff16e6ee3ef |
---|---|
101 | 101 |
102 class academy(building): | 102 class academy(building): |
103 def __init__(self, city_id, idx, baseurl): | 103 def __init__(self, city_id, idx, baseurl): |
104 super(academy, self).__init__('academy', city_id, idx, baseurl) | 104 super(academy, self).__init__('academy', city_id, idx, baseurl) |
105 pass | 105 pass |
106 | |
107 def _sync(self, page_dom): | |
108 xpath_research_name = '/descendant::*[@class=\'researchName\']/a' | |
109 anodes = page_dom.xpath(xpath_research_name) | |
110 if len(anodes) == 1: | |
111 anode = anodes[0] | |
112 self.researching = anode.get('title') | |
113 xpath_countdown = '/descendant::div[@id=\'researchCountDown\']/text()' | |
114 txtnodes = page_dom.xpath(xpath_countdown) | |
115 self.researching_countdown = txtnodes[0] | |
116 else: | |
117 self.researching = None | |
118 self.researching_countdown = None | |
119 pass | |
120 | |
121 super(academy, self)._sync(page_dom) | |
122 pass | |
106 pass | 123 pass |
107 | 124 |
108 class warehouse(building): | 125 class warehouse(building): |
109 def __init__(self, city_id, idx, baseurl): | 126 def __init__(self, city_id, idx, baseurl): |
110 super(warehouse, self).__init__('warehouse', city_id, idx, baseurl) | 127 super(warehouse, self).__init__('warehouse', city_id, idx, baseurl) |