Update PPAG

This commit is contained in:
DariusIII
2025-08-29 14:07:16 +02:00
parent 3fd77920b1
commit 511dcc3e58
+15 -7
View File
@@ -2,8 +2,8 @@
namespace App\Console\Commands;
use Blacklight\processing\post\ProcessAdditional;
use App\Models\Release;
use Blacklight\processing\post\ProcessAdditional;
use Illuminate\Console\Command;
class ProcessAdditionalGuid extends Command
@@ -23,11 +23,13 @@ class ProcessAdditionalGuid extends Command
if ($guidArg === '' && ($idOpt === null || $idOpt === '')) {
$this->error('You must supply either a GUID argument or --id=<release id>.');
return 1; // missing identifier
}
if ($guidArg !== '' && $idOpt !== null && $idOpt !== '') {
$this->error('Provide only one identifier: GUID or --id, not both.');
return 4; // conflicting identifiers
}
@@ -37,11 +39,13 @@ class ProcessAdditionalGuid extends Command
if ($idOpt !== null && $idOpt !== '') {
if (! ctype_digit((string) $idOpt)) {
$this->error('Release ID must be numeric.');
return 5; // invalid id format
}
$release = Release::find((int) $idOpt);
if ($release === null) {
$this->error('Release not found for ID: '.$idOpt);
return 2; // not found
}
$guid = $release->guid;
@@ -49,11 +53,13 @@ class ProcessAdditionalGuid extends Command
$guid = $guidArg;
if ($guid === '') { // should not happen but guard
$this->error('GUID is required if --id not supplied.');
return 1;
}
$release = Release::where('guid', $guid)->first();
if ($release === null) {
$this->error('Release not found for GUID: '.$guid);
return 2;
}
}
@@ -61,11 +67,11 @@ class ProcessAdditionalGuid extends Command
if ($this->option('reset')) {
Release::where('id', $release->id)->update([
'passwordstatus' => -1,
'haspreview' => -1,
'jpgstatus' => 0,
'videostatus' => 0,
'audiostatus' => 0,
'nfostatus' => -1,
'haspreview' => -1,
'jpgstatus' => 0,
'videostatus' => 0,
'audiostatus' => 0,
'nfostatus' => -1,
]);
$this->info('Reset postprocessing flags for release ID '.$release->id.' (GUID '.$guid.')');
}
@@ -74,15 +80,17 @@ class ProcessAdditionalGuid extends Command
config(['nntmux.echocli' => false]);
}
$processor = new ProcessAdditional();
$processor = new ProcessAdditional;
$ok = $processor->processSingleGuid($guid);
if (! $ok) {
$this->error('Processing failed or nothing processed for '.($idOpt ? 'ID '.$idOpt : 'GUID '.$guid).'.');
return 3;
}
$this->info('Additional postprocessing completed for '.($idOpt ? 'ID '.$idOpt : 'GUID '.$guid).'.');
return 0;
}
}