Revert "spotify: *refactoring"

This reverts commit 680bc7d841.
This commit is contained in:
2023-12-31 04:51:12 +01:00
parent 680bc7d841
commit 40dd7cbcee
5 changed files with 41 additions and 41 deletions
+9 -14
View File
@@ -21,26 +21,21 @@ export default async function handler(
) {
try {
const song = await spotify.getCurrentSong()
if (!song.is_playing) {
if (!song || !song.isPlaying) {
return res.status(200).json({
is_playing: false,
nowplaying: false,
})
}
res.status(200).json({
is_playing: true,
name: song.name,
album: {
name: song.album.name,
nowplaying: true,
song: {
artist: song.artists.name,
title: song.title,
url: song.url,
image: song.album.image,
release: song.album.release_date,
progress: song.progress,
length: song.length,
},
artists: {
name: song.artists.name,
url: song.artists.url,
},
url: song.url,
progress: song.progress,
duration: song.duration,
})
} catch (error) {
res