2018-03-21 11:04:50 +02:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
2018-05-13 10:02:22 +03:00
|
|
|
/*
|
|
|
|
A set of utilities for tracking text-based game releases
|
|
|
|
Copyright (C) 2017-2018 Alexander Yakovlev
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-07-29 09:35:32 +03:00
|
|
|
require "vendor/autoload.php";
|
2018-05-15 14:11:18 +03:00
|
|
|
use Symfony\Component\Yaml\Yaml;
|
2019-07-29 09:35:32 +03:00
|
|
|
use Oreolek\Game;
|
|
|
|
use Oreolek\Source;
|
|
|
|
use Oreolek\Wikipage;
|
2018-05-15 14:11:18 +03:00
|
|
|
|
|
|
|
$config = Yaml::parse(file_get_contents('config.yml'));
|
2018-03-21 11:04:50 +02:00
|
|
|
if (!isset($argv[1])) {
|
|
|
|
echo 'Please provide the direct URL to the game page.'.PHP_EOL;
|
|
|
|
die();
|
|
|
|
}
|
2018-03-29 10:42:44 +03:00
|
|
|
$url = $argv[1];
|
2019-05-15 21:27:32 +03:00
|
|
|
$game = new Game();
|
2018-03-21 11:04:50 +02:00
|
|
|
|
|
|
|
function check($classname) {
|
|
|
|
global $game;
|
|
|
|
global $url;
|
|
|
|
|
2019-08-02 06:56:09 +03:00
|
|
|
$cname = 'Oreolek\\Source\\'.$classname;
|
2018-03-21 11:04:50 +02:00
|
|
|
$cl = (new $cname());
|
|
|
|
if ($cl->checkPage($url)) {
|
2018-03-29 10:42:44 +03:00
|
|
|
echo 'Используется правило "'.$cl->title.'".'.PHP_EOL;
|
2018-03-29 18:16:19 +03:00
|
|
|
if (!$cl->delayedLoad) {
|
|
|
|
$cl->loadStr($cl->get_text($url));
|
|
|
|
}
|
2018-03-21 11:04:50 +02:00
|
|
|
$game = $cl->page($url);
|
2018-03-22 09:39:02 +02:00
|
|
|
if ($game) {
|
2018-03-23 20:00:43 +02:00
|
|
|
$page = new Wikipage($game);
|
|
|
|
$page->create();
|
2018-03-22 09:39:02 +02:00
|
|
|
}
|
2018-03-21 11:04:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-15 21:27:32 +03:00
|
|
|
check ('Urq');
|
2018-03-21 11:04:50 +02:00
|
|
|
check ('Qsp');
|
|
|
|
check ('Kvester');
|
|
|
|
check ('Apero');
|
|
|
|
check ('Instead');
|
|
|
|
check ('Hyperbook');
|
|
|
|
check ('HyperbookEn');
|
|
|
|
check ('Questbook');
|
|
|
|
check ('Anivisual');
|
|
|
|
check ('Itch');
|
|
|
|
check ('Gamejolt');
|
|
|
|
check ('Steam');
|