Fixed bug on undefined title/artist

This commit is contained in:
dbroqua 2020-01-24 09:09:32 +01:00
parent d2ebf282aa
commit 4020faec13

View file

@ -96,8 +96,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
request({
method: 'GET',
url: process.env.STREAM_URL
},
(error, response, body) => {
}, (error, response, body) => {
if (!error && response.statusCode === 200) {
try {
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
}
if (previousSong.title !== currentSong.title && previousSong.artist !== currentSong.artist) {
if (currentSong.title && currentSong.artist && previousSong.title !== currentSong.title && previousSong.artist !== currentSong.artist) {
checkCurrentSong()
}
} catch (e) {