#!/usr/bin/env python
# license: Creative Commons Zero

import warnings
from optparse import OptionParser

parser = OptionParser(description="""Converts CSV file (on stdin) to navit 
bookmark.txt file (on stdout).

The CSV file should have name, latitude, and longitude fields; the coordinates
are expected to be in degree decimal format.""")

(options, args) = parser.parse_args()

import csv, os, sys

for record in csv.DictReader(sys.stdin, delimiter=',', escapechar='\\'):
 sys.stdout.write('mg:' + record['longitude'] + ' ' + record['latitude'] + ' type=bookmark label=\"' + record['name'] + '\"\n')
