Skip to content

@davedevelopment /AudioNotifier.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
Something went wrong with that request. Please try again.