Skip to content

Commit c0c253d

Browse files
committed
Update fix-nzbsplit command
1 parent 95436c8 commit c0c253d

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

app/Console/Commands/FixNzbSplitNames.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
class FixNzbSplitNames extends Command
1414
{
1515
protected $signature = 'releases:fix-nzbsplit
16-
{--dry-run : Preview changes without updating the database}';
16+
{--dry-run : Preview changes without updating the database}
17+
{--include-renamed : Include releases already marked as renamed}';
1718

18-
protected $description = 'Fix NZBSPLIT-wrapped release names and recategorize the affected releases.';
19+
protected $description = 'Fix NZBSPLIT-wrapped release names for unrenamed releases by default and recategorize the affected releases.';
1920

2021
public function handle(CategorizationService $categorizationService, NzbSplitUnwrapper $nzbSplitUnwrapper): int
2122
{
23+
$includeRenamed = (bool) $this->option('include-renamed');
24+
2225
$query = Release::query()
2326
->select(['id', 'name', 'searchname', 'fromname', 'groups_id', 'categories_id'])
2427
->where(function ($builder): void {
@@ -28,10 +31,17 @@ public function handle(CategorizationService $categorizationService, NzbSplitUnw
2831
})
2932
->orderBy('id');
3033

34+
if (! $includeRenamed) {
35+
$query->where('isrenamed', 0);
36+
}
37+
3138
$count = (clone $query)->count();
3239

3340
if ($count === 0) {
34-
$this->info('No NZBSPLIT-wrapped releases found.');
41+
$this->info($includeRenamed
42+
? 'No NZBSPLIT-wrapped releases found.'
43+
: 'No unrenamed NZBSPLIT-wrapped releases found.'
44+
);
3545

3646
return self::SUCCESS;
3747
}

0 commit comments

Comments
 (0)