5 ms·
While I'm appalled by some of the recent changes Spotify has made, I'm really impressed by how easy it is to work on their desktop client. I can't even imagine
by GeorgeHahn 11y ago
While I'm appalled by some of the recent changes Spotify has made, I'm really impressed by how easy it is to work on their desktop client. I can't even imagine how nice things must be when you have the real source, automatic live-reload, and don't have to muck around with concatenated or minified JS/css/handlebars files. This setup can't be good for memory usage, but it rocks for development!
For anyone who's curious, it's easy to take a look under the hood from the Spotify installation folder. (Windows users can find it at %APPDATA%/Spotify/)
The Apps directory is full of *.spa files. These are zip files; if you extract them to folders with the same names and delete the zips, the application will still work, but you'll be able to edit the code.
The zlink directory is the most useful. This holds the main UI and much of the logic that powers it. Search through main.js in this directory for the Session.prototype.isDeveloper declaration. If you force it to return true, the Spotify UI will refresh when you press F5 inside it. Now you don't have to close and reopen every time you make a change! This will also add some miscellaneous UI embellishments (they aren't terribly useful and can be disabled by hardwiring logic elsewhere in main.js).
Initially, I thought the about directory would be a handy sandbox to mess around in, but then I realized that you can easily add new apps! Integrating them into the UI takes a bit of effort, but you can easily get to them by putting the app URI into the search bar (spotify:app:___). (Each app's URI is defined within the its js file. Make sure you give it a unique name in its manifest, too.)
Additionally, you can open cef.pak and devtools_resources.pak with a text editor and mess around (though they're not terribly useful).
NB: If you're really motivated, it shouldn't be too hard to set up a complete development environment for this. I was able to quickly dump most of the concatenated files to zips - all I needed to do to finish was to cut off some of the module wrapper code and reformat directory paths. I quit when I accomplished my goals of shuffling the UI around, but if you're interested, I have a simple concatenated files dumper at https://gist.github.com/GeorgeHahn/0deef2fb0d392ef507dd https://gist.github.com/GeorgeHahn/0deef2fb0d392ef507dd.
It takes a bit of mucking around, but it's not too hard to achieve a legacy-UI feel (volume on the left, no lyrics button, de-uglified media control buttons, compact playlist/track lists, etc). Of course, this will get ruined the next time Spotify updates, so you should block updates and make backups if you want to keep your changes.
- touristtam 11y agoMaybe that could offer the basis for an alternative client. Thanks for sharing your knowledge. :)
- mwcampbell 11y agoAn alternative desktop client using libspotify and a non-web GUI toolkit would be much more interesting.
- GeorgeHahn 11y agoVery true. There are a few options in that space: Clementine (https://www.clementine-player.org/ https://www.clementine-player.org/), Tomahawk (https://www.tomahawk-player.org/ https://www.tomahawk-player.org/), Mopidy (https://www.mopidy.com/ https://www.mopidy.com/), Fidelify (http://fidelify.net/ http://fidelify.net/, not OSS), Soundbounce (http://soundbounce.org/ http://soundbounce.org/). (Raise a glass to SOVND, my personal project that I killed when I got fed up with libspotify.)
- touristtam 11y agoTried the first two: they are pretty poor music player as it is in my opinion. The rest seems to be much more that a Spotify client.
- frik 11y agoA plugin for WinAmp or Foobar would be great.