mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
package io.github.dsheirer.audio.playback;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
@@ -49,6 +50,7 @@ import javax.swing.JPanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Font;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AudioChannelPanel extends JPanel implements Listener<AudioEvent>, SettingChangeListener
|
||||
@@ -80,7 +82,7 @@ public class AudioChannelPanel extends JPanel implements Listener<AudioEvent>, S
|
||||
private JLabel mIconLabel = new JLabel(" ");
|
||||
private JLabel mIdentifierLabel = new JLabel("-----");
|
||||
private Identifier mIdentifier;
|
||||
private Alias mAlias;
|
||||
private List<Alias> mAliases = Collections.EMPTY_LIST;
|
||||
|
||||
private boolean mConfigured = false;
|
||||
private AliasModel mAliasModel;
|
||||
@@ -195,7 +197,7 @@ public class AudioChannelPanel extends JPanel implements Listener<AudioEvent>, S
|
||||
private void resetLabels()
|
||||
{
|
||||
mIdentifier = null;
|
||||
mAlias = null;
|
||||
mAliases = Collections.EMPTY_LIST;
|
||||
updateLabels();
|
||||
mConfigured = false;
|
||||
}
|
||||
@@ -223,9 +225,26 @@ public class AudioChannelPanel extends JPanel implements Listener<AudioEvent>, S
|
||||
*/
|
||||
private void updateLabels()
|
||||
{
|
||||
String identifier = mAlias != null ? mAlias.getName() : mTalkgroupFormatPreference.format(mIdentifier);
|
||||
final ImageIcon icon = mAlias != null ? mIconManager.getIcon(mAlias.getIconName(), 18) : null;
|
||||
final String identifierText = (identifier != null ? truncate(identifier, 33) : "-----");
|
||||
String identifier = null;
|
||||
String iconName = null;
|
||||
|
||||
if(mAliases.size() == 1)
|
||||
{
|
||||
identifier = mAliases.get(0).getName();
|
||||
iconName = mAliases.get(0).getIconName();
|
||||
}
|
||||
else if(mAliases.size() > 1)
|
||||
{
|
||||
identifier = Joiner.on(", ").skipNulls().join(mAliases);
|
||||
}
|
||||
|
||||
if(identifier == null)
|
||||
{
|
||||
identifier = "-----";
|
||||
}
|
||||
|
||||
final ImageIcon icon = iconName != null ? mIconManager.getIcon(iconName, 18) : null;
|
||||
final String identifierText = truncate(identifier, 33);
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@@ -253,7 +272,12 @@ public class AudioChannelPanel extends JPanel implements Listener<AudioEvent>, S
|
||||
List<Identifier> toIds = identifierCollection.getIdentifiers(IdentifierClass.USER, Role.TO);
|
||||
mIdentifier = !toIds.isEmpty() ? toIds.get(0) : null;
|
||||
AliasList aliasList = mAliasModel.getAliasList(identifierCollection);
|
||||
mAlias = (aliasList != null ? aliasList.getAlias(mIdentifier) : null);
|
||||
|
||||
if(aliasList != null)
|
||||
{
|
||||
mAliases = aliasList.getAliases(mIdentifier);
|
||||
}
|
||||
|
||||
updateLabels();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user