Example #1
0
def load_fm_contour(callsign,appid,freq,city,state, lat, lon):
    kml = load_from_website(callsign,appid,freq,city,state)
    testjs = parse_kml_to_dict(kml, None)
    if is_null_island(testjs)
        testjs = fix_shift(testjs,lat,lon)
    s = write_to_string(testjs, None)
    return s
Example #2
0
def load_am_contour(fid, callsign,ant,appid,freq,city,state,lat,lon):
    ant = load_ant(fid)
    kml = load_from_website_am(callsign,ant,appid,freq,city,state)
    testjs = parse_kml_to_dict(kml, None)
    if is_null_island(testjs):
        testjs = fix_shift(testjs,lat,lon)
        

    s = write_to_string(testjs, None)
    
    if not s:
        print 'bad contour, not committing'
        return None
    return s
Example #3
0
def load_fm_contour(callsign,appid,freq,city,state, lat, lon):
    kml = load_from_website(callsign,appid,freq,city,state)
    testjs = parse_kml_to_dict(kml, None)
    if is_null_island(testjs)
        testjs = fix_shift(testjs,lat,lon)
    s = write_to_string(testjs, None)
    return s


if __name__ == '__main__':
    db = sqlite3.connect('fcc.db')
    cur = db.cursor()

    cur.execute('''SELECT id,callsign,appid,freq,city,state FROM fm WHERE
                    member NOT NULL and status=? and service=?''',('LIC', 'FM'))
    to_search = cur.fetchall()
    print 'Total: ' + str(len(to_search))
    for i, c in enumerate(to_search):
        print str(i) + ': ' + str(c[1])
        kml = load_from_website(c[1],c[2],c[3],c[4].replace(' ','_').upper(),c[5])
        s = write_to_string(parse_kml_to_dict(kml, None), None)
        cur.execute('''UPDATE fm SET con=? WHERE id=?''', (s, c[0]))

    
    db.commit()
    db.close()