oreolek
/
news-script
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
Executable File

#!/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/>.
*/
use Symfony\Component\Yaml\Yaml;
require "vendor/autoload.php";
require "Game.php";
require "Source.php";
$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>';
if (isset($_GET['parsers'])) {
$parsers = $_GET['parsers'];
$parsers = explode(',', $parsers);
}
} else {
if (isset($argv[1])) {
$parsers = explode(',', strtolower($argv[1]));
}
}
if ($parsers === 'all') {
$parsers = [
'urq',
'anivisual',
'kvester',
//'vndb',
'apero',
'instory',
// 'instead',
'hyperbook_ru',
'hyperbook_en',
'questbook',
'textadventures',
'ifdb',
'dashingdon',
'itch',
'gamejolt',
'steam',
];
}
function check($classname, $command) {
global $parsers;
if (is_array($parsers) && in_array($command, $parsers)) {
$cname = 'Source\\'.$classname;
(new $cname())->check();
}
}
check ('Urq', 'urq');
check ('Qsp', 'qsp');
check ('Kvester', 'kvester');
check ('Apero', 'apero');
check ('Instead', 'instead');
check ('Hyperbook', 'hyperbook_ru');
check ('Questbook', 'questbook');
check ('Instory', 'instory');
check ('Anivisual', 'anivisual');
// ------- English online libraries
check ('HyperbookEn', 'hyperbook_en');
check ('Textadventures', 'textadventures');
check ('IFDB', 'ifdb');
check ('VNDB', 'vndb');
//check ('Dashingdon', 'dashingdon');
check ('Itch', 'itch');
check ('Gamejolt', 'gamejolt');
check ('Steam', 'steam');
if (PHP_SAPI !== 'cli') {
echo '</pre></code></body></html>';
ob_end_flush();
}