# # repeaterpoi.py # # Create POI .csv files for POI Editor # of repeaters from repeaters.csv (www.ukrepeater.net). # # Pat Galea, 2007 # dudegalea.co.uk # import os def writeLine(repLine,file): out=open(homePath+file,'a') out.write(repLine) out.close() homePath='C:/work/tt/' fileIn='repeaterlist.csv' fileAll='repall.csv' file2m='rep2m.csv' file70cm='rep70cm.csv' if os.path.exists(homePath+fileAll): os.unlink(homePath+fileAll) if os.path.exists(homePath+file2m): os.unlink(homePath+file2m) if os.path.exists(homePath+file70cm): os.unlink(homePath+file70cm) fIn=open(homePath+fileIn,'r') file=fIn.readlines() for line in file: band=0 items=line.split(',') call=items[0] try: freq=float(items[2]) except: continue tone=items[9] longit=items[12].rstrip('\n') latit=items[11] print freq, tone, longit, latit descr=call+' '+'%3.3f' % freq+' '+tone+'Hz' if freq>130 and freq < 160: writeLine('"'+descr+'","'+descr+'",'+longit+','+latit+',,,,\r',file2m) if freq>400 and freq < 460: writeLine('"'+descr+'","'+descr+'",'+longit+','+latit+',,,,\r',file70cm) writeLine('"'+descr+'","'+descr+'",'+longit+','+latit+',,,,\r',fileAll) fIn.close()