Selbi182 / SpotifyBigPicture

A Java/JavaScript-based fullscreen interface displaying your current music on Spotify in a beautiful little browser page
GNU General Public License v3.0
57 stars 6 forks source link

How to add your own api instead of spotify #38

Open megames07 opened 1 day ago

megames07 commented 1 day ago

hi. I gues this is not really a isue. But i just wanted to ask if it is possible to change the api. So that i can use my own api that gets images and data from cds i play. I really like this interface and really cant find one like it. I have been trying to run the source code but get stuck with a this site cannot be reached error after login.

Selbi182 commented 1 day ago

Hey, thanks for your interest! It's very cool that you like the interface enough to want to detach it from Spotify :)

Unfortunately, I never planned for such a case. The whole thing is super tightly coupled between front and backend, as well as the whole assumption how Spotify just works under the hood.

What API are you planning to use? I was planning to work on a v2.0 for this project some time soon to get rid of a lot of technical debt that has accumalated over the past couple years, and that includes properly decoupling the Spotify side of things.

megames07 commented 1 day ago

Hey. thanks for the reaction. i wanted to use a simple api like python flask or something so i can write there the code for receiving the metadata for cds. Im not really good at java but i was able to change the metadata already in the javascript files. But i dont know how to like send the api call for when a new song is playing. Have a great day!!

Selbi182 commented 1 day ago

The app is built around polling every two seconds, because Spotify doesn't have events when songs change (trust me, I looked it up). This is all controlled from the JavaScript side of the app (see singleRequest and pollingLoop in spotify-big-picture.js).

In theory you can take the spotify-big-picture.js and reuse it anywhere (the Java side of the project is literally only responsible for communicating with Spotify), as long as you return the valid format through the fetch request at this line: https://github.com/Selbi182/SpotifyBigPicture/blob/master/src/main/resources/static/js/spotify-big-picture.js#L161