Skip to content

Commit

Permalink
Handle extra-time & pso
Browse files Browse the repository at this point in the history
This how we work with an API without documentation: learn when it
happens :)
  • Loading branch information
j0k3r committed Jun 29, 2014
1 parent ae6d550 commit 0b8b059
Showing 1 changed file with 60 additions and 10 deletions.
70 changes: 60 additions & 10 deletions worldCupNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,71 @@ function postToSlack($text, $attachments_text = '')

// half time, end game
case 'End':
if ('1H' == $post['data']['c_ActionPhase'])
switch ($post['data']['c_ActionPhase'])
{
// half time
postToSlack($preText.':toilet: '.$text);
case '1H':
// half time
postToSlack($preText.':toilet: '.$text);
break;

case '2H':
// end game
postToSlack($preText.':no_good: '.$text, $db[$liveMatch]['score']);
break;

case '1ET':
// end of first extra time
postToSlack($preText.':smoking: '.$text, $db[$liveMatch]['score']);
break;

case '2ET':
// end of second extra time
postToSlack($preText.':no_good: '.$text, $db[$liveMatch]['score']);
break;

case 'PSO':
// end of penalty shout-out
postToSlack($preText.':no_good: '.$text, $db[$liveMatch]['score']);
break;
}
elseif ('2H' == $post['data']['c_ActionPhase'])
{
// end game
postToSlack($preText.':no_good: '.$text, $db[$liveMatch]['score']);
break;

// remove match
unset($db['live_matches'][$key]);
unset($db[$liveMatch]);
// halftime, extra time, penalty shout-out
case 'Start':
switch ($post['data']['c_ActionPhase'])
{
case '2H':
// second half time
postToSlack($preText.':runner: '.$text);
break;

case '1ET':
// extra time starts
postToSlack($preText.':dizzy: '.$text);
break;

case '2ET':
// second period of extra time
postToSlack($preText.':runner: '.$text);
break;

case 'PSO':
// penalty shout-out
postToSlack($preText.':dart: '.$text);
break;
}
break;

// penalty shout-out
case 'PSG':
// pso goal
postToSlack($preText.':+1: '.$text);
break;

case 'PSM':
// pso goal
postToSlack($preText.':-1: '.$text);
break;
}
}
}
Expand Down

0 comments on commit 0b8b059

Please sign in to comment.