Exemplo n.º 1
0
    echo "empty content";
    exit;
}
$file = preg_split("/(\r\n|\r|\n)/u", $content);
if ($_POST['input_origin'] == "RCScoringPro") {
    $parser = new Model\Parser\NCHDataParser($file);
} else {
    if ($_POST['input_origin'] == "MyLaps") {
        $parser = new Model\Parser\MylapsDataParser($file);
    } else {
        if ($_POST['input_origin'] == "GoKartRacer") {
            $parser = new Model\Parser\GKRDataParser($file);
        } else {
            if ($_POST['input_origin'] == "LiveTiming") {
                $parser = new Model\Parser\LivetimeRCDataParser($file);
            } else {
                echo "empty input type.";
                exit;
            }
        }
    }
}
$si = new Model\Subtitle\ScriptInfo();
$ts = new Model\Subtitle\TimingScoring($parser->totalResult->raceResultList[$rid]);
$driverId = $uid;
$ts->setStartTime($uid, $crossTime);
$ctd = new Model\Subtitle\CountDown($ts->getRaceTime(), $ts->getStartTime());
$outputFilename = preg_replace("/\\s+/u", ".", $parser->totalResult->raceResultList[$rid]->name);
header('Content-type: application/text');
header("Content-disposition: attachment; filename={$outputFilename}.ass");
echo $si . "\n" . $ts . "\n" . $ctd;
$fileContent = file($datafileLoc);
$parser = new Model\Parser\LivetimeRCDataParser($fileContent);
//var_dump($parser);
$raceList = $parser->totalResult->getRaceNameList();
// $raceName = "油越";
//$raceName = "4wd Buggy Modified A";
//$raceName = "4x4 Short Course Open A";
var_dump($parser->totalResult);
$si = new Model\Subtitle\ScriptInfo();
$ts = new Model\Subtitle\TimingScoring($parser->totalResult->raceResultList[0]);
$driverIdArr = $ts->raceResult->searchIdByName("张 晓琪");
if (count($driverIdArr) != 1) {
    if (empty($driverIdArr)) {
        echo "no driver found.\n";
    } else {
        foreach ($driverIdArr as $did) {
            echo "{$ts->raceResult->driverList[$did]->name}\n";
        }
        echo "multiple driver found.\n";
    }
    exit;
}
$driverId = $driverIdArr[0];
$ts->setStartTime($driverId, 7.057);
$ctd = new Model\Subtitle\CountDown($ts->getRaceTime(), $ts->getStartTime());
// write to file
//$fh = fopen("F:\\Download\\2015_The_Dirt_Nitro_Challenge_1_8_Pro_Buggy_A-Main_and_JConcepts_Pit_Report_with_top_five_finishers.ass", "w");
//fwrite($fh, $si);
//fwrite($fh, $ts);
//fwrite($fh, $ctd);
//fclose($fh);
        }
        echo "multiple races found.\n";
    }
    exit;
    echo "multiple race found";
    exit;
}
$raceId = $raceIdArr[0];
$si = new Model\Subtitle\ScriptInfo();
$ts = new Model\Subtitle\TimingScoring($parser->totalResult->raceResultList[$raceId]);
$driverIdArr = $ts->raceResult->searchIdByName("nathan bernal");
if (count($driverIdArr) != 1) {
    if (empty($driverIdArr)) {
        echo "no driver found.\n";
    } else {
        foreach ($driverIdArr as $did) {
            echo "{$ts->raceResult->driverList[$did]->name}\n";
        }
        echo "multiple driver found.\n";
    }
    exit;
}
$driverId = $driverIdArr[0];
$ts->setStartTime($driverId, 1.801);
$ctd = new Model\Subtitle\CountDown($ts->getRaceTime(), $ts->getStartTime());
// write to file
$fh = fopen("D:\\test.ass", "w");
fwrite($fh, $si);
fwrite($fh, $ts);
fwrite($fh, $ctd);
fclose($fh);