Skip to content

Commit

Permalink
Cleanup for #37
Browse files Browse the repository at this point in the history
  • Loading branch information
jacroe committed Jan 11, 2013
1 parent 4932964 commit 7341f0b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 51 deletions.
4 changes: 0 additions & 4 deletions modules/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ function alice_error_x10()
{
return "I couldn't find a command in that statement.".alice_tryagain();
}
function alice_error_noevent()
{
return "I couldn't find an event by that name.".alice_tryagain();
}
function alice_error_nocommand()
{
return "I'm sorry, I didn't quite catch that. Did you want me to do something?";
Expand Down
42 changes: 1 addition & 41 deletions modules/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,6 @@
*/
function alice_events($string)
{
if (preg_match("/\bsleep\b/i", $string))
{
alice_x10_check("livingroom off");
sleep(1);
alice_x10_check("bedroom off");
sleep(3);
alice_x10_check("bedroom on");
sleep(30);
alice_x10_check("bedroom off");
}
elseif (preg_match("/\blOff\b/i", $string))
{
//sleep(15);
alice_x10_check("livingroom off");
sleep(1);
alice_x10_check("bedroom off");
}
elseif (preg_match("/\blOn\b/i", $string))
{
alice_x10_check("livingroom on");
sleep(1);
alice_x10_check("bedroom brighten");
return "Welcome Back";
}
elseif (preg_match("/\bwatch\b/i", $string) || preg_match("/\bmovie\b/i", $string))
{
alice_xbmc_check("notify Killing the lights");
alice_x10_check("livingroom off");
sleep(1);
alice_x10_check("bedroom off");
}
elseif (preg_match("/\breading\b/i", $string))
{
alice_x10_check("bedroom off");
sleep(1);
alice_x10_check("bedroom on");
sleep(1);
alice_x10_check("livingroom off");
return "Enjoy your book";
}
else return alice_error_noevent();
alice_pushover("Alice_events()", "Something is still using alice_events();");
}
?>
4 changes: 0 additions & 4 deletions modules/listen.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ function alice_check_command($string)
$travel = alice_loc_travel($from['lat'].','.$from['long'], $to['zip']);
return "It's {$travel['dist']} from {$from['city']} to {$to['city']} or roughly {$travel['time']}. In {$to['city']}, it's {$weather['currTemp']}F and {$weather['currCond']}.";
}
elseif (preg_match("/\bevent\b/i", $string))
{
return alice_events($string);
}
else return alice_error_nocommand();
}

Expand Down
2 changes: 0 additions & 2 deletions modules/xbmc.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,12 @@ function alice_xbmc_check($string)
$id = intval($match[0]);
$data = array("jsonrpc" => "2.0", "method" => "Player.Open", "params" => array("item" => array("movieid" => $id)), "id" => 1);
alice_xbmc_talk($data);
alice_events("watch");
}
elseif (preg_match("/\bepisode\b/i", $string))
{
preg_match('/\d+/', $string, $match);
$data = array("jsonrpc" => "2.0", "method" => "Player.Open", "params" => array("item" => array("episodeid" => $id)), "id" => 1);
alice_xbmc_talk($data);
alice_events("watch");
}
elseif (preg_match("/\bquit\b/i", $string))
{
Expand Down

0 comments on commit 7341f0b

Please sign in to comment.