Compare commits
14 Commits
bd49027ad6
...
master
Author | SHA1 | Date | |
---|---|---|---|
c44f035dcd | |||
8543ebac7f | |||
4de6df7175 | |||
1dabcfbe0b | |||
d299edd10d | |||
9757e58998 | |||
a0f70c6619 | |||
63cbfb3681 | |||
1e1617eb53 | |||
b1dbebf17f | |||
4eb299339e | |||
b6b82cae41 | |||
807aa70719 | |||
53a614c5fd |
@ -14,10 +14,12 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
- name: run crawler
|
||||
run: |
|
||||
sed -i "/^error_reporting/c\error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE" /etc/php/7.4/cli/php.ini
|
||||
cd crawler
|
||||
php crawler.php
|
||||
git config --global user.email "gitea@haschek.at"
|
||||
git config --global user.name "Gitea"
|
||||
git pull
|
||||
git add data.db
|
||||
git commit -m "update database"
|
||||
git push
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
web/version.txt
|
||||
database.sqlite3
|
@ -1,43 +1,41 @@
|
||||
<?php
|
||||
|
||||
if(!file_exists('tmp/ergebnisse.html'))
|
||||
{
|
||||
$ergebnisse = file_get_contents('https://www.dognow.at/ergebnisse/');
|
||||
file_put_contents('tmp/ergebnisse.html', $ergebnisse);
|
||||
}
|
||||
|
||||
|
||||
$GLOBALS['db'] = new SQLite3('data.db');
|
||||
if(!$GLOBALS['db']) exit("Error loading database");
|
||||
|
||||
//389-7625.pdf.csv
|
||||
// analyzeResultCSV('tmp/csv/389-7637.pdf.csv',7637,389);
|
||||
// exit();
|
||||
// if(!file_exists('tmp/ergebnisse.html'))
|
||||
// {
|
||||
// $ergebnisse = file_get_contents('https://www.dognow.at/ergebnisse/');
|
||||
// file_put_contents('tmp/ergebnisse.html', $ergebnisse);
|
||||
// }
|
||||
|
||||
$html = file_get_contents('tmp/ergebnisse.html');
|
||||
// $html = file_get_contents('tmp/ergebnisse.html');
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$dom->loadHTML($html);
|
||||
// $dom = new DOMDocument;
|
||||
// $dom->loadHTML($html);
|
||||
|
||||
$xpath = new DOMXPath($dom);
|
||||
$query = '//ul[@class="pagination"]/child::*';
|
||||
$nodes = $xpath->query($query);
|
||||
// $xpath = new DOMXPath($dom);
|
||||
// $query = '//ul[@class="pagination"]/child::*';
|
||||
// $nodes = $xpath->query($query);
|
||||
|
||||
$GLOBALS['pdfs'] = 0;
|
||||
// $GLOBALS['pdfs'] = 0;
|
||||
|
||||
// Loop through the selected nodes
|
||||
foreach ($nodes as $node) {
|
||||
// Do something with each node, for example, echo its content
|
||||
$url = $node->getElementsByTagName('a')[0]->getAttribute('href');
|
||||
$number = intval($node->nodeValue);
|
||||
if($number > $last_page){
|
||||
$last_page = $number;
|
||||
}
|
||||
}
|
||||
// // Loop through the selected nodes
|
||||
// foreach ($nodes as $node) {
|
||||
// // Do something with each node, for example, echo its content
|
||||
// $url = $node->getElementsByTagName('a')[0]->getAttribute('href');
|
||||
// $number = intval($node->nodeValue);
|
||||
// if($number > $last_page){
|
||||
// $last_page = $number;
|
||||
// }
|
||||
// }
|
||||
|
||||
echo "[i] Found $last_page pages\n";
|
||||
// echo "[i] Found $last_page pages\n";
|
||||
|
||||
//create an array with all pages
|
||||
$pages = range(1,65);
|
||||
// //create an array with all pages
|
||||
// $pages = range(1,65);
|
||||
|
||||
// foreach($pages as $page)
|
||||
// {
|
||||
@ -174,6 +172,11 @@ function getResults($run,$event)
|
||||
$url = "https://www.dognow.at/ergebnisse/pdf.php?lauf=$run&event=$event";
|
||||
if(!file_exists('tmp/results/' . $event . '-' . $run . '.pdf'))
|
||||
file_put_contents('tmp/results/' . $event . '-' . $run . '.pdf',file_get_contents($url));
|
||||
/*if($GLOBALS['db']->query("SELECT * FROM runs WHERE id = '$run' AND event = '$event'")->fetchArray() != false)
|
||||
{
|
||||
echo " [i] Skipping run $run in event $event\n";
|
||||
return;
|
||||
}*/
|
||||
convertPDFtoCSV('tmp/results/' . $event . '-' . $run . '.pdf','tmp/csv/' . $event . '-' . $run . '.pdf.csv');
|
||||
analyzeResultCSV('tmp/csv/' . $event . '-' . $run . '.pdf.csv',$run,$event);
|
||||
}
|
||||
|
BIN
crawler/data.db
BIN
crawler/data.db
Binary file not shown.
@ -34,6 +34,7 @@
|
||||
<th>msek</th>
|
||||
<th>bew</th>
|
||||
<th>punkte</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
<?php foreach ($results as $res) :
|
||||
// graph data preparation
|
||||
@ -67,7 +68,7 @@
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $res['event'] ?></td>
|
||||
<td><?= $res['ago'] ?></td>
|
||||
<td><?= date("d.m.Y", strtotime($res['date'])) ?></td>
|
||||
<td><?= $res['run'] ?></td>
|
||||
<td><?= $res['rang'] ?></td>
|
||||
<td><?= $res['stnr'] ?></td>
|
||||
@ -82,7 +83,24 @@
|
||||
<td><?= $res['msek'] ?></td>
|
||||
<td><?= $res['bew'] ?></td>
|
||||
<td><?= $res['punkte'] ?></td>
|
||||
|
||||
<td>
|
||||
<form id="tournament_import" hx-post="/tournaments/add" hx-encoding="multipart/form-data" hx-target="#main">
|
||||
<input type="hidden" name="tournament_name" value="<?= $res['event'] ?>">
|
||||
<input type="hidden" name="tournament_date" value="<?= date("d.m.Y", strtotime($res['date'])) ?>">
|
||||
<input type="hidden" name="tournament_run" value="<?= $res['run'] ?>">
|
||||
<input type="hidden" name="tournament_ranking" value="<?= $res['rang'] ?>">
|
||||
<input type="hidden" name="tournament_number" value="<?= $res['stnr'] ?>">
|
||||
<input type="hidden" name="tournament_participant" value="<?= $res['teilnehmer'] ?>">
|
||||
<input type="hidden" name="tournament_dog" value="<?= $res['hund'] ?>">
|
||||
<input type="hidden" name="tournament_club" value="<?= $res['verein'] ?>">
|
||||
<input type="hidden" name="tournament_faults" value="<?= $res['f'] ?>">
|
||||
<input type="hidden" name="tournament_refusals" value="<?= $res['vw'] ?>">
|
||||
<input type="hidden" name="tournament_time" value="<?= $res['zeit'] ?>">
|
||||
<input type="hidden" name="tournament_speed" value="<?= $res['msek'] ?>">
|
||||
<input type="hidden" name="tournament_points" value="<?= $res['punkte'] ?>">
|
||||
<button type="submit">Importieren</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
@ -32,9 +32,35 @@ class Tournaments extends Page {
|
||||
|
||||
function add()
|
||||
{
|
||||
|
||||
$t = new Tournament();
|
||||
$t->name = $_REQUEST['tournament_name'];
|
||||
$t->date = date("d.m.Y", strtotime($_REQUEST['tournament_date']));
|
||||
$t->duration = intval($_REQUEST['tournament_duration']);
|
||||
$t->referee = $_REQUEST['tournament_referee'];
|
||||
$t->text = $_REQUEST['tournament_text'];
|
||||
$t->url = $_REQUEST['tournament_url'];
|
||||
$t->logo = $_REQUEST['tournament_logo'];
|
||||
$t->run = $_REQUEST['tournament_run'];
|
||||
$t->run = $_REQUEST['tournament_run'];
|
||||
$t->ranking = $_REQUEST['tournament_ranking'];
|
||||
$t->number = $_REQUEST['tournament_number'];
|
||||
$t->participant = $_REQUEST['tournament_participant'];
|
||||
$t->dog = $_REQUEST['tournament_dog'];
|
||||
$t->club = $_REQUEST['tournament_club'];
|
||||
$t->faults = $_REQUEST['tournament_faults'];
|
||||
$t->refusals = $_REQUEST['tournament_refusals'];
|
||||
$t->time = $_REQUEST['tournament_time'];
|
||||
$t->points = $_REQUEST['tournament_points'];
|
||||
$t->speed = $_REQUEST['tournament_speed'];
|
||||
var_dump($t->data);
|
||||
$this->set('tournamentdata',$t->data);
|
||||
$this->set('template','edit_tournament.html');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function index() {
|
||||
$events = $_SESSION['user']->data['tournaments'];
|
||||
$tournaments = [];
|
||||
@ -126,6 +152,7 @@ class Tournaments extends Page {
|
||||
{
|
||||
if($_REQUEST['submit'])
|
||||
{
|
||||
var_dump($_REQUEST);
|
||||
$id = $_REQUEST['tournament_id'];
|
||||
$name = $_REQUEST['tournament_name'];
|
||||
$date = $_REQUEST['tournament_date'];
|
||||
|
Reference in New Issue
Block a user