echoOutput = (bool) config('nntmux.echocli'); $this->addPar2 = (bool) config('nntmux_settings.add_par2'); $this->alternateNNTP = (bool) config('nntmux_nntp.use_alternate_nntp_server'); // Core dependencies $this->nameFixingService = $nameFixingService ?? new NameFixingService; $this->par2Info = $par2Info ?? new Par2Info; $this->nfo = $nfo ?? new NfoService; // Processors $this->par2Processor = $par2Processor ?? new Par2Processor( $this->nameFixingService, $this->par2Info, $this->addPar2, $this->alternateNNTP ); $this->tvProcessor = $tvProcessor ?? new TvProcessor($this->echoOutput); $this->nfoProcessor = $nfoProcessor ?? new NfoProcessor($this->nfo); $this->moviesProcessor = $moviesProcessor ?? new MoviesProcessor($this->echoOutput); $this->musicProcessor = $musicProcessor ?? new MusicProcessor($this->echoOutput); $this->booksProcessor = $booksProcessor ?? new BooksProcessor($this->echoOutput); $this->consolesProcessor = $consolesProcessor ?? new ConsolesProcessor($this->echoOutput); $this->gamesProcessor = $gamesProcessor ?? new GamesProcessor($this->echoOutput); $this->animeProcessor = $animeProcessor ?? new AnimeProcessor($this->echoOutput); } /** * Run all post-processing types. * * @throws \Exception */ public function processAll(NNTPService $nntp): void { $this->processAdditional(); $this->processNfos($nntp); $this->processMovies(); $this->processMusic(); $this->processConsoles(); $this->processGames(); $this->processAnime(); $this->processTv(); $this->processBooks(); } /** * Process anime releases using AniDB. * * @param string $groupID Optional group ID filter * @param string $guidChar Optional GUID character filter * * @throws \Exception */ public function processAnime(string $groupID = '', string $guidChar = ''): void { $this->animeProcessor->process($groupID, $guidChar); } /** * Process book releases using Amazon. * * @param string $groupID Optional group ID filter * @param string $guidChar Optional GUID character filter * * @throws \Exception */ public function processBooks(string $groupID = '', string $guidChar = ''): void { $this->booksProcessor->process($groupID, $guidChar); } /** * Process console game releases. * * @throws \Exception */ public function processConsoles(): void { $this->consolesProcessor->process(); } /** * Process PC game releases. * * @throws \Exception */ public function processGames(): void { $this->gamesProcessor->process(); } /** * Process movie releases using IMDB/TMDB. * * @param string $groupID Optional group ID filter * @param string $guidChar Optional GUID character filter * @param int|string|null $processMovies Processing mode (0=skip, 1=all, 2=renamed only, ''=check setting) * * @throws \Exception */ public function processMovies( string $groupID = '', string $guidChar = '', int|string|null $processMovies = '' ): void { $this->moviesProcessor->process($groupID, $guidChar, $processMovies); } /** * Process music releases. * * @throws \Exception */ public function processMusic(): void { $this->musicProcessor->process(); } /** * Process NFO files for releases. * * @param NNTPService $nntp NNTP connection for downloading NFOs * @param string $groupID Optional group ID filter * @param string $guidChar Optional GUID character filter * * @throws \Exception */ public function processNfos(NNTPService $nntp, string $groupID = '', string $guidChar = ''): void { $this->nfoProcessor->process($nntp, $groupID, $guidChar); } /** * Process TV releases. * * @param string $groupID Optional group ID filter * @param string $guidChar Optional GUID character filter * @param int|string|null $processTV Processing mode (0=skip, 1=all, 2=renamed only, ''=check setting) * @param string $mode Processing mode ('pipeline' or 'parallel') * * @throws \Exception */ public function processTv( string $groupID = '', string $guidChar = '', int|string|null $processTV = '', string $mode = 'pipeline' ): void { if ($guidChar === '') { $forkingService = new ForkingService; $processTV = is_numeric($processTV) ? $processTV : Settings::settingValue('lookuptv'); $renamedOnly = ((int) $processTV === 2); $forkingService->processTv($renamedOnly); } else { $this->tvProcessor->process($groupID, $guidChar, $processTV, $mode); } } /** * Process additional release data (RAR/ZIP contents, samples, media info). * * @param int|string $groupID Optional group ID filter * @param string $guidChar Optional GUID character filter * * @throws \Exception */ public function processAdditional(int|string $groupID = '', string $guidChar = ''): void { $orchestrator = app(AdditionalProcessingOrchestrator::class); try { $orchestrator->start($groupID, $guidChar); } finally { $orchestrator->finish(); } } /** * Attempt to get a better name from a PAR2 file and re-categorize. * * @param string $messageID Message ID from NZB * @param int $relID Release ID * @param int $groupID Group ID * @param NNTPService $nntp NNTP connection * @param int $show Display mode (0=apply, 1=show only) * * @throws \Exception */ public function parsePAR2( string $messageID, int $relID, int $groupID, NNTPService $nntp, int $show ): bool { return $this->par2Processor->parseFromMessage($messageID, $relID, $groupID, $nntp, $show); } }