2021-12-10 15:22:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
use App\Services\LibraryManager;
|
2021-12-10 15:22:35 +00:00
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
class PruneLibraryCommand extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'koel:prune';
|
|
|
|
protected $description = 'Remove empty artists and albums';
|
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
public function __construct(private LibraryManager $libraryManager)
|
2021-12-10 15:22:35 +00:00
|
|
|
{
|
2022-06-10 10:47:46 +00:00
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handle(): int
|
|
|
|
{
|
|
|
|
$this->libraryManager->prune();
|
2021-12-10 15:22:35 +00:00
|
|
|
$this->info('Empty artists and albums removed.');
|
2022-06-10 10:47:46 +00:00
|
|
|
|
2022-07-29 06:47:10 +00:00
|
|
|
return self::SUCCESS;
|
2021-12-10 15:22:35 +00:00
|
|
|
}
|
|
|
|
}
|