Class: Commands::Play
- Inherits:
-
Object
- Object
- Commands::Play
- Defined in:
- lib/commands/play.rb
Class Method Summary collapse
Instance Method Summary collapse
- #go ⇒ Object
-
#initialize(args, settings) ⇒ Play
constructor
A new instance of Play.
- #media? ⇒ Boolean
- #respond ⇒ Object
Constructor Details
Class Method Details
.matches ⇒ Object
24 25 26 |
# File 'lib/commands/play.rb', line 24 def self.matches ['play', 'play my music'] end |
Instance Method Details
#go ⇒ Object
9 10 11 12 13 |
# File 'lib/commands/play.rb', line 9 def go `osascript -e 'tell application "#{@app}" to launch'` sleep 1.5 `osascript -e 'tell application "#{@app}" to play'` end |
#media? ⇒ Boolean
20 21 22 |
# File 'lib/commands/play.rb', line 20 def media? false end |
#respond ⇒ Object
15 16 17 18 |
# File 'lib/commands/play.rb', line 15 def respond sleep 3.5 "Now playing: #{`osascript -e 'tell application "#{@app}" to get the name of the current track'`}".chomp rescue "" end |