ships plc-map.py and refresh-peer.py together with myplc
authorthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Tue, 20 Mar 2007 12:14:34 +0000 (12:14 +0000)
committerthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Tue, 20 Mar 2007 12:14:34 +0000 (12:14 +0000)
scripts/plc-map.py [deleted file]
scripts/refresh-peer.py [deleted file]

diff --git a/scripts/plc-map.py b/scripts/plc-map.py
deleted file mode 100755 (executable)
index 693c75b..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env plcsh
-import Image, ImageDraw
-
-def circle (image, percentX, percentY, radiusX, radiusY, colorIn, colorOut):
-
-    imageX, imageY = image.size
-    centerX = int(imageX*percentX)
-    centerY = int(imageY*percentY)
-    x = max (0, min (centerX,imageX))
-    y = max (0, min (centerY,imageY))
-
-    x1 = x - radiusX
-    x2 = x + radiusX
-    y1 = y - radiusY
-    y2 = y + radiusY
-
-    draw = ImageDraw.Draw (image)
-    draw.chord((x1,y1,x2,y2), 0, 360, fill=colorIn, outline=colorOut )
-    del draw
-
-latitude={'top':65.,
-          'bottom': 35.5}
-longitude={'left':-11.,
-           'right':58.}
-    
-def render_site (site, image, sx, sy, cIn, cOut):
-    if site['longitude'] is not None and site['latitude'] is not None:
-        px=float(longitude['left']-site['longitude'])/float(longitude['left']-longitude['right'])
-        py=float(latitude['top']-site['latitude'])/float(latitude['top']-latitude['bottom'])
-        if (px<0 or py<0 or px>1 or py>1):
-            return
-        
-        circle(image,px,py,sx,sy,cIn,cOut)
-    
-
-def main ():
-
-    path = '/var/www/html/'
-    original = path + 'map.png'
-    live = path + 'livemap.png'
-
-    # map characteristics, in degrees.
-    # latitude : positive is north
-    # longitude : positive is east 
-
-    # circle radius in pixels
-    sxLocal,syLocal=7,7
-    # circle in and out colors
-    cInLocal , cOutLocal = '#566b8a','#bbbbbb'
-
-    # same for federating / foreign sites
-    sxForeign,syForeign=6,6
-    cInForeign , cOutForeign = '#acb3a4', '#444444'
-    image = Image.open(original)
-
-    for site in GetSites({'~peer_id':None}):
-        render_site (site, image, sxForeign, syForeign, cInForeign , cOutForeign)
-    # local sites go last to be more visible
-    for site in GetSites({'peer_id':None}):
-        render_site (site, image, sxLocal, syLocal, cInLocal , cOutLocal)
-            
-    image.save (live)
-
-if __name__ == '__main__':
-    main ()
diff --git a/scripts/refresh-peer.py b/scripts/refresh-peer.py
deleted file mode 100755 (executable)
index e9a24c9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env plcsh
-
-import sys,os,time
-
-def Run (peername):
-    timestring=time.strftime("%Y-%m-%d-%H-%M-%S")
-    print 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
-    print 'RefreshPeer on %s - starting on %s'%(peername,timestring)
-    sys.stdout.flush()
-    start=time.time()
-    result=RefreshPeer(peername)
-    finish=time.time()
-
-    print 'Total duration',finish-start
-    print 'xxxxxxxxxx timers:'
-    keys=result.keys()
-    keys.sort()
-    for key in keys:
-        print key,result[key]
-    sys.stdout.flush()
-    sys.stderr.flush()
-
-def RunInLog (peername):
-    logname="/var/log/refreshpeer.log"
-    sys.stdout=open(logname,'a')
-    sys.stderr=sys.stdout
-    Run(peername)
-    sys.stderr.close()
-    sys.stdout.close()
-
-if __name__ == "__main__":
-    
-    for peername in sys.argv[1:]:
-        RunInLog (peername)