mirror of
https://github.com/zeropingheroes/lancache-autofill
synced 2024-11-26 09:20:18 +00:00
54 lines
No EOL
1.6 KiB
PHP
Executable file
54 lines
No EOL
1.6 KiB
PHP
Executable file
#!/usr/bin/env php
|
|
<?php
|
|
|
|
use Illuminate\Console\Application;
|
|
use Illuminate\Container\Container;
|
|
use Illuminate\Events\Dispatcher;
|
|
use Illuminate\Database\Capsule\Manager as Capsule;
|
|
use Dotenv\Dotenv;
|
|
|
|
use Zeropingheroes\LancacheAutofill\Console\Commands\Steam\{UpdateAppList, SearchApps, QueueApp, ShowQueue, Dequeue, Requeue, AuthoriseAccount, StartDownloading};
|
|
use Zeropingheroes\LancacheAutofill\Console\Commands\{InitialiseDatabase, InitialiseDownloadsDirectory};
|
|
|
|
// Load Composer's autoloader
|
|
if (file_exists($a = __DIR__.'/../../autoload.php')) {
|
|
require_once $a;
|
|
} else {
|
|
require_once __DIR__.'/vendor/autoload.php';
|
|
}
|
|
|
|
// Load environment variables
|
|
$dotenv = new Dotenv(__DIR__);
|
|
$dotenv->load();
|
|
$dotenv->required(['DOWNLOADS_DIRECTORY', 'STEAMCMD_PATH', 'DEFAULT_STEAM_USER']);
|
|
|
|
if ( ! file_exists(getenv('STEAMCMD_PATH')) ) {
|
|
die('SteamCMD not found - please check the STEAMCMD_PATH environment variable is set correctly');
|
|
}
|
|
|
|
// Set up the console app
|
|
$app = new Application(new Container, new Dispatcher, '5.4');
|
|
|
|
// Set up the SQLite database connection
|
|
$capsule = new Capsule;
|
|
$capsule->addConnection([
|
|
'driver' => 'sqlite',
|
|
'database' => 'database.sqlite'
|
|
]);
|
|
$capsule->setAsGlobal();
|
|
|
|
// Make commands available
|
|
$app->add(new InitialiseDatabase);
|
|
$app->add(new InitialiseDownloadsDirectory);
|
|
|
|
$app->add(new UpdateAppList);
|
|
$app->add(new SearchApps);
|
|
$app->add(new QueueApp);
|
|
$app->add(new ShowQueue);
|
|
$app->add(new Dequeue);
|
|
$app->add(new Requeue);
|
|
$app->add(new AuthoriseAccount);
|
|
$app->add(new StartDownloading);
|
|
|
|
// Run the console app
|
|
$app->run(); |