mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 09:07:27 -05:00
Add Thinline Radio completed-call upload stream type (#2626)
Same /api/call-upload flow as Rdio Scanner, with its own configuration and playlist editor. Reuses RdioScannerBroadcaster. Co-authored-by: Michael Chambers <michaelchambers@Michaels-Mac-mini.local> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
GitHub
parent
73d3238644
commit
aad971db9c
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
|||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||||
import io.github.dsheirer.audio.broadcast.broadcastify.BroadcastifyCallConfiguration;
|
import io.github.dsheirer.audio.broadcast.broadcastify.BroadcastifyCallConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerConfiguration;
|
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerConfiguration;
|
||||||
|
import io.github.dsheirer.audio.broadcast.thinline.ThinlineRadioConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.openmhz.OpenMHzConfiguration;
|
import io.github.dsheirer.audio.broadcast.openmhz.OpenMHzConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.icecast.IcecastConfiguration;
|
import io.github.dsheirer.audio.broadcast.icecast.IcecastConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.shoutcast.v1.ShoutcastV1Configuration;
|
import io.github.dsheirer.audio.broadcast.shoutcast.v1.ShoutcastV1Configuration;
|
||||||
@@ -49,6 +50,7 @@ import java.net.SocketAddress;
|
|||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = BroadcastifyCallConfiguration.class, name="broadcastifyCallConfiguration"),
|
@JsonSubTypes.Type(value = BroadcastifyCallConfiguration.class, name="broadcastifyCallConfiguration"),
|
||||||
@JsonSubTypes.Type(value = RdioScannerConfiguration.class, name="RdioScannerConfiguration"),
|
@JsonSubTypes.Type(value = RdioScannerConfiguration.class, name="RdioScannerConfiguration"),
|
||||||
|
@JsonSubTypes.Type(value = ThinlineRadioConfiguration.class, name="ThinlineRadioConfiguration"),
|
||||||
@JsonSubTypes.Type(value = OpenMHzConfiguration.class, name="OpenMHzConfiguration"),
|
@JsonSubTypes.Type(value = OpenMHzConfiguration.class, name="OpenMHzConfiguration"),
|
||||||
@JsonSubTypes.Type(value = IcecastConfiguration.class, name="icecastConfiguration"),
|
@JsonSubTypes.Type(value = IcecastConfiguration.class, name="icecastConfiguration"),
|
||||||
@JsonSubTypes.Type(value = ShoutcastV1Configuration.class, name="shoutcastV1Configuration"),
|
@JsonSubTypes.Type(value = ShoutcastV1Configuration.class, name="shoutcastV1Configuration"),
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import io.github.dsheirer.audio.broadcast.broadcastify.BroadcastifyCallConfigura
|
|||||||
import io.github.dsheirer.audio.broadcast.broadcastify.BroadcastifyFeedConfiguration;
|
import io.github.dsheirer.audio.broadcast.broadcastify.BroadcastifyFeedConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerBroadcaster;
|
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerBroadcaster;
|
||||||
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerConfiguration;
|
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerConfiguration;
|
||||||
|
import io.github.dsheirer.audio.broadcast.thinline.ThinlineRadioConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerFeedConfiguration;
|
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerFeedConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.openmhz.OpenMHzBroadcaster;
|
import io.github.dsheirer.audio.broadcast.openmhz.OpenMHzBroadcaster;
|
||||||
import io.github.dsheirer.audio.broadcast.openmhz.OpenMHzConfiguration;
|
import io.github.dsheirer.audio.broadcast.openmhz.OpenMHzConfiguration;
|
||||||
@@ -68,6 +69,7 @@ public class BroadcastFactory
|
|||||||
return new BroadcastifyCallBroadcaster((BroadcastifyCallConfiguration)configuration,
|
return new BroadcastifyCallBroadcaster((BroadcastifyCallConfiguration)configuration,
|
||||||
inputAudioFormat, mp3Setting, aliasModel);
|
inputAudioFormat, mp3Setting, aliasModel);
|
||||||
case RDIOSCANNER_CALL:
|
case RDIOSCANNER_CALL:
|
||||||
|
case THINLINE_RADIO:
|
||||||
return new RdioScannerBroadcaster((RdioScannerConfiguration)configuration,
|
return new RdioScannerBroadcaster((RdioScannerConfiguration)configuration,
|
||||||
inputAudioFormat, mp3Setting, aliasModel);
|
inputAudioFormat, mp3Setting, aliasModel);
|
||||||
case OPENMHZ:
|
case OPENMHZ:
|
||||||
@@ -113,6 +115,8 @@ public class BroadcastFactory
|
|||||||
return new BroadcastifyCallConfiguration(format);
|
return new BroadcastifyCallConfiguration(format);
|
||||||
case RDIOSCANNER_CALL:
|
case RDIOSCANNER_CALL:
|
||||||
return new RdioScannerConfiguration(format);
|
return new RdioScannerConfiguration(format);
|
||||||
|
case THINLINE_RADIO:
|
||||||
|
return new ThinlineRadioConfiguration(format);
|
||||||
case BROADCASTIFY:
|
case BROADCASTIFY:
|
||||||
return new BroadcastifyFeedConfiguration(format);
|
return new BroadcastifyFeedConfiguration(format);
|
||||||
case OPENMHZ:
|
case OPENMHZ:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public enum BroadcastServerType
|
|||||||
|
|
||||||
ICECAST_HTTP("Icecast 2 (v2.4+)", "images/icecast.png"),
|
ICECAST_HTTP("Icecast 2 (v2.4+)", "images/icecast.png"),
|
||||||
RDIOSCANNER_CALL("Rdio Scanner", "images/rdioscanner.png"),
|
RDIOSCANNER_CALL("Rdio Scanner", "images/rdioscanner.png"),
|
||||||
|
THINLINE_RADIO("Thinline Radio", "images/rdioscanner.png"),
|
||||||
OPENMHZ("OpenMHz", "images/openmhz.png"),
|
OPENMHZ("OpenMHz", "images/openmhz.png"),
|
||||||
ICECAST_TCP("Icecast (v2.3)", "images/icecast.png"),
|
ICECAST_TCP("Icecast (v2.3)", "images/icecast.png"),
|
||||||
SHOUTCAST_V1("Shoutcast v1.x", "images/shoutcast.png"),
|
SHOUTCAST_V1("Shoutcast v1.x", "images/shoutcast.png"),
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.error("Error connecting to Rdio Scanner server on startup [" + response + "]");
|
mLog.error("Error connecting to " + getBroadcastConfiguration().getServiceName() +
|
||||||
|
" server on startup [" + response + "]");
|
||||||
setBroadcastState(BroadcastState.ERROR);
|
setBroadcastState(BroadcastState.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +250,8 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
}
|
}
|
||||||
catch(IOException e)
|
catch(IOException e)
|
||||||
{
|
{
|
||||||
mLog.error("Rdio Scanner API - audio recording file not found - ignoring upload");
|
mLog.error(getBroadcastConfiguration().getServiceName() +
|
||||||
|
" API - audio recording file not found - ignoring upload");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(audioBytes != null)
|
if(audioBytes != null)
|
||||||
@@ -286,14 +288,14 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
//We get socket reset exceptions occasionally when the remote server doesn't
|
//We get socket reset exceptions occasionally when the remote server doesn't
|
||||||
//fully read our request and immediately responds.
|
//fully read our request and immediately responds.
|
||||||
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
||||||
mLog.error("Rdio Scanner API file upload fail [" +
|
mLog.error(getBroadcastConfiguration().getServiceName() + " API file upload fail [" +
|
||||||
fileResponse.statusCode() + "] response [" +
|
fileResponse.statusCode() + "] response [" +
|
||||||
fileResponse.body() + "]");
|
fileResponse.body() + "]");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
||||||
mLog.error("Rdio Scanner API file upload fail [" +
|
mLog.error(getBroadcastConfiguration().getServiceName() + " API file upload fail [" +
|
||||||
fileResponse.statusCode() + "] response [" +
|
fileResponse.statusCode() + "] response [" +
|
||||||
fileResponse.body() + "]");
|
fileResponse.body() + "]");
|
||||||
}
|
}
|
||||||
@@ -321,7 +323,7 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
||||||
mLog.error("Rdio Scanner API file upload fail [" +
|
mLog.error(getBroadcastConfiguration().getServiceName() + " API file upload fail [" +
|
||||||
fileResponse.statusCode() + "] response [" +
|
fileResponse.statusCode() + "] response [" +
|
||||||
fileResponse.body() + "]");
|
fileResponse.body() + "]");
|
||||||
}
|
}
|
||||||
@@ -334,7 +336,7 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Register an error for the file not found exception
|
//Register an error for the file not found exception
|
||||||
mLog.error("Rdio Scanner API - upload file not found [" +
|
mLog.error(getBroadcastConfiguration().getServiceName() + " API - upload file not found [" +
|
||||||
audioRecording.getPath().toString() + "]");
|
audioRecording.getPath().toString() + "]");
|
||||||
incrementErrorAudioCount();
|
incrementErrorAudioCount();
|
||||||
broadcast(new BroadcastEvent(RdioScannerBroadcaster.this,
|
broadcast(new BroadcastEvent(RdioScannerBroadcaster.this,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package io.github.dsheirer.audio.broadcast.rdioscanner;
|
package io.github.dsheirer.audio.broadcast.rdioscanner;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
import io.github.dsheirer.audio.broadcast.BroadcastConfiguration;
|
import io.github.dsheirer.audio.broadcast.BroadcastConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.BroadcastFormat;
|
import io.github.dsheirer.audio.broadcast.BroadcastFormat;
|
||||||
@@ -125,6 +126,15 @@ public class RdioScannerConfiguration extends BroadcastConfiguration
|
|||||||
return BroadcastServerType.RDIOSCANNER_CALL;
|
return BroadcastServerType.RDIOSCANNER_CALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product name written to connection and upload logs.
|
||||||
|
*/
|
||||||
|
@JsonIgnore
|
||||||
|
public String getServiceName()
|
||||||
|
{
|
||||||
|
return "Rdio Scanner";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BroadcastConfiguration copyOf()
|
public BroadcastConfiguration copyOf()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* *****************************************************************************
|
||||||
|
* Copyright (C) 2014-2026 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* 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.thinline;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||||
|
import io.github.dsheirer.audio.broadcast.BroadcastConfiguration;
|
||||||
|
import io.github.dsheirer.audio.broadcast.BroadcastFormat;
|
||||||
|
import io.github.dsheirer.audio.broadcast.BroadcastServerType;
|
||||||
|
import io.github.dsheirer.audio.broadcast.rdioscanner.RdioScannerConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call upload configuration for Thinline Radio.
|
||||||
|
*
|
||||||
|
* Thinline Radio accepts the same completed-call upload used by Rdio Scanner, including the system id, API key,
|
||||||
|
* and /api/call-upload path.
|
||||||
|
*/
|
||||||
|
public class ThinlineRadioConfiguration extends RdioScannerConfiguration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor for Jackson
|
||||||
|
*/
|
||||||
|
public ThinlineRadioConfiguration()
|
||||||
|
{
|
||||||
|
this(BroadcastFormat.MP3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public constructor.
|
||||||
|
* @param format to use for audio recording (MP3)
|
||||||
|
*/
|
||||||
|
public ThinlineRadioConfiguration(BroadcastFormat format)
|
||||||
|
{
|
||||||
|
super(format);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JacksonXmlProperty(isAttribute = true, localName = "type", namespace = "http://www.w3.org/2001/XMLSchema-instance")
|
||||||
|
@Override
|
||||||
|
public BroadcastServerType getBroadcastServerType()
|
||||||
|
{
|
||||||
|
return BroadcastServerType.THINLINE_RADIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Override
|
||||||
|
public String getServiceName()
|
||||||
|
{
|
||||||
|
return "Thinline Radio";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BroadcastConfiguration copyOf()
|
||||||
|
{
|
||||||
|
ThinlineRadioConfiguration copy = new ThinlineRadioConfiguration();
|
||||||
|
copy.setSystemID(getSystemID());
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,6 +119,22 @@ public class RdioScannerEditor extends AbstractBroadcastEditor<RdioScannerConfig
|
|||||||
return BroadcastServerType.RDIOSCANNER_CALL;
|
return BroadcastServerType.RDIOSCANNER_CALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label for the server URL field. Subclasses can override this for another product that uses the same API.
|
||||||
|
*/
|
||||||
|
protected String getHostLabel()
|
||||||
|
{
|
||||||
|
return "RdioScanner URL";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label for the credential field.
|
||||||
|
*/
|
||||||
|
protected String getApiKeyLabel()
|
||||||
|
{
|
||||||
|
return "API Key";
|
||||||
|
}
|
||||||
|
|
||||||
protected GridPane getEditorPane()
|
protected GridPane getEditorPane()
|
||||||
{
|
{
|
||||||
if(mEditorPane == null)
|
if(mEditorPane == null)
|
||||||
@@ -157,7 +173,7 @@ public class RdioScannerEditor extends AbstractBroadcastEditor<RdioScannerConfig
|
|||||||
GridPane.setConstraints(getNameTextField(), 1, row);
|
GridPane.setConstraints(getNameTextField(), 1, row);
|
||||||
mEditorPane.getChildren().add(getNameTextField());
|
mEditorPane.getChildren().add(getNameTextField());
|
||||||
|
|
||||||
Label apiKeyLabel = new Label("API Key");
|
Label apiKeyLabel = new Label(getApiKeyLabel());
|
||||||
apiKeyLabel.setLabelFor(getApiKeyTextField());
|
apiKeyLabel.setLabelFor(getApiKeyTextField());
|
||||||
GridPane.setHalignment(apiKeyLabel, HPos.RIGHT);
|
GridPane.setHalignment(apiKeyLabel, HPos.RIGHT);
|
||||||
GridPane.setConstraints(apiKeyLabel, 0, ++row);
|
GridPane.setConstraints(apiKeyLabel, 0, ++row);
|
||||||
@@ -175,7 +191,7 @@ public class RdioScannerEditor extends AbstractBroadcastEditor<RdioScannerConfig
|
|||||||
GridPane.setConstraints(getSystemIdTextField(), 1, row);
|
GridPane.setConstraints(getSystemIdTextField(), 1, row);
|
||||||
mEditorPane.getChildren().add(getSystemIdTextField());
|
mEditorPane.getChildren().add(getSystemIdTextField());
|
||||||
|
|
||||||
Label hostLabel = new Label("RdioScanner URL");
|
Label hostLabel = new Label(getHostLabel());
|
||||||
hostLabel.setLabelFor(getHostTextField());
|
hostLabel.setLabelFor(getHostTextField());
|
||||||
GridPane.setHalignment(hostLabel, HPos.RIGHT);
|
GridPane.setHalignment(hostLabel, HPos.RIGHT);
|
||||||
GridPane.setConstraints(hostLabel, 0, ++row);
|
GridPane.setConstraints(hostLabel, 0, ++row);
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public class StreamEditorFactory
|
|||||||
return new BroadcastifyStreamEditor(playlistManager);
|
return new BroadcastifyStreamEditor(playlistManager);
|
||||||
case RDIOSCANNER_CALL:
|
case RDIOSCANNER_CALL:
|
||||||
return new RdioScannerEditor(playlistManager);
|
return new RdioScannerEditor(playlistManager);
|
||||||
|
case THINLINE_RADIO:
|
||||||
|
return new ThinlineRadioEditor(playlistManager);
|
||||||
case OPENMHZ:
|
case OPENMHZ:
|
||||||
return new OpenMHzEditor(playlistManager);
|
return new OpenMHzEditor(playlistManager);
|
||||||
case BROADCASTIFY_CALL:
|
case BROADCASTIFY_CALL:
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* *****************************************************************************
|
||||||
|
* Copyright (C) 2014-2026 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* 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.gui.playlist.streaming;
|
||||||
|
|
||||||
|
import io.github.dsheirer.audio.broadcast.BroadcastServerType;
|
||||||
|
import io.github.dsheirer.playlist.PlaylistManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thinline Radio call upload configuration editor.
|
||||||
|
*
|
||||||
|
* The form and upload path match the Rdio Scanner editor.
|
||||||
|
*/
|
||||||
|
public class ThinlineRadioEditor extends RdioScannerEditor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructs an instance
|
||||||
|
* @param playlistManager for accessing the broadcast model
|
||||||
|
*/
|
||||||
|
public ThinlineRadioEditor(PlaylistManager playlistManager)
|
||||||
|
{
|
||||||
|
super(playlistManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BroadcastServerType getBroadcastServerType()
|
||||||
|
{
|
||||||
|
return BroadcastServerType.THINLINE_RADIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getHostLabel()
|
||||||
|
{
|
||||||
|
return "Thinline Radio URL";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user