mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Create Nfo service
This commit is contained in:
-1458
File diff suppressed because it is too large
Load Diff
@@ -6,9 +6,9 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use App\Services\NfoService;
|
||||
use App\Services\PostProcessService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -89,7 +89,7 @@ class PostProcessGuid extends Command
|
||||
private function processNfo(string $guid): void
|
||||
{
|
||||
$nntp = $this->getNntp();
|
||||
(new Nfo())->processNfoFiles(
|
||||
(new NfoService())->processNfoFiles(
|
||||
$nntp,
|
||||
'',
|
||||
$guid,
|
||||
|
||||
@@ -8,10 +8,10 @@ use App\Models\Category;
|
||||
use App\Models\Predb;
|
||||
use App\Models\Release;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use App\Services\NfoService;
|
||||
use App\Services\Nzb\NzbContentsService;
|
||||
use App\Services\PostProcessService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -166,7 +166,7 @@ class ReleasesFixNamesGroup extends Command
|
||||
}
|
||||
|
||||
// Process NFO
|
||||
if ((int) $release->nfostatus === Nfo::NFO_FOUND &&
|
||||
if ((int) $release->nfostatus === NfoService::NFO_FOUND &&
|
||||
(int) $release->proc_nfo === NameFixingService::PROC_NFO_NONE &&
|
||||
! empty($release->textstring) &&
|
||||
! preg_match('/^=newz\[NZB\]=\w+/', $release->textstring)) {
|
||||
@@ -225,7 +225,7 @@ class ReleasesFixNamesGroup extends Command
|
||||
}
|
||||
$this->warn($errorMessage);
|
||||
} else {
|
||||
$Nfo = new Nfo();
|
||||
$Nfo = new NfoService();
|
||||
$nzbcontents = app(NzbContentsService::class);
|
||||
$nzbcontents->setNntp($nntp);
|
||||
$nzbcontents->setNfo($Nfo);
|
||||
@@ -367,8 +367,8 @@ class ReleasesFixNamesGroup extends Command
|
||||
LIMIT %s",
|
||||
escapeString($guidChar),
|
||||
NameFixingService::IS_RENAMED_NONE,
|
||||
Nfo::NFO_UNPROC,
|
||||
Nfo::NFO_FOUND,
|
||||
NfoService::NFO_UNPROC,
|
||||
NfoService::NFO_FOUND,
|
||||
NameFixingService::PROC_NFO_NONE,
|
||||
NameFixingService::PROC_FILES_NONE,
|
||||
NameFixingService::PROC_UID_NONE,
|
||||
|
||||
@@ -9,9 +9,9 @@ use App\Models\UsenetGroup;
|
||||
use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use App\Services\Backfill\BackfillService;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use App\Services\NfoService;
|
||||
use App\Services\ReleaseProcessingService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -80,7 +80,7 @@ class UpdatePerGroup extends Command
|
||||
app(AdditionalProcessingOrchestrator::class)->start($groupId);
|
||||
|
||||
$this->info("Processing NFO files for group: {$groupMySQL['name']}");
|
||||
(new Nfo())->processNfoFiles(
|
||||
(new NfoService())->processNfoFiles(
|
||||
$nntp,
|
||||
$groupId,
|
||||
'',
|
||||
|
||||
@@ -16,7 +16,7 @@ use App\Services\Nzb\NzbService;
|
||||
use App\Services\ReleaseImageService;
|
||||
use App\Services\TempWorkspaceService;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use Blacklight\Nfo;
|
||||
use App\Services\NfoService;
|
||||
use App\Services\ReleaseExtraService;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -78,7 +78,7 @@ class AdditionalProcessingServiceProvider extends ServiceProvider
|
||||
$app->make(ProcessingConfiguration::class),
|
||||
$app->make(ReleaseExtraService::class),
|
||||
new ReleaseImageService(),
|
||||
new Nfo(),
|
||||
new NfoService(),
|
||||
$app->make(NzbService::class),
|
||||
new NameFixingService()
|
||||
);
|
||||
|
||||
@@ -13,8 +13,8 @@ use App\Services\AdditionalProcessing\Config\ProcessingConfiguration;
|
||||
use App\Services\AdditionalProcessing\DTO\ReleaseProcessingContext;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use App\Services\NameFixing\ReleaseUpdateService;
|
||||
use App\Services\NfoService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use App\Services\ReleaseExtraService;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -32,7 +32,7 @@ class ReleaseFileManager
|
||||
private readonly ProcessingConfiguration $config,
|
||||
private readonly ReleaseExtraService $releaseExtra,
|
||||
private readonly ReleaseImageService $releaseImage,
|
||||
private readonly Nfo $nfo,
|
||||
private readonly NfoService $nfo,
|
||||
private readonly NzbService $nzb,
|
||||
private readonly NameFixingService $nameFixingService
|
||||
) {}
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Services\Runners\BackfillRunner;
|
||||
use App\Services\Runners\BinariesRunner;
|
||||
use App\Services\Runners\PostProcessRunner;
|
||||
use App\Services\Runners\ReleasesRunner;
|
||||
use Blacklight\Nfo;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Process\Process;
|
||||
@@ -40,7 +39,7 @@ class ForkingService
|
||||
$this->minSize = (int) Settings::settingValue('minsizetoprocessnfo');
|
||||
$this->maxRetries = (int) Settings::settingValue('maxnforetries') >= 0
|
||||
? -((int) Settings::settingValue('maxnforetries') + 1)
|
||||
: Nfo::NFO_UNPROC;
|
||||
: NfoService::NFO_UNPROC;
|
||||
$this->maxRetries = max($this->maxRetries, -8);
|
||||
|
||||
// Initialize runners
|
||||
|
||||
@@ -4,13 +4,12 @@ namespace App\Services;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
|
||||
class NfoProcessor
|
||||
{
|
||||
private Nfo $nfo;
|
||||
private NfoService $nfo;
|
||||
|
||||
public function __construct(Nfo $nfo, bool $echooutput)
|
||||
public function __construct(NfoService $nfo, bool $echooutput)
|
||||
{
|
||||
$this->nfo = $nfo;
|
||||
// echooutput kept for signature parity
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace App\Services\Nzb;
|
||||
|
||||
use App\Models\Release;
|
||||
use App\Models\Settings;
|
||||
use App\Services\NfoService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use App\Services\PostProcessService;
|
||||
use Blacklight\Nfo;
|
||||
|
||||
/**
|
||||
* Service for processing NZB contents - extracting NFO files, PAR2 information,
|
||||
@@ -22,7 +22,7 @@ class NzbContentsService
|
||||
|
||||
protected NNTPService $nntp;
|
||||
|
||||
protected Nfo $nfo;
|
||||
protected NfoService $nfo;
|
||||
|
||||
protected PostProcessService $postProcessService;
|
||||
|
||||
@@ -36,14 +36,14 @@ class NzbContentsService
|
||||
?NzbService $nzbService = null,
|
||||
?NzbParserService $parserService = null,
|
||||
?NNTPService $nntp = null,
|
||||
?Nfo $nfo = null,
|
||||
?NfoService $nfo = null,
|
||||
?PostProcessService $postProcessService = null
|
||||
) {
|
||||
$this->echoOutput = (bool) config('nntmux.echocli');
|
||||
$this->nzbService = $nzbService ?? app(NzbService::class);
|
||||
$this->parserService = $parserService ?? app(NzbParserService::class);
|
||||
$this->nntp = $nntp ?? new NNTPService();
|
||||
$this->nfo = $nfo ?? new Nfo();
|
||||
$this->nfo = $nfo ?? new NfoService();
|
||||
$this->postProcessService = $postProcessService ?? app(PostProcessService::class);
|
||||
$this->lookupPar2 = (int) Settings::settingValue('lookuppar2') === 1;
|
||||
$this->alternateNntp = (bool) config('nntmux_nntp.use_alternate_nntp_server');
|
||||
@@ -71,7 +71,7 @@ class NzbContentsService
|
||||
echo '-';
|
||||
}
|
||||
// Make sure we set status to NFO_NONFO
|
||||
Release::query()->where('id', $relID)->update(['nfostatus' => Nfo::NFO_NONFO]);
|
||||
Release::query()->where('id', $relID)->update(['nfostatus' => NfoService::NFO_NONFO]);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class NzbContentsService
|
||||
if ($this->echoOutput) {
|
||||
echo '-';
|
||||
}
|
||||
Release::query()->where('id', $relID)->update(['nfostatus' => Nfo::NFO_NONFO]);
|
||||
Release::query()->where('id', $relID)->update(['nfostatus' => NfoService::NFO_NONFO]);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ class NzbContentsService
|
||||
// If NFO check was requested but nothing suitable was found
|
||||
if ($nfoCheck && $nfoMessageId === null) {
|
||||
// Update status to indicate no NFO was found in the NZB structure
|
||||
Release::query()->where('id', $relID)->update(['nfostatus' => Nfo::NFO_NONFO]);
|
||||
Release::query()->where('id', $relID)->update(['nfostatus' => NfoService::NFO_NONFO]);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class NzbContentsService
|
||||
/**
|
||||
* Set NFO handler instance.
|
||||
*/
|
||||
public function setNfo(Nfo $nfo): void
|
||||
public function setNfo(NfoService $nfo): void
|
||||
{
|
||||
$this->nfo = $nfo;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace App\Services;
|
||||
use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use dariusiii\rarinfo\Par2Info;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
@@ -29,7 +28,7 @@ final class PostProcessService
|
||||
|
||||
private readonly NameFixingService $nameFixingService;
|
||||
private readonly Par2Info $par2Info;
|
||||
private readonly Nfo $nfo;
|
||||
private readonly NfoService $nfo;
|
||||
|
||||
private readonly Par2Processor $par2Processor;
|
||||
private readonly TvProcessor $tvProcessor;
|
||||
@@ -45,7 +44,7 @@ final class PostProcessService
|
||||
public function __construct(
|
||||
?NameFixingService $nameFixingService = null,
|
||||
?Par2Info $par2Info = null,
|
||||
?Nfo $nfo = null,
|
||||
?NfoService $nfo = null,
|
||||
?Par2Processor $par2Processor = null,
|
||||
?TvProcessor $tvProcessor = null,
|
||||
?NfoProcessor $nfoProcessor = null,
|
||||
@@ -64,7 +63,7 @@ final class PostProcessService
|
||||
// Core dependencies
|
||||
$this->nameFixingService = $nameFixingService ?? new NameFixingService();
|
||||
$this->par2Info = $par2Info ?? new Par2Info();
|
||||
$this->nfo = $nfo ?? new Nfo();
|
||||
$this->nfo = $nfo ?? new NfoService();
|
||||
|
||||
// Processors
|
||||
$this->par2Processor = $par2Processor ?? new Par2Processor(
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Services\Runners;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Services\NfoService;
|
||||
use Illuminate\Support\Facades\Concurrency;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -90,7 +91,7 @@ class PostProcessRunner extends BaseRunner
|
||||
return;
|
||||
}
|
||||
|
||||
$nfoQuery = \Blacklight\Nfo::NfoQueryString();
|
||||
$nfoQuery = NfoService::NfoQueryString();
|
||||
|
||||
$checkSql = 'SELECT r.id FROM releases r WHERE 1=1 '.$nfoQuery.' LIMIT 1';
|
||||
if (count(DB::select($checkSql)) === 0) {
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Services\Tmux;
|
||||
use App\Models\Category;
|
||||
use App\Models\Settings;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use Blacklight\Nfo;
|
||||
use App\Services\NfoService;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -329,10 +329,10 @@ class Tmux
|
||||
Category::PC_GAMES,
|
||||
Category::XXX_ROOT,
|
||||
Category::XXX_X264,
|
||||
Nfo::NfoQueryString(),
|
||||
NfoService::NfoQueryString(),
|
||||
NameFixingService::IS_RENAMED_NONE,
|
||||
Nfo::NFO_UNPROC,
|
||||
Nfo::NFO_FOUND,
|
||||
NfoService::NFO_UNPROC,
|
||||
NfoService::NFO_FOUND,
|
||||
NameFixingService::PROC_NFO_NONE,
|
||||
NameFixingService::PROC_FILES_NONE,
|
||||
NameFixingService::PROC_PAR2_NONE,
|
||||
|
||||
Reference in New Issue
Block a user