How to get data such as that is music playing, tilte, artist from the app (Windows/Mac). There is a option with using Web API but I tested Musixmatch app and it works even when I am offline so connecting to the app is possible somehow.
Getting data from Spotify app (Windows/Mac)
1k views Asked by Mateusz Kaflowski At
4
There are 4 answers
0
On
Spotify is exposing some API that you can use to query the state of your application
For example if you are on an Apple system you can use AppleScript API:
-- Creates a notification with information about the currently playing track
-- Main flow
set currentlyPlayingTrack to getCurrentlyPlayingTrack()
displayTrackName(currentlyPlayingTrack)
-- Method to get the currently playing track
on getCurrentlyPlayingTrack()
tell application "Spotify"
set currentArtist to artist of current track as string
set currentTrack to name of current track as string
return currentArtist & " - " & currentTrack
end tell
end getCurrentlyPlayingTrack
-- Method to create a notification
on displayTrackName(trackName)
display notification "Currently playing " & trackName
-- A delay is set added make sure the notification is shown long enough before the script ends
delay 1
end displayTrackName
This example comes from the official documentation that you can find here.
For Windows instead I would say that currently there is no clear way to do it. Once there was Libspotify SDK but it is no longer supported.
It seems that this library is going to be substitute with some new API for Windows/Mac/whatever but for now there are only beta versions for phone OS and I cannot really find anything for Windows.
So it seems that your only option is to use the old version of this library and hope that is still working properly.
1
On
See PySpotify! It looks like it has support for any operating system that supports Python (including Windows and Mac).
Spotify is caching through the: "c:\users\username\appdata\local\spotify\data" folder. There is probably something in here that can help you.