mirror of
https://github.com/koel/koel
synced 2024-11-10 14:44:13 +00:00
feat: rename koel:tidy to koel:prune
This commit is contained in:
parent
1e93645cbb
commit
2cb64de316
5 changed files with 24 additions and 19 deletions
18
app/Console/Commands/PruneLibraryCommand.php
Normal file
18
app/Console/Commands/PruneLibraryCommand.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Events\LibraryChanged;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class PruneLibraryCommand extends Command
|
||||
{
|
||||
protected $signature = 'koel:prune';
|
||||
protected $description = 'Remove empty artists and albums';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
event(new LibraryChanged());
|
||||
$this->info('Empty artists and albums removed.');
|
||||
}
|
||||
}
|
|
@ -2,28 +2,15 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Events\LibraryChanged;
|
||||
use App\Services\MediaSyncService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class TidyLibraryCommand extends Command
|
||||
{
|
||||
protected $signature = 'koel:tidy';
|
||||
protected $description = 'Tidy up the library by deleting empty artists and albums';
|
||||
|
||||
private MediaSyncService $mediaSyncService;
|
||||
|
||||
public function __construct(MediaSyncService $mediaSyncService)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->mediaSyncService = $mediaSyncService;
|
||||
}
|
||||
protected $hidden = true;
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->mediaSyncService->tidy();
|
||||
event(new LibraryChanged());
|
||||
$this->info('Empty artists and albums removed.');
|
||||
$this->warn('koel:tidy has been renamed. Use koel:prune instead.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Listeners;
|
|||
|
||||
use App\Services\MediaSyncService;
|
||||
|
||||
class TidyLibrary
|
||||
class PruneLibrary
|
||||
{
|
||||
private MediaSyncService $mediaSyncService;
|
||||
|
|
@ -17,7 +17,7 @@ use App\Listeners\DownloadAlbumCover;
|
|||
use App\Listeners\DownloadArtistImage;
|
||||
use App\Listeners\LoveMultipleTracksOnLastfm;
|
||||
use App\Listeners\LoveTrackOnLastfm;
|
||||
use App\Listeners\TidyLibrary;
|
||||
use App\Listeners\PruneLibrary;
|
||||
use App\Listeners\UnloveMultipleTracksOnLastfm;
|
||||
use App\Listeners\UpdateLastfmNowPlaying;
|
||||
use App\Models\Album;
|
||||
|
@ -46,7 +46,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
],
|
||||
|
||||
LibraryChanged::class => [
|
||||
TidyLibrary::class,
|
||||
PruneLibrary::class,
|
||||
ClearMediaCache::class,
|
||||
],
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ class MediaSyncService
|
|||
}
|
||||
}
|
||||
|
||||
public function tidy(): void
|
||||
public function prune(): void
|
||||
{
|
||||
$inUseAlbums = $this->albumRepository->getNonEmptyAlbumIds();
|
||||
$inUseAlbums[] = Album::UNKNOWN_ID;
|
||||
|
|
Loading…
Reference in a new issue