Archived
1
0
Fork 0
This repository has been archived on 2020-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
news-script/run.php

97 lines
2.5 KiB
PHP
Raw Normal View History

#!/usr/bin/php
<?php
/*
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/>.
*/
2018-05-15 14:11:18 +03:00
use Symfony\Component\Yaml\Yaml;
require "vendor/autoload.php";
require "Game.php";
require "Source.php";
2018-05-15 14:11:18 +03:00
$config = Yaml::parse(file_get_contents('config.yml'));
define('STYLE',$config['STYLE']);
define('FORMAT',$config['FORMAT']);
$loader = new \Aura\Autoload\Loader;
$loader->register();
$loader->addPrefix('Source', 'Source');
$parsers = 'all';
if (PHP_SAPI !== 'cli') {
ob_start();
echo '<!DOCTYPE html><html><body><code><pre>';
2019-05-15 21:27:32 +03:00
if (isset($_GET['parsers'])) {
2019-04-16 09:54:47 +03:00
$parsers = $_GET['parsers'];
$parsers = explode(',', $parsers);
}
} else {
if (isset($argv[1])) {
$parsers = explode(',', strtolower($argv[1]));
}
}
2019-04-16 09:54:47 +03:00
if ($parsers === 'all') {
$parsers = [
2018-03-24 21:49:32 +02:00
'urq',
2017-09-15 18:11:55 +03:00
'anivisual',
2018-05-15 14:11:18 +03:00
'kvester',
2018-05-10 10:31:36 +03:00
//'vndb',
'apero',
2018-09-19 05:53:13 +03:00
'instory',
// 'instead',
'hyperbook_ru',
'hyperbook_en',
'questbook',
'textadventures',
'ifdb',
'dashingdon',
'itch',
2017-10-07 11:05:16 +03:00
'gamejolt',
2017-10-07 11:53:14 +03:00
'steam',
];
}
function check($classname, $command) {
global $parsers;
2019-04-16 09:54:47 +03:00
if (is_array($parsers) && in_array($command, $parsers)) {
$cname = 'Source\\'.$classname;
(new $cname())->check();
}
}
2018-03-24 21:49:32 +02:00
check ('Urq', 'urq');
check ('Qsp', 'qsp');
2018-05-15 14:11:18 +03:00
check ('Kvester', 'kvester');
check ('Apero', 'apero');
check ('Instead', 'instead');
check ('Hyperbook', 'hyperbook_ru');
check ('Questbook', 'questbook');
2018-09-19 05:53:13 +03:00
check ('Instory', 'instory');
2017-09-15 18:11:55 +03:00
check ('Anivisual', 'anivisual');
// ------- English online libraries
check ('HyperbookEn', 'hyperbook_en');
check ('Textadventures', 'textadventures');
check ('IFDB', 'ifdb');
2018-05-10 10:31:36 +03:00
check ('VNDB', 'vndb');
//check ('Dashingdon', 'dashingdon');
check ('Itch', 'itch');
2017-10-07 11:05:16 +03:00
check ('Gamejolt', 'gamejolt');
2017-10-07 11:53:14 +03:00
check ('Steam', 'steam');
if (PHP_SAPI !== 'cli') {
echo '</pre></code></body></html>';
ob_end_flush();
}