mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -05:00
Merge pull request #1708 from tadscottsmith/rdio-scanner-filename
Explicitly send filename to Rdio-Scanner.
This commit is contained in:
@@ -232,6 +232,9 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
String talkgroupLabel = getTalkgroupLabel(audioRecording);
|
String talkgroupLabel = getTalkgroupLabel(audioRecording);
|
||||||
String talkgroupGroup = getTalkgroupGroup(audioRecording);
|
String talkgroupGroup = getTalkgroupGroup(audioRecording);
|
||||||
String systemLabel = getSystemLabel(audioRecording);
|
String systemLabel = getSystemLabel(audioRecording);
|
||||||
|
String path = audioRecording.getPath().toString();
|
||||||
|
// Remove TEMPORARY_STREAM_FILE_SUFFIX
|
||||||
|
String audioName = path.substring(path.substring(0, path.lastIndexOf("_")).lastIndexOf("_") + 1);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -252,6 +255,7 @@ public class RdioScannerBroadcaster extends AbstractAudioBroadcaster<RdioScanner
|
|||||||
RdioScannerBuilder bodyBuilder = new RdioScannerBuilder();
|
RdioScannerBuilder bodyBuilder = new RdioScannerBuilder();
|
||||||
bodyBuilder.addPart(FormField.KEY, getBroadcastConfiguration().getApiKey())
|
bodyBuilder.addPart(FormField.KEY, getBroadcastConfiguration().getApiKey())
|
||||||
.addPart(FormField.SYSTEM, getBroadcastConfiguration().getSystemID())
|
.addPart(FormField.SYSTEM, getBroadcastConfiguration().getSystemID())
|
||||||
|
.addAudioName(audioName)
|
||||||
.addFile(audioBytes)
|
.addFile(audioBytes)
|
||||||
.addPart(FormField.DATE_TIME, timestampSeconds)
|
.addPart(FormField.DATE_TIME, timestampSeconds)
|
||||||
.addPart(FormField.TALKGROUP_ID, talkgroup)
|
.addPart(FormField.TALKGROUP_ID, talkgroup)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public class RdioScannerBuilder
|
|||||||
private static final String BOUNDARY = "--sdrtrunk-sdrtrunk-sdrtrunk";
|
private static final String BOUNDARY = "--sdrtrunk-sdrtrunk-sdrtrunk";
|
||||||
private List<Part> mParts = new ArrayList<>();
|
private List<Part> mParts = new ArrayList<>();
|
||||||
private byte[] audioBytes = null;
|
private byte[] audioBytes = null;
|
||||||
|
private String audioName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an instance
|
* Constructs an instance
|
||||||
@@ -51,6 +52,15 @@ public class RdioScannerBuilder
|
|||||||
return BOUNDARY;
|
return BOUNDARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a Audio file name part to the call
|
||||||
|
*/
|
||||||
|
public RdioScannerBuilder addAudioName(String value)
|
||||||
|
{
|
||||||
|
audioName = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Audio bytes part to the call
|
* Adds a Audio bytes part to the call
|
||||||
*/
|
*/
|
||||||
@@ -110,7 +120,8 @@ public class RdioScannerBuilder
|
|||||||
}
|
}
|
||||||
StringBuilder sb= new StringBuilder();
|
StringBuilder sb= new StringBuilder();
|
||||||
sb.append(DASH_DASH).append(boundary).append("\r\n");
|
sb.append(DASH_DASH).append(boundary).append("\r\n");
|
||||||
sb.append("Content-Disposition: form-data; name=\"").append("audio").append("\"\r\n\r\n");
|
sb.append("Content-Disposition: form-data; filename =\"").append(audioName);
|
||||||
|
sb.append("\"; name=\"").append("audio").append("\"\r\n\r\n");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user