data = csv.reader(f, delimiter=',', quotechar='"') for row in data: count += 1 if count == 1: continue repeater = Repeater(row[0]) repeater.tx = float(row[3]) repeater.rx = float(row[4]) if row[10] != '': repeater.ctcss = float(row[10]) if row[5] == "AV": repeater.mode = "FM" if row[5] == "DSTAR": repeater.mode = "DSTAR" if row[5] == "DMR": repeater.mode = "DMR" if row[5] == "DUALMODE": repeater.mode = "FM" repeater.locator = row[6] repeater.town = row[7] repeater.keeper = row[11] repeater.lat = row[12] repeater.lon = row[13] repeater.source = "http://ukrepeater.net/" print(repeater) repeater.update() f.close()
for row in repeater_rows: count = count + 1 if count == 1: continue # Skip the header row fields = row.find_all('td') repeater = Repeater(fields[2].next_element.strip()) if repeater.callsign[0:2] == "GB": continue # we get these anyway from ukrepeater repeater.rx = fields[1].next_element.next_element.next_element.strip() repeater.tx = fields[1].next_element.next_element.next_element.next_element.next_element.next_element.next_element.strip() activation = re.sub("\/", "", fields[3].next_element.strip()) if activation == "Carrier": repeater.carrier = True elif activation == "1750Hz": repeater.burst = True else: repeater.ctcss = re.sub("Hz", "", activation) repeater.mode = "FM" repeater.town = fields[4].next_element.strip() location = geolocator.geocode(re.sub(",.*$", "", repeater.town) + ", Republic of Ireland", timeout=10) if location == None: continue # TODO need to get a better geocoding system, or actually pull out the ml repeater.lat = location.latitude repeater.lon = location.longitude repeater.locator = latlong_to_locator(repeater.lat, repeater.lon) time.sleep(2) repeater.source = "http://www.irts.ie/" print repeater repeater.update()
data = data.replace('°', ' ') for row in csv.reader(data.split('\n'), delimiter=';'): if len(row) != 9: continue repeater = Repeater(row[0]) try: repeater.tx = float(row[1].replace(',', '.')) except ValueError: # Some data is just wrong or malformatted pass if (row[2] != '') and (row[2] != 'Beacon'): try: repeater.rx = float(row[2].replace(',', '.')) except ValueError: pass if row[8] == 'DMR': # Unfortunately, most will be missing this repeater.mode = row[8] if row[7] != '': repeater.ctcss = float(row[7].replace(',', '.')) repeater.mode = "FM" repeater.locator = row[3] # The fourth column is actually info, and *usually* has the town name. # It may be something different, or have additional information. # TODO Get town name based on lat/long or locator repeater.town = ' '.join(row[4].split()) # Remove consecutive whitespace repeater.lat, repeater.lon = locator_to_latlong(repeater.locator) repeater.source = "http://echorelais.darc.de/" print(repeater) repeater.update()