Fixed bug on undefined title/artist
This commit is contained in:
parent
d2ebf282aa
commit
4020faec13
1 changed files with 3 additions and 4 deletions
5
index.js
5
index.js
|
@ -96,8 +96,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
|
||||||
request({
|
request({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: process.env.STREAM_URL
|
url: process.env.STREAM_URL
|
||||||
},
|
}, (error, response, body) => {
|
||||||
(error, response, body) => {
|
|
||||||
if (!error && response.statusCode === 200) {
|
if (!error && response.statusCode === 200) {
|
||||||
try {
|
try {
|
||||||
const res = JSON.parse(process.env.STREAM_PARSE ? body.replace('updateFromMediaItem(', '').replace(');', '') : body)
|
const res = JSON.parse(process.env.STREAM_PARSE ? body.replace('updateFromMediaItem(', '').replace(');', '') : body)
|
||||||
|
@ -138,7 +137,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previousSong.title !== currentSong.title && previousSong.artist !== currentSong.artist) {
|
if (currentSong.title && currentSong.artist && previousSong.title !== currentSong.title && previousSong.artist !== currentSong.artist) {
|
||||||
checkCurrentSong()
|
checkCurrentSong()
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue