Class: Spty::Command::BaseCommand
- Inherits:
-
Object
- Object
- Spty::Command::BaseCommand
- Defined in:
- lib/spty/commands/base_command.rb
Direct Known Subclasses
InfoCommand, LaunchCommand, MuteCommand, PauseCommand, PlayCommand, ReplayCommand, SkipCommand, StateCommand, ToggleCommand, UnmuteCommand, VolumeCommand
Constant Summary collapse
- ASCRIPT_PLAYER_DETECT =
Check if the application is running
<<-EOL if application "Spotify" is running then return "Running" else return "Not running" end if EOL
Class Method Summary collapse
Class Method Details
.running?(show_mesg: true) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/spty/commands/base_command.rb', line 11 def self.running?(show_mesg: true) player_running = Spty::AppleScriptRunner.(ASCRIPT_PLAYER_DETECT) return true if player_running.strip == 'Running' if show_mesg output = "player not running\n"\ "to launch Spotify player, use: spty launch" puts output end false end |