First, to answer your second question about where to find the folder (I also posted this as a comment in my own original post):
On Windows, the folder is located as a .zip file ( resources.zip
) in the following Spotify.exe data folder. In my case it is
C: \ Users \ buchetics \ AppData \ Roaming \ Spotify \ Data \ resources.zip
On a Mac, you need to right-click Spotify.app and select Show Package Content
(or something like that), then you can navigate to the folder inside the package.
Ok, now to your original question. You can get the API objects as follows:
window.Models = sp.require("sp://import/scripts/api/models"); window.Views = sp.require("sp://import/scripts/api/views");
Then you can use all the methods and properties as described in the API link (which is still not very good). For instance:
window.CurrentPlaylist = new Models.Playlist(); var track = Models.Track.fromURI("spotify:track:4n6AGL10M8fbm8oHxhK16j"); CurrentPlaylist.add(track);
And so on. The model API is pretty easy to use, and the Views object can be used to display a list of tracks similar to regular Spotify lists. For other API calls, such as getting the current playback track, you need to use the base API, which will returend on var sp = getSpotifyApi(1);
. However, there is no documentation for this yet, and itβs best to review the code found in cef_views
, or use the Inspector in available applications to find useful code snippets (not all applications display their code in such a way that itβs easy to look at it, but some of which, for example, the application "We hunted" or "Sonki").
source share