Last active
June 9, 2018 00:37
-
-
Save imagesafari/e41160e182631271bf16942b520924dc to your computer and use it in GitHub Desktop.
Generate sdrtrunk aliases from RR talkgroup csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Convert RadioReference.com talkgroup csv download into xml to insert into sdrtrunk playlist.xml | |
# | |
# Usage: perl make_playlist.pl <csv filename> > <aliasfile.xml> | |
# | |
# Jon Anhold (jon@anhold.com) N8USK - 2016-08-19 | |
use Data::Dumper; | |
my ($FILE) = @ARGV; | |
open FILE, "<$FILE"; | |
while (<FILE>) { | |
my @line = (); | |
next if $_ =~ /^Decimal/; #skip header | |
chomp; | |
my ($decimaltg,$subfleet,$alphatag,$mode,$desc,$tag,$category) = split(','); | |
my $hextg = sprintf("%X", $decimaltg); | |
my $priority = "50"; | |
if ($mode eq "E") { $priority = "-1" } # set encrypted channels to "Do Not Monitor" | |
# edit this to set certain categories to "Do Not Monitor" | |
if ($tag =~ /Sanitation|Public Works/) { $priority = "-1" } | |
print "<alias color=\"-16777216\" iconName=\"No Icon\" name=\"$alphatag: $desc - $tag - $category\">\n"; | |
print "<id xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"talkgroupID\" talkgroup=\"$hextg\"/>\n"; | |
print " <id xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"priority\" priority=\"$priority\"/>\n"; | |
print "</alias>\n"; | |
} |
Updated to set encrypted talk groups (mode = E) to priority -1
If you are generating your own CSV to use with this script make sure that the values do not contain quotes or SDRTrunk won't parse the playlist file correctly.
Very nice! Saved me a ton of time! Thanks for writing this!
This script works awesome! Thanks for taking the time to write this and share it!
I needed to change the sprintf
to
my $hextg = sprintf("%0.4X", $decimaltg);
for sdrtrunk to match any talkgroup with less than 4 characters.
Where do I put the output for this? I have it in my playlist_v2.xml file and the alias's show up in the tab but the now playing tab only shows talkgroup id's
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download CSV from radioreference.com:
Run it through this perl:
and then insert into the appropriate section of sdrtrunk playlist.xml