Skip to content

Instantly share code, notes, and snippets.

@imagesafari
Last active June 9, 2018 00:37
Show Gist options
  • Save imagesafari/e41160e182631271bf16942b520924dc to your computer and use it in GitHub Desktop.
Save imagesafari/e41160e182631271bf16942b520924dc to your computer and use it in GitHub Desktop.
Generate sdrtrunk aliases from RR talkgroup csv
#!/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";
}
@ImDroided
Copy link

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