Module: Player::Adapters::Spotify

Defined in:
lib/remme/player/adapters/spotify.rb

Class Method Summary collapse

Class Method Details

.being_played?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/remme/player/adapters/spotify.rb', line 13

def being_played?
  script = %q{
    echo $(osascript <<EOF
      set state to missing value

      if application "Spotify" is running then
        tell application "Spotify"
          set state to (player state as text)
        end tell
      end if

      return state is equal to "playing"
    EOF)
  }

  `#{script}`.strip == 'true'
end

.pauseObject



9
10
11
# File 'lib/remme/player/adapters/spotify.rb', line 9

def pause
  `osascript -e 'tell application "Spotify" to pause'`
end

.playObject



5
6
7
# File 'lib/remme/player/adapters/spotify.rb', line 5

def play
  `osascript -e 'tell application "Spotify" to play'`
end