X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=bin%2Fplc-kml.py;h=b246300ed2eced4dfca89ae71fb77bfafa9a63fa;hb=dbf0fc19b34d57bbb2645c03739d326fb07ba8be;hp=460c0d9eba82a21a9eececa23d74b729d53389f8;hpb=c1bd1740729b8a0c6ead549c79949283d78ac0ea;p=myplc.git diff --git a/bin/plc-kml.py b/bin/plc-kml.py index 460c0d9..b246300 100755 --- a/bin/plc-kml.py +++ b/bin/plc-kml.py @@ -46,7 +46,7 @@ class KmlMap: self.open() self.write_header() # cache peers - peers = GetPeers({},['peer_id','peername']) + peers = GetPeers() all_sites = GetSites({'enabled':True,'is_public':True}) all_sites.sort(KmlMap.site_compare) for site in all_sites: @@ -75,12 +75,13 @@ class KmlMap: self.write(""" """) - def peer_name (self,site, peers): + def peer_info (self,site, peers): if not site['peer_id']: - return "local" + return (api.config.PLC_NAME, "http://%s/"%api.config.PLC_API_HOST,) for peer in peers: if peer['peer_id'] == site['peer_id']: - return peer['peername'] + return (peer['peername'],peer['peer_url'].replace("PLCAPI/",""),) + return "Unknown peer_name" def write_site (self, site, peers): # discard sites with missing lat or lon @@ -100,6 +101,29 @@ class KmlMap: baseurl='http://%s'%api.config.PLC_WWW_HOST peer_id=site['peer_id'] + # STYLE + # the size for google icons + if not self.options.use_custom_icons: + if not peer_id: + # local sites + iconfile=default_local_builtin + xyspec="12803232" + else: + # remote + iconfile=default_foreign_builtin + xyspec="16003232" + iconurl="root://icons/%(iconfile)s"%locals() + # the size for our own brew of icons + else: + if not peer_id: + iconfile=self.options.local_icon + else: + iconfile=self.options.foreign_icon + iconurl="%(baseurl)s/%(iconfile)s"%locals() + xyspec="" + + iconspec="%(iconurl)s%(xyspec)s"%locals() + # open description description = "
" @@ -108,20 +132,11 @@ class KmlMap: description += "" # URL @@ -167,29 +182,6 @@ class KmlMap: name="" description="" - # STYLE - # the size for google icons - if not self.options.use_custom_icons: - if not peer_id: - # local sites - iconfile=default_local_builtin - xyspec="12803232" - else: - # remote - iconfile=default_foreign_builtin - xyspec="16003232" - iconurl="root://icons/%(iconfile)s"%locals() - # the size for our own brew of icons - else: - if not peer_id: - iconfile=self.options.local_icon - else: - iconfile=self.options.foreign_icon - iconurl="%(baseurl)s/%(iconfile)s"%locals() - xyspec="" - - iconspec="%(iconurl)s%(xyspec)s"%locals() - # set the camera 50km high template="""
" description += "Testbed" description += "" - if peer_id: - peername = 'PlanetLab Central' - peerurl = 'http://www.planet-lab.org' - #self.peer_name(site,peers) - else: - peername = 'PlanetLab Europe' - peerurl = 'http://www.planet-lab.eu' + (peername,peerurl) = self.peer_info (site,peers) description += " %(peername)s "%locals() #description += "[description]"%locals() description += "" - if peer_id: - description += ""%locals() - else: - description += ""%locals() + description += ""%locals() description += "