Open charraeus opened 5 years ago
Hi,
I confirm this bug with an other podcast:
Can’t retrieve current song. Reason: TypeError: Cannot read property 'album' of null at Class.sendRetrievedNotification (/home/pi/MagicMirror/modules/MMM-NowPlayingOnSpotify/node_helper.js:49:46) at connector.retrieveCurrentlyPlaying.then (/home/pi/MagicMirror/modules/MMM-NowPlayingOnSpotify/node_helper.js:32:16) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)
Does this bug is on the roadmap? :)
Thanks for your job guys!
Cheers, Guillaume
You can make a few changes to fix this.
core/SpotifyConnector.js
in a text editor and edit the apiEndpoint
to include additional types:const apiEndpoint = 'https://api.spotify.com/v1/me/player?additional_types=track,episode';
node-helper.js
you need to deal with the fact that podcasts are organized by show
and songs by album
. Here are the new lines:if (!songInfo.noSong) {
// Add the line below
if (!songInfo.item.album) songInfo.item.album = songInfo.item.show
payload = {
imgURL: this.getImgURL(songInfo.item.album.images),
songTitle: songInfo.item.name,
artist: this.getArtistName(songInfo.item.artists || []), // AND ADD THIS
album: songInfo.item.album.name,
titleLength: songInfo.item.duration_ms,
progress: songInfo.progress_ms,
isPlaying: songInfo.isPlaying,
deviceName: songInfo.device.name
};
}
Love the code and the documentation. Y'all are the best. However, this change was implemented as documented, but no change. still stuck at "loading" in the gui.
Love the code and the documentation. Y'all are the best. However, this change was implemented as documented, but no change. still stuck at "loading" in the gui.
For me it worked :-) Thank you @joehand for the code. Perhaps it should be implemented into the master branch.
When playing a podcast the following error messages occur and the display is not updated:
Tested with the following Podcast: "Lage der Nation" - LdN116 Kohleausstieg, Diesel-Nachrüstung, INF-Kündigung, US-Wahlkampf, Bischofssynode in Rom
When playing a "normal" album everything works.
Best regards, Christian