Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMR-MARC user ID database changing to JSON #857

Closed
nivex opened this issue Mar 11, 2018 · 1 comment
Closed

DMR-MARC user ID database changing to JSON #857

nivex opened this issue Mar 11, 2018 · 1 comment

Comments

@nivex
Copy link
Contributor

nivex commented Mar 11, 2018

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.

@travisgoodspeed
Copy link
Owner

Thanks for noticing this. Any chance you'd be interested in writing a pull request to exclusively use the JSON source?

travisgoodspeed added a commit that referenced this issue Mar 12, 2018
Change dmr-marc user pull format from CSV to JSON Fixes #857
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants