diff --git a/src/App.vue b/src/App.vue index f9e01914..45fd269d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,7 +43,7 @@ export default { auth: 'https://accounts.spotify.com/authorize', token: 'https://accounts.spotify.com/api/token', base: 'https://api.spotify.com/v1', - nowPlaying: 'me/player/currently-playing' + nowPlaying: 'me/player/currently-playing?additional_types=episode' }, player: { playing: false, diff --git a/src/components/NowPlaying.vue b/src/components/NowPlaying.vue index feb925da..dcdd546c 100644 --- a/src/components/NowPlaying.vue +++ b/src/components/NowPlaying.vue @@ -223,16 +223,30 @@ export default { /** * Store the current active track. */ - this.playerData = { - playing: this.playerResponse.is_playing, - trackArtists: this.playerResponse.item.artists.map( - artist => artist.name - ), - trackTitle: this.playerResponse.item.name, - trackId: this.playerResponse.item.id, - trackAlbum: { - title: this.playerResponse.item.album.name, - image: this.playerResponse.item.album.images[0].url + + if (this.playerResponse.currently_playing_type == 'track') { + this.playerData = { + playing: this.playerResponse.is_playing, + trackArtists: this.playerResponse.item.artists.map( + artist => artist.name + ), + trackTitle: this.playerResponse.item.name, + trackId: this.playerResponse.item.id, + trackAlbum: { + title: this.playerResponse.item.album.name, + image: this.playerResponse.item.album.images[0].url + } + } + } else if (this.playerResponse.currently_playing_type == 'episode') { + this.playerData = { + playing: this.playerResponse.is_playing, + trackArtists: [this.playerResponse.item.show.name], + trackTitle: this.playerResponse.item.name, + trackId: this.playerResponse.item.id, + trackAlbum: { + title: this.playerResponse.item.show.name, + image: this.playerResponse.item.show.images[0].url + } } } },