Class: Spty::Command::PlayCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Spty::Command::PlayCommand
- Defined in:
- lib/spty/commands/play_command.rb
Constant Summary collapse
- ASCRIPT_PLAYER_PLAY =
<<-EOL tell application "Spotify" play end tell EOL
Constants inherited from BaseCommand
BaseCommand::ASCRIPT_PLAYER_DETECT
Class Method Summary collapse
Methods inherited from BaseCommand
Class Method Details
.call(options, _) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/spty/commands/play_command.rb', line 8 def self.call(, _) return unless running? # Get the player state player_state_script = Spty::Command::StateCommand::ASCRIPT_PLAYER_STATE player_state = Spty::AppleScriptRunner.(player_state_script) if player_state.strip == 'paused' Spty::AppleScriptRunner.call(ASCRIPT_PLAYER_PLAY) end track_info_script = Spty::Command::InfoCommand::ASCRIPT_TRACK_INFO track_info = Spty::AppleScriptRunner.(track_info_script) puts "=> #{track_info.strip} [playing]" end |