Rdio Scanner is an open source software that ingest and distribute audio files generated by various software-defined radio recorders. Its interface tries to reproduce the user experience of a real police scanner, while adding its own touch.
Would it be possible to use some code like attached to directly add 3rd party broadcastify feeds to your scanner so you
can listen to all your feeds in one place?
const https = require('https');
const fs = require('fs');
const { PassThrough } = require('stream');
const Broadcastify = require('broadcastify');
// Replace these with your own values
const broadcastifyApiKey = 'your_broadcastify_api_key';
const apiEndpointUrl = 'https://your.api.endpoint';
const apiToken = 'your_api_token';
// Create a new Broadcastify client
const broadcastify = new Broadcastify();
// Start listening to the feed
const feed = broadcastify.listen('feed_id', {
apikey: broadcastifyApiKey,
});
// Create a new PassThrough stream to store the audio data
const audioStream = new PassThrough();
// When the feed starts, pipe the audio data to the PassThrough stream
feed.on('start', () => {
console.log('Feed started');
feed.pipe(audioStream);
});
// When the feed stops, end the PassThrough stream and log a message
feed.on('stop', () => {
console.log('Feed stopped');
audioStream.end();
});
// When the PassThrough stream ends, upload the audio data to the API
audioStream.on('end', () => {
console.log('Audio stream ended');
// Create a new HTTPS request to the API endpoint
const options = {
method: 'POST',
headers: {
Authorization: `Bearer ${apiToken}`,
'Content-Type': 'audio/wav',
},
body: audioStream,
};
const req = https.request(apiEndpointUrl, options, (res) => {
console.log(`API response: ${res.statusCode}`);
});
// Handle errors with the HTTPS request
req.on('error', (error) => {
console.error(`API request error: ${error.message}`);
});
// End the request and send the audio data
req.end();
});
// Handle errors with the PassThrough stream
audioStream.on('error', (error) => {
console.error(`Audio stream error: ${error.message}`);
});
That's not the role of Rdio Scanner, it only ingest files to redistributed them. Maybe some other software could generate files which then Rdio Scanner could grab?
Would it be possible to use some code like attached to directly add 3rd party broadcastify feeds to your scanner so you can listen to all your feeds in one place?