Fixed bug for CosmicFuzzFM radio
This commit is contained in:
parent
af307b5888
commit
c0f6dea24a
1 changed files with 1 additions and 3 deletions
4
index.js
4
index.js
|
@ -106,8 +106,6 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
|
|||
|
||||
// Listener on new song
|
||||
stream.on('metadata', function (data) {
|
||||
console.info('RAW DATA:', data)
|
||||
// let song = data.replace(/[^A-Za-z 0-9 .,?""!@#$%^&*()-_=+;:<>/\\|}{[\]`~]*/g, '')
|
||||
const song = data.substring(13, data.length - 1).replace(/\0/g, '').replace('\';', '')
|
||||
|
||||
// Extract artist = title from song
|
||||
|
@ -130,7 +128,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
|
|||
}, (error, response, body) => {
|
||||
if (!error && response.statusCode === 200) {
|
||||
try {
|
||||
const res = JSON.parse(process.env.STREAM_PARSE ? body.replace('updateFromMediaItem(', '').replace(');', '') : body)
|
||||
const res = JSON.parse(process.env.STREAM_PARSE ? body.substr(body.indexOf('{')).replace(');', '') : body)
|
||||
|
||||
let title = null
|
||||
let artist = null
|
||||
|
|
Loading…
Reference in a new issue