mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
467 Alias List Update On Alias Delete/Change (#470)
* Updates playlist to fully clean aliases from the alias list when deleted and to perform a delete and re-add on any alias that changes, to ensure that the alias list is kept fully up to date. Removed site id as an alias identifier. Add support for converting ltr-net uid's to talkgroups in playlist updater and updated playlist to version 3 to ensure anyone using current codebase will have their playlists fully updated. Moved MIN, UniqueID and Site ID to the legacy package and updated label descriptions to signify that they are no longer supported.
This commit is contained in:
@@ -51,7 +51,7 @@ public class PlaylistManager implements Listener<ChannelEvent>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(PlaylistManager.class);
|
||||
|
||||
public static final int PLAYLIST_CURRENT_VERSION = 2;
|
||||
public static final int PLAYLIST_CURRENT_VERSION = 3;
|
||||
|
||||
private AliasModel mAliasModel;
|
||||
private BroadcastModel mBroadcastModel;
|
||||
|
||||
@@ -27,8 +27,9 @@ import io.github.dsheirer.alias.id.legacy.fleetsync.FleetsyncID;
|
||||
import io.github.dsheirer.alias.id.legacy.mdc.MDC1200ID;
|
||||
import io.github.dsheirer.alias.id.legacy.mpt1327.MPT1327ID;
|
||||
import io.github.dsheirer.alias.id.legacy.talkgroup.LegacyTalkgroupID;
|
||||
import io.github.dsheirer.alias.id.mobileID.Min;
|
||||
import io.github.dsheirer.alias.id.legacy.mobileID.Min;
|
||||
import io.github.dsheirer.alias.id.talkgroup.Talkgroup;
|
||||
import io.github.dsheirer.alias.id.legacy.uniqueID.UniqueID;
|
||||
import io.github.dsheirer.controller.channel.Channel;
|
||||
import io.github.dsheirer.module.log.EventLogType;
|
||||
import io.github.dsheirer.module.log.config.EventLogConfiguration;
|
||||
@@ -77,10 +78,12 @@ public class PlaylistUpdater
|
||||
switch(playlist.getVersion())
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
mLog.info("Updating playlist from version [1] to version [" + PlaylistManager.PLAYLIST_CURRENT_VERSION + "]");
|
||||
removeVersion1AudioRecordType(playlist);
|
||||
removeVersion1BinaryMessageLogger(playlist);
|
||||
removeVersion1NonRecordableAliasIdentifiers(playlist);
|
||||
removeVersion1SiteIdentifiers(playlist);
|
||||
updateVersion1Talkgroups(playlist);
|
||||
updated = true;
|
||||
break;
|
||||
@@ -184,7 +187,34 @@ public class PlaylistUpdater
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts legacy version 1talkgroups to the new talkgroup format. Previously, each protocol had a talkgroup
|
||||
* Removes site identifiers from all aliases. These are no longer supported
|
||||
*/
|
||||
private static void removeVersion1SiteIdentifiers(PlaylistV2 playlist)
|
||||
{
|
||||
int removed = 0;
|
||||
|
||||
for(Alias alias : playlist.getAliases())
|
||||
{
|
||||
Iterator<AliasID> it = alias.getId().iterator();
|
||||
|
||||
while(it.hasNext())
|
||||
{
|
||||
if(it.next().getType() == AliasIDType.SITE)
|
||||
{
|
||||
it.remove();
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(removed > 0)
|
||||
{
|
||||
mLog.info("Removed [" + removed + "] site identifiers from aliases");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts legacy version 1 talkgroups to the new talkgroup format. Previously, each protocol had a talkgroup
|
||||
* flavor and now there is a generic talkgroup identifier with a protocol specifier.
|
||||
*
|
||||
* @param playlist to update
|
||||
@@ -426,6 +456,12 @@ public class PlaylistUpdater
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LTR_NET_UID:
|
||||
int uid = ((UniqueID)next).getUid();
|
||||
toAdd.add(new Talkgroup(Protocol.LTR_NET, uid));
|
||||
it.remove();
|
||||
updated++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user