Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

macOS Solution for Spotify Sink #27

Open
williamtdr opened this issue Oct 8, 2017 · 4 comments
Open

macOS Solution for Spotify Sink #27

williamtdr opened this issue Oct 8, 2017 · 4 comments
Assignees

Comments

@williamtdr
Copy link

Hey! Wanted to get this working on my Mac, so I used the following script to generate a file that gets updated from what's playing in Spotify. This doesn't give you nearly the range of service support you get with Snip, but in my case it's all I need. Might be worth a note in the README if people are interested in getting it working on macOS.

neptune:tmp synapses$ cat nowPlaying.osascript 
#!/usr/bin/osascript
#
# now_playing.osascript
#
# Osascript to fetch the meta data of the currently playing
# track in Spotify. This works only on Mac OS X.

tell application "System Events"
  set myList to (name of every process)
end tell
if myList contains "Spotify" then
  tell application "Spotify"
    if player state is stopped then
      set output to "---"
    else
      set trackname to name of current track
      set artistname to artist of current track
      set albumname to album of current track
      if player state is playing then
        set output to trackname & " | " & artistname
      else if player state is paused then
        set output to trackname & " | " & artistname & " | " & "Paused"
      end if
    end if
  end tell
else
  set output to "---"
end if

Thanks for publishing the project! I ended up combining with this with the Spotify Connect web API and running both scripts on my VPS so it always gets updated no matter what I'm playing from (I listen on my phone a lot).

@DiNitride
Copy link
Owner

Hey! Thanks for this, it's super cool. I've not got a Mac so didn't have anything to test or fiddle with, but I'll shove this in the README, cheers :D

@DiNitride
Copy link
Owner

Actually, would you be able to edit the README and make a PR for me? Like I said I don't have a mac so I don't really know how to explain this stuff.

@williamtdr
Copy link
Author

Will do!

@DiNitride
Copy link
Owner

Cheers :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants