Batch file to create your preferred DMR ID database
Batch file to create your preferred DMR ID database
As we all know, the GD-77 has limited memory for its DMR ID to callsign/name database. I've written MakeMyDmrDb.bat, a Windows batch file that filters the complete DMR ID database to the user's specifications. I've documented it both with a text file and extensive comments in the batch file itself. As supplied, it creates an output file with all DMR IDs from my home state (Washington) and the adjacent states and Canadian province. You can easily modify it to pass any set of states, provinces, or countries, or any DMR ID prefix or range of prefixes. I'm sharing MakeMyDmrDb.bat with the community here, with thanks for the wonderful OpenGD77 firmware.
Once you modify MakeMyDmrDb.bat to your needs, you can periodically update your user database by downloading the user.csv file from radioid.net, double clicking on MakeMyDmrDb.bat, and uploading the resulting file to your radio. Radioid.net offers similar features for a subscription fee, and OpenGD77 CPS filters by ID prefixes. But MakeMyDmrDb.bat can be set up once, then easily run periodically. It's free, it has no guarantees, it is "use at your own risk," and I hope you find it useful.
MakeMyDmrDb is attached to this message as a Zip file, which contains:
MakeMyDmrDb.bat The batch file
MakeMyDmrDbDocs.txt Documentation
MyCustomDmrIDs.csv A sample file for additional IDs that don't fit the BAT file's search criteria
73 to all,
--Peter, KD7MW
Once you modify MakeMyDmrDb.bat to your needs, you can periodically update your user database by downloading the user.csv file from radioid.net, double clicking on MakeMyDmrDb.bat, and uploading the resulting file to your radio. Radioid.net offers similar features for a subscription fee, and OpenGD77 CPS filters by ID prefixes. But MakeMyDmrDb.bat can be set up once, then easily run periodically. It's free, it has no guarantees, it is "use at your own risk," and I hope you find it useful.
MakeMyDmrDb is attached to this message as a Zip file, which contains:
MakeMyDmrDb.bat The batch file
MakeMyDmrDbDocs.txt Documentation
MyCustomDmrIDs.csv A sample file for additional IDs that don't fit the BAT file's search criteria
73 to all,
--Peter, KD7MW
- Attachments
-
- MakeMyDmrDb.zip
- (4.5 KiB) Downloaded 155 times
Re: Batch file to create your preferred DMR ID database
And for Linux, this is what I've used for a long time:
https://gitlab.com/khaytsus/gd77-tools/ ... /csv2id.sh
Note that the script itself says what the radio needs to be set for; 16 chars, use voice memory, and remember to clear out the region in the CPS which seems to always have a default value and it'll filter out anything else.
I really wish there were a command line tool to write these in Linux, my Anytone 878 I have to use the Windows CPS but I can update the contacts in Linux. I've yet to see a way to do that for OpenGD77 which is odd. Maybe I've missed something.
https://gitlab.com/khaytsus/gd77-tools/ ... /csv2id.sh
Note that the script itself says what the radio needs to be set for; 16 chars, use voice memory, and remember to clear out the region in the CPS which seems to always have a default value and it'll filter out anything else.
I really wish there were a command line tool to write these in Linux, my Anytone 878 I have to use the Windows CPS but I can update the contacts in Linux. I've yet to see a way to do that for OpenGD77 which is odd. Maybe I've missed something.
Re: Batch file to create your preferred DMR ID database
That is a *very* nice shell script. It might be possible but very awkward to duplicate its function in CMD batch language, and it would probably require an external utility or two. I think it would be quite doable in Take Command (which is the successor to 4DOS and 4NT).
Re: Batch file to create your preferred DMR ID database
The logic I wrote, some of the awk voodoo I think I found somewhere else I'm a lazy man, if I gotta do something frequently I'm going to automate as much of it as I can. I have something similar for the Anytone 878, but I can create that data and write it directly in Linux which is super handy, GD77 I gotta fire up my Window VM, copy the file in, etc. Certainly not the end of the world.KD7MW wrote: ↑Mon Feb 28, 2022 4:57 amThat is a *very* nice shell script. It might be possible but very awkward to duplicate its function in CMD batch language, and it would probably require an external utility or two. I think it would be quite doable in Take Command (which is the successor to 4DOS and 4NT).
Re: Batch file to create your preferred DMR ID database
Looks like the MacOS version will require small hacks:
dmr-filter.sh: line 56: [: -gt: unary operator expected
Have of data, getting 43000 more from world-wide
dmr-filter.sh: line 72: [: -gt: unary operator expected
dmr-filter.sh: line 76: 48000-: syntax error: operand expected (error token is "-")
If I get it working, I'll post it here.
dmr-filter.sh: line 56: [: -gt: unary operator expected
Have of data, getting 43000 more from world-wide
dmr-filter.sh: line 72: [: -gt: unary operator expected
dmr-filter.sh: line 76: 48000-: syntax error: operand expected (error token is "-")
If I get it working, I'll post it here.
Re: Batch file to create your preferred DMR ID database
First thing to try is changing the very top line to #!/bin/bash, I normally do this to make 100% sure bash is used, I had forgotten here. You might be running it on some older sh here, I've ran into that issue on some other distros where /bin/sh isn't just bash, bad assumption on my part.
If that doesn't help.... Not sure what "dmr-filter.sh" is, did you change the name from csv2id.sh I guess? Just look at the script and see which variable is empty on line 56, I'm guessing it's $lines, so go backwards from there. Check that curl is getting files, then check that the file referred to as $output is populated with data.
Re: Batch file to create your preferred DMR ID database
Quick looking at the script, it's always a bad idea to not surround variables with double quotes, as the variable could be empty at some point, hence condition testing will trigger a syntax error, e.g:kt4lh wrote: ↑Fri Mar 18, 2022 11:57 amFirst thing to try is changing the very top line to #!/bin/bash, I normally do this to make 100% sure bash is used, I had forgotten here. You might be running it on some older sh here, I've ran into that issue on some other distros where /bin/sh isn't just bash, bad assumption on my part.
If that doesn't help.... Not sure what "dmr-filter.sh" is, did you change the name from csv2id.sh I guess? Just look at the script and see which variable is empty on line 56, I'm guessing it's $lines, so go backwards from there. Check that curl is getting files, then check that the file referred to as $output is populated with data.
Code: Select all
if [ ${lines} -gt ${max} ]; then
Code: Select all
if [ "${lines}" -gt "${max}" ]; then
About the first line, it's better to use:
Code: Select all
#!/usr/bin/env bash
Code: Select all
#!/bin/sh
But yes, at least, it should be /bin/bash, as /bin/sh is a link on most system, but could be defaulted to tcsh or any non bash shell.
And this script is definitely using bash syntax.
Cheers.
---
Daniel
Re: Batch file to create your preferred DMR ID database
Yes, I usually do that with strings but was thinking that numeric comparisons this would not work, but in a quick test it does seem to.
Either way it demonstrates an issue somewhere above the conditional; not the conditional itself. Either of these two values being empty is a failure somewhere.