mirror of
https://github.com/zeropingheroes/lancache-autofill
synced 2024-11-10 10:24:12 +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
|
||||
{--app_id=}
|
||||
{--platform=}
|
||||
{--account=}';
|
||||
{--account=}
|
||||
{--status=}';
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
|
@ -30,6 +31,13 @@ class Dequeue extends Command
|
|||
*/
|
||||
const PLATFORMS = ['windows', 'osx', 'linux'];
|
||||
|
||||
/**
|
||||
* The permissible statuses.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
const STATUSES = ['queued', 'completed', 'failed'];
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
|
@ -43,6 +51,12 @@ class Dequeue extends Command
|
|||
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');
|
||||
|
||||
if( $this->option('app_id') )
|
||||
|
@ -54,6 +68,9 @@ class Dequeue extends Command
|
|||
if( $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( ! array_filter($this->options()) && ! $this->confirm('Are you sure you want to clear the download queue?') )
|
||||
die();
|
||||
|
|
Loading…
Reference in a new issue