Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


What's playing Spotify Connect on display?
#11
(02-23-2024, 06:43 PM)jmguillaume Wrote: The script to retrieve the data is 12 lines :-) Spotipy is doing all the job.

That is what I meant... how big and/or heavi is Spotipy


My approach is also about 3 seconds, goes to open.spotify.com as if it were a browser (requests a total of 3 pages)

track (https://open.spotify.com/track/<track_id>) -- extracts track title, index, duration, album_id, artist_id
album (https://open.spotify.com/album/<album_id>) -- extracts album title, coverart url
artist (https://open.spotify.com/artist/<artist_id>) -- extracts artist name

but does not require any account, as it just filters the header block of the html and extracts the information from its <meta> tags.

Find the attached script, it needs to be invoked with the track_id as parameter. You can also compare times.


Attached Files
.zip   getSpotifyNowPlayingInfo.sh.zip (Size: 1,012 bytes / Downloads: 3)
Reply
#12
I forgot, but did I post somewhere about how to get backend data to front end?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#13
(02-23-2024, 09:42 PM)Tim Curtis Wrote: I forgot, but did I post somewhere about how to get backend data to front end?

Hi Tim,

well, you told us that there are methods for doing so, but the details you never shared, so far ;-)
Reply
#14
Start with this thread to see how a renderer overlay gets displayed and then it could be a similar process for getting any external back-end data to the front-end. https://moodeaudio.org/forum/showthread....2#pid52232

A basic flow could be


Code:
- Spotevent.sh writes track id to some location
- Back-end php daemon
  - detects new track id
  - fetches metadata
  - command + metadata to front-end via sendEngCmd()
- Front-end playerlib.js function engineCmd() receives data and displays it

One challenge is how to handle front-end page refresh
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#15
(02-23-2024, 10:19 PM)Tim Curtis Wrote: Start with this thread to see how a renderer overlay gets displayed and then it could be a similar process for getting any external back-end data to the front-end. https://moodeaudio.org/forum/showthread....2#pid52232

A basic flow could be


Code:
- Spotevent.sh writes track id to some location
- Back-end php daemon
  - detects new track id
  - fetches metadata
  - command + metadata to front-end via sendEngCmd()
- Front-end playerlib.js function engineCmd() receives data and displays it

One challenge is how to handle front-end page refresh

Excellent.
Yes, you mentioned it already... need to think. For sure the UI needs to be aware that we are playing Spotify...
Reply


Forum Jump: