mirror of
https://github.com/zeropingheroes/lancache-autofill
synced 2024-11-25 17:10:16 +00:00
Added ability to dequeue by status
This commit is contained in:
parent
2cd7bd3694
commit
d6f3548ed7
1 changed files with 18 additions and 1 deletions
|
@ -15,7 +15,8 @@ class Dequeue extends Command
|
||||||
protected $signature = 'steam:dequeue
|
protected $signature = 'steam:dequeue
|
||||||
{--app_id=}
|
{--app_id=}
|
||||||
{--platform=}
|
{--platform=}
|
||||||
{--account=}';
|
{--account=}
|
||||||
|
{--status=}';
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
*
|
*
|
||||||
|
@ -30,6 +31,13 @@ class Dequeue extends Command
|
||||||
*/
|
*/
|
||||||
const PLATFORMS = ['windows', 'osx', 'linux'];
|
const PLATFORMS = ['windows', 'osx', 'linux'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The permissible statuses.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
const STATUSES = ['queued', 'completed', 'failed'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*
|
*
|
||||||
|
@ -43,6 +51,12 @@ class Dequeue extends Command
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $this->option('status') && ! in_array($this->option('status'), $this::STATUSES))
|
||||||
|
{
|
||||||
|
$this->error('Invalid status specified. Available statuses are: '. implode(' ', $this::STATUSES));
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
$query = Capsule::table('steam_queue');
|
$query = Capsule::table('steam_queue');
|
||||||
|
|
||||||
if( $this->option('app_id') )
|
if( $this->option('app_id') )
|
||||||
|
@ -54,6 +68,9 @@ class Dequeue extends Command
|
||||||
if( $this->option('account') )
|
if( $this->option('account') )
|
||||||
$query->where('account', $this->option('account'));
|
$query->where('account', $this->option('account'));
|
||||||
|
|
||||||
|
if( $this->option('status') )
|
||||||
|
$query->where('status', $this->option('status'));
|
||||||
|
|
||||||
// If no options were specified, ask for confirmation
|
// If no options were specified, ask for confirmation
|
||||||
if( ! array_filter($this->options()) && ! $this->confirm('Are you sure you want to clear the download queue?') )
|
if( ! array_filter($this->options()) && ! $this->confirm('Are you sure you want to clear the download queue?') )
|
||||||
die();
|
die();
|
||||||
|
|
Loading…
Reference in a new issue