class Anyplayer::SpotifyMac

Public Instance Methods

album() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 44
def album
  spotify "return album of current track"
end
artist() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 40
def artist
  spotify "return artist of current track"
end
launched?() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 53
def launched?
  %x(osascript -e 'app "Spotify" is running').rstrip == "true"
end
name() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 57
def name
  "Spotify Mac"
end
next() click to toggle source
Calls superclass method Anyplayer::Player#next
# File lib/anyplayer/players/spotify_mac.rb, line 19
def next
  spotify "next track"
  super
end
pause() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 6
def pause
  spotify "pause"
end
platforms() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 61
def platforms
  [:mac]
end
play() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 2
def play
  spotify "play"
end
playing?() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 48
def playing?
  playing = spotify "return player state is playing"
  playing == "true"
end
playpause() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 10
def playpause
  spotify "playpause"
end
prev() click to toggle source
Calls superclass method Anyplayer::Player#prev
# File lib/anyplayer/players/spotify_mac.rb, line 14
def prev
  spotify "previous track"
  super
end
track() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 36
def track
  spotify "return name of current track"
end
voldown() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 24
def voldown
  spotify "set sound volume to sound volume - 10"
end
volume() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 32
def volume
  spotify "return sound volume"
end
volup() click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 28
def volup
  spotify "set sound volume to sound volume + 10"
end

Private Instance Methods

spotify(command) click to toggle source
# File lib/anyplayer/players/spotify_mac.rb, line 67
def spotify(command)
  %x(osascript -e 'tell app "Spotify" to #{command}').rstrip
end