I went to do some lookups on the DMR-MARC database this evening and was greeted with a warning:
THIS TOOL WILL BE REPLACED BY AN API, ONLY FORMAT WILL BE JSON, CHANGE YOUR SCRIPTS NOW!
Since the firmware has a dependency on the database being in CSV for easy lookup, I wrote up a simple piece of code to grab the current JSON from DMR-MARC and render it in the current CSV format:
#!/usr/bin/env python3
import requests
req = requests.get('http://www.dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=users&format=json')
dmrdb = req.json()
for user in dmrdb['users']:
print("{radio_id},{callsign},{name} {surname},{city},{state},,{country}".format(**user))
This will emit the CSV on stdout. There's not much in the way of error checking here, mostly a proof of concept.
I went to do some lookups on the DMR-MARC database this evening and was greeted with a warning:
Since the firmware has a dependency on the database being in CSV for easy lookup, I wrote up a simple piece of code to grab the current JSON from DMR-MARC and render it in the current CSV format:
This will emit the CSV on stdout. There's not much in the way of error checking here, mostly a proof of concept.