Reputation: 413
I want to play a track by running an applescript. I'm having trouble figuring out the play track method.
I'm doing this
tell application "Spotify"
play track "One Thing" in context spotify:track:5Up9Lj7QWudEfMc0ve5qWW
end tell
that obviously doesn't work. I don't know what to do with the context part. What is a context?
Upvotes: 3
Views: 6669
Reputation: 18776
Take a look at the documentation in the AppleScript editor. Track
and context
are both URIs. A Spotify context is a container, and the client defaults to using the track's album.
So, for example, both of these will play the track in the context of its album (they're functionally the same):
tell application "Spotify"
play track "spotify:track:5Up9Lj7QWudEfMc0ve5qWW"
end tell
tell application "Spotify"
play track "spotify:track:5Up9Lj7QWudEfMc0ve5qWW" in context "spotify:album:33yaWg4n9max6UWPlD59zs"
end tell
However, you could also play a track in the context of an artist:
tell application "Spotify"
play track "spotify:track:5Up9Lj7QWudEfMc0ve5qWW" in context "spotify:artist:2AsusXITU8P25dlRNhcAbG"
end tell
Or even a playlist!
tell application "Spotify"
play track "spotify:track:3NN3bw0UMt3DbFUVGh78kV" in context "spotify:user:sweetlelle:playlist:6C7spm3ZSJSWL9EZAhiMFb"
end tell
Upvotes: 12