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, #vote, #votes

Constructor Details

This class inherits a constructor from Anyplayer::Player

Instance Method Details

#album ⇒ Object



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

def album
  spotify 'return album of current track'
end

#artist ⇒ Object



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
56
# File 'lib/anyplayer/players/spotify_mac.rb', line 53

def launched?
  nb = %x(osascript -e 'tell app "System Events" to count (every process whose name is "Spotify")' 2>/dev/null).rstrip
  nb.match(/^\d+/) and nb.to_i > 0 ? true : false
end

#name ⇒ Object



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

def name
  "Spotify Mac"
end

#next ⇒ Object



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

def next
  spotify 'next track'
  super
end

#pause ⇒ Object



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

def pause
  spotify 'pause'
end

#play ⇒ Object



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

#playpause ⇒ Object



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

def playpause
  spotify 'playpause'
end

#prev ⇒ Object



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

def prev
  spotify 'previous track'
  super
end

#track ⇒ Object



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

def track
  spotify 'return name of current track'
end

#voldown ⇒ Object



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

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

#volume ⇒ Object



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

def volume
  spotify 'return sound volume'
end

#volup ⇒ Object



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

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