Class: Anyplayer::SpotifyMac

Inherits:
Player
  • Object
show all
Defined in:
lib/anyplayer/players/spotify_mac.rb

Constant Summary

Constants inherited from Player

Player::DEFAULT_VOTES_TO_SKIP

Instance Method Summary collapse

Methods inherited from Player

#initialize, #paused?, #vote, #votes

Constructor Details

This class inherits a constructor from Anyplayer::Player

Instance Method Details

#albumObject



44
45
46
# File 'lib/anyplayer/players/spotify_mac.rb', line 44

def album
  spotify "return album of current track"
end

#artistObject



40
41
42
# File 'lib/anyplayer/players/spotify_mac.rb', line 40

def artist
  spotify "return artist of current track"
end

#launched?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/anyplayer/players/spotify_mac.rb', line 53

def launched?
  %x(osascript -e 'app "Spotify" is running').rstrip == "true"
end

#nameObject



57
58
59
# File 'lib/anyplayer/players/spotify_mac.rb', line 57

def name
  "Spotify Mac"
end

#nextObject



19
20
21
22
# File 'lib/anyplayer/players/spotify_mac.rb', line 19

def next
  spotify "next track"
  super
end

#pauseObject



6
7
8
# File 'lib/anyplayer/players/spotify_mac.rb', line 6

def pause
  spotify "pause"
end

#platformsObject



61
62
63
# File 'lib/anyplayer/players/spotify_mac.rb', line 61

def platforms
  [:mac]
end

#playObject



2
3
4
# File 'lib/anyplayer/players/spotify_mac.rb', line 2

def play
  spotify "play"
end

#playing?Boolean

Returns:

  • (Boolean)


48
49
50
51
# File 'lib/anyplayer/players/spotify_mac.rb', line 48

def playing?
  playing = spotify "return player state is playing"
  playing == "true"
end

#playpauseObject



10
11
12
# File 'lib/anyplayer/players/spotify_mac.rb', line 10

def playpause
  spotify "playpause"
end

#prevObject



14
15
16
17
# File 'lib/anyplayer/players/spotify_mac.rb', line 14

def prev
  spotify "previous track"
  super
end

#trackObject



36
37
38
# File 'lib/anyplayer/players/spotify_mac.rb', line 36

def track
  spotify "return name of current track"
end

#voldownObject



24
25
26
# File 'lib/anyplayer/players/spotify_mac.rb', line 24

def voldown
  spotify "set sound volume to sound volume - 10"
end

#volumeObject



32
33
34
# File 'lib/anyplayer/players/spotify_mac.rb', line 32

def volume
  spotify "return sound volume"
end

#volupObject



28
29
30
# File 'lib/anyplayer/players/spotify_mac.rb', line 28

def volup
  spotify "set sound volume to sound volume + 10"
end