Skip to content

Instantly share code, notes, and snippets.

@davedevelopment
Created March 1, 2012 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davedevelopment/1949917 to your computer and use it in GitHub Desktop.
Save davedevelopment/1949917 to your computer and use it in GitHub Desktop.
Audio notifier for Sismo
<?php
use Sismo\Notifier;
use Sismo\Commit;
/**
* A simple audio notifier for Sismo
*
* (c) Dave Marshall <dave.marshall@atstsolutions.co.uk>
*
*/
class AudioNotifier extends Notifier
{
/**
* Success
*/
protected $success;
/**
* Failure
*/
protected $failure;
/**
* Command
*/
protected $command;
/**
* Constructor
*
* @param string $success - path to success sound
* @param string $failure - path to failure sound
* @param string $command - optional sprintf format string for command
*/
public function __construct($success, $failure, $command = 'mplayer "%s" > /dev/null 2>&1 ')
{
$this->success = realpath($success);
$this->failure = realpath($failure);
$this->command = $command;
}
/**
* {@inheritDoc}
*/
public function notify(Commit $commit)
{
$file = $commit->isSuccessful() ? $this->success : $this->failure;
exec(sprintf($this->command, $file));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment