Updates alias list to provide a list of aliases for an identifier so that (#474)

we can account for multi-alias identifiers like patch groups and ensure
that patch group alias intentions are carried throughout the system for
recording, streaming, etc.

Updates all consumers of alias list data to ensure it can operate with
a list of aliases versus an assumed single alias.

Refactors APCO25 unit/user status identifiers from a base status class
so that alias list can support status identifiers.
This commit is contained in:
Denny Sheirer
2018-12-31 07:24:25 -05:00
committed by GitHub
parent 08ea5ab7cb
commit 3a39ae76ba
23 changed files with 484 additions and 189 deletions

View File

@@ -1,6 +1,7 @@
/*******************************************************************************
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* Copyright (C) 2014-2018 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,10 +15,11 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
* *****************************************************************************
*/
package io.github.dsheirer.audio.broadcast.icecast;
import com.google.common.base.Joiner;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.alias.AliasModel;
@@ -47,6 +49,7 @@ import java.net.InetSocketAddress;
import java.net.URLEncoder;
import java.nio.channels.UnresolvedAddressException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.LinkedTransferQueue;
@@ -208,11 +211,11 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
{
sb.append("TO:").append(to);
Alias toAlias = aliasList != null ? aliasList.getAlias(to) : null;
List<Alias> aliases = aliasList.getAliases(to);
if(toAlias != null)
if(!aliases.isEmpty())
{
sb.append(" ").append(toAlias.getName());
sb.append(" ").append(Joiner.on(", ").skipNulls().join(aliases));
}
}
else
@@ -226,11 +229,11 @@ public class IcecastBroadcastMetadataUpdater implements IBroadcastMetadataUpdate
{
sb.append(" FROM:").append(from);
Alias fromAlias = aliasList != null ? aliasList.getAlias(from) : null;
List<Alias> aliases = aliasList.getAliases(from);
if(fromAlias != null)
if(!aliases.isEmpty())
{
sb.append(" ").append(fromAlias.getName());
sb.append(" ").append(Joiner.on(", ").skipNulls().join(aliases));
}
}
else

View File

@@ -1,6 +1,7 @@
/*******************************************************************************
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* Copyright (C) 2014-2018 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,10 +15,11 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
* *****************************************************************************
*/
package io.github.dsheirer.audio.broadcast.shoutcast.v1;
import com.google.common.base.Joiner;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.alias.AliasModel;
@@ -45,6 +47,7 @@ import java.net.ConnectException;
import java.net.InetSocketAddress;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.LinkedTransferQueue;
@@ -200,15 +203,16 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
to = identifierCollection.getIdentifier(IdentifierClass.USER, Form.TALKGROUP, Role.TO);
}
Alias toAlias = aliasList != null ? aliasList.getAlias(to) : null;
if(to != null)
{
sb.append("TO:").append(to);
if(toAlias != null)
{
sb.append("TO:").append(toAlias.getName());
}
else if(to != null)
{
sb.append("TO:").append(to.toString());
List<Alias> aliases = aliasList.getAliases(to);
if(!aliases.isEmpty())
{
sb.append(" ").append(Joiner.on(", ").skipNulls().join(aliases));
}
}
else
{
@@ -217,15 +221,16 @@ public class ShoutcastV1BroadcastMetadataUpdater implements IBroadcastMetadataUp
Identifier from = identifierCollection.getIdentifier(IdentifierClass.USER, Form.TALKGROUP, Role.FROM);
Alias fromAlias = aliasList != null ? aliasList.getAlias(from) : null;
if(from != null)
{
sb.append(" FROM:").append(from);
if(fromAlias != null)
{
sb.append(" FROM:").append(fromAlias.getName());
}
else if(from != null)
{
sb.append(" FROM:").append(from.toString());
List<Alias> aliases = aliasList.getAliases(from);
if(!aliases.isEmpty())
{
sb.append(" ").append(Joiner.on(", ").skipNulls().join(aliases));
}
}
else
{

View File

@@ -1,6 +1,7 @@
/*******************************************************************************
/*
* ******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* Copyright (C) 2014-2018 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,10 +15,11 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
* *****************************************************************************
*/
package io.github.dsheirer.audio.broadcast.shoutcast.v2;
import com.google.common.base.Joiner;
import io.github.dsheirer.alias.Alias;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.alias.AliasModel;
@@ -279,32 +281,44 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster implements IBr
AliasList aliasList = mAliasModel.getAliasList(identifierCollection);
Identifier to = identifierCollection.getIdentifier(IdentifierClass.USER, Form.PATCH_GROUP, Role.TO);
if(to == null)
{
to = identifierCollection.getIdentifier(IdentifierClass.USER, Form.TALKGROUP, Role.TO);
}
Alias toAlias = aliasList != null ? aliasList.getAlias(to) : null;
if(to != null)
{
sb.append("TO:").append(to);
if(toAlias != null)
{
sb.append(UltravoxMetadata.TITLE_2.asXML(toAlias.getName()));
List<Alias> aliases = aliasList.getAliases(to);
if(!aliases.isEmpty())
{
sb.append(" ").append(Joiner.on(", ").skipNulls().join(aliases));
}
}
else if(to != null)
else
{
sb.append(UltravoxMetadata.TITLE_2.asXML(to.toString()));
sb.append("TO:UNKNOWN");
}
Identifier from = identifierCollection.getIdentifier(IdentifierClass.USER, Form.TALKGROUP, Role.FROM);
Alias fromAlias = aliasList != null ? aliasList.getAlias(from) : null;
if(fromAlias != null)
if(from != null)
{
sb.append(UltravoxMetadata.TITLE_3.asXML("From:" + fromAlias.getName()));
sb.append(" FROM:").append(from);
List<Alias> aliases = aliasList.getAliases(from);
if(!aliases.isEmpty())
{
sb.append(" ").append(Joiner.on(", ").skipNulls().join(aliases));
}
}
else if(from != null)
else
{
sb.append(UltravoxMetadata.TITLE_3.asXML("From:" + from.toString()));
sb.append(" FROM:UNKNOWN");
}
}
else