Commit 69a57cde authored by Joe Holden's avatar Joe Holden

No need for curses

parent 2ed0ca31
......@@ -2,15 +2,17 @@
<?php
require_once dirname(__FILE__) . '/vendor/autoload.php';
$url = 'https://s3.amazonaws.com/nascar-www/data/cacher/production/live/live-feed.json';
//$url = 'https://s3.amazonaws.com/nascar-www/data/cacher/production/live/live-feed.json';
$url = 'http://www.nascar.com/live/feeds/series_1/4589/live_feed.json';
$duration = new Khill\Duration\Duration;
$climate = new League\CLImate\CLImate;
// fetch json
$json = json_decode(file_get_contents($url));
if (json_last_error() > 0) {
if (json_last_error()) {
printf("=> %s, %s: %s\n", 'json decode error', json_last_error(), json_last_error_msg());
exit;
}
// parse document
......@@ -23,10 +25,13 @@ while(true) {
file_put_contents($json, 'live-feed.json');
$count = 1;
}
if ($json->run_id == 0) {
$climate->clear();
$climate->out("No race currently running.");
if (json_last_error()) {
printf("=> %s, %s: %s\n", 'json decode error', json_last_error(), json_last_error_msg());
} else {
if ($json->run_id == 0) {
$climate->clear();
$climate->out("No race currently running.");
}
draw($json, $old, $climate, $duration, $count);
}
sleep(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment