mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Move NNTP to services
This commit is contained in:
-1330
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ namespace Blacklight;
|
||||
|
||||
use App\Models\Release;
|
||||
use App\Models\Settings;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use App\Services\PostProcessService;
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ use App\Services\PostProcessService;
|
||||
*/
|
||||
class NZBContents
|
||||
{
|
||||
protected NNTP $nntp;
|
||||
protected NNTPService $nntp;
|
||||
|
||||
protected Nfo $nfo;
|
||||
|
||||
@@ -32,7 +33,7 @@ class NZBContents
|
||||
public function __construct()
|
||||
{
|
||||
$this->echooutput = (bool) config('nntmux.echocli');
|
||||
$this->nntp = new NNTP();
|
||||
$this->nntp = new NNTPService();
|
||||
$this->nfo = new Nfo();
|
||||
$this->postProcessService = app(PostProcessService::class);
|
||||
$this->nzb = new NZB();
|
||||
|
||||
+5
-4
@@ -8,6 +8,7 @@ use App\Models\Release;
|
||||
use App\Models\ReleaseNfo;
|
||||
use App\Models\Settings;
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use App\Services\PostProcessService;
|
||||
use dariusiii\rarinfo\Par2Info;
|
||||
use dariusiii\rarinfo\SfvInfo;
|
||||
@@ -456,12 +457,12 @@ class Nfo
|
||||
* Add an NFO from alternate sources. ex.: PreDB, rar, zip, etc...
|
||||
*
|
||||
* @param string $nfo The nfo.
|
||||
* @param NNTP $nntp Instance of class NNTP.
|
||||
* @param NNTPService $nntp Instance of class NNTPService.
|
||||
* @return bool True on success, False on failure.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addAlternateNfo(string &$nfo, $release, NNTP $nntp): bool
|
||||
public function addAlternateNfo(string &$nfo, $release, NNTPService $nntp): bool
|
||||
{
|
||||
if ($release->id > 0 && $this->isNFO($nfo, $release->guid)) {
|
||||
$check = ReleaseNfo::whereReleasesId($release->id)->first(['releases_id']);
|
||||
@@ -498,7 +499,7 @@ class Nfo
|
||||
/**
|
||||
* Attempt to find NFO files inside the NZB's of releases.
|
||||
*
|
||||
* @param NNTP $nntp The NNTP connection object
|
||||
* @param NNTPService $nntp The NNTP connection object
|
||||
* @param string $groupID (optional) Group ID to filter releases by
|
||||
* @param string $guidChar (optional) First character of the GUID for parallel processing
|
||||
* @param bool $processImdb (optional) Process IMDB IDs (currently unused)
|
||||
@@ -507,7 +508,7 @@ class Nfo
|
||||
*
|
||||
* @throws \Exception If NNTP operations fail
|
||||
*/
|
||||
public function processNfoFiles(NNTP $nntp, string $groupID = '', string $guidChar = '', bool $processImdb = true, bool $processTv = true): int
|
||||
public function processNfoFiles(NNTPService $nntp, string $groupID = '', string $guidChar = '', bool $processImdb = true, bool $processTv = true): int
|
||||
{
|
||||
$processedCount = 0;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Services\Backfill\BackfillService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -64,9 +65,9 @@ class BackfillGroup extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): \Blacklight\NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new \Blacklight\NNTP;
|
||||
$nntp = new NNTPService;
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
? $nntp->doConnect(false, true)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class FixReleaseNames extends Command
|
||||
@@ -30,7 +30,7 @@ class FixReleaseNames extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(NameFixingService $nameFixingService, NNTP $nntp): int
|
||||
public function handle(NameFixingService $nameFixingService, NNTPService $nntp): int
|
||||
{
|
||||
$method = $this->argument('method');
|
||||
$update = (bool) $this->option('update');
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\Console\Commands;
|
||||
use App\Models\Settings;
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -56,8 +56,8 @@ class GetArticleRange extends Command
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
if (NNTP::isError($nntp->selectGroup($groupMySQL['name']))
|
||||
&& NNTP::isError($nntp->dataError($nntp, $groupMySQL['name']))) {
|
||||
if (NNTPService::isError($nntp->selectGroup($groupMySQL['name']))
|
||||
&& NNTPService::isError($nntp->dataError($nntp, $groupMySQL['name']))) {
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
@@ -139,9 +139,9 @@ class GetArticleRange extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP;
|
||||
$nntp = new NNTPService;
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
? $nntp->doConnect(false, true)
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Models\ShortGroup;
|
||||
use App\Models\UsenetGroup;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -33,7 +33,7 @@ class GroupsUpdate extends Command
|
||||
$start = now();
|
||||
|
||||
// Create NNTP connection
|
||||
$nntp = new NNTP;
|
||||
$nntp = new NNTPService;
|
||||
if ($nntp->doConnect() !== true) {
|
||||
$this->error('❌ Unable to connect to usenet server');
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -44,7 +44,7 @@ class PartRepair extends Command
|
||||
|
||||
$data = $nntp->selectGroup($groupMySQL['name']);
|
||||
|
||||
if (NNTP::isError($data) && $nntp->dataError($nntp, $groupMySQL['name']) === false) {
|
||||
if (NNTPService::isError($data) && $nntp->dataError($nntp, $groupMySQL['name']) === false) {
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ class PartRepair extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP;
|
||||
$nntp = new NNTPService;
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
? $nntp->doConnect(false, true)
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace App\Console\Commands;
|
||||
use App\Models\Settings;
|
||||
use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use App\Services\PostProcessService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Blacklight\NNTP;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -113,9 +113,9 @@ class PostProcessGuid extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP();
|
||||
$nntp = new NNTPService();
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
? $nntp->doConnect(false, true)
|
||||
|
||||
@@ -9,8 +9,8 @@ use App\Models\Predb;
|
||||
use App\Models\Release;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use App\Services\PostProcessService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Blacklight\NNTP;
|
||||
use Blacklight\NZBContents;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -211,7 +211,7 @@ class ReleasesFixNamesGroup extends Command
|
||||
if ((int) $release->proc_par2 === NameFixingService::PROC_PAR2_NONE) {
|
||||
// Initialize NZB contents if needed
|
||||
if (! isset($nzbcontents)) {
|
||||
$nntp = new NNTP();
|
||||
$nntp = new NNTPService();
|
||||
$compressedHeaders = config('nntmux_nntp.compressed_headers');
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\Backfill\BackfillService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class UpdateBackfill extends Command
|
||||
@@ -72,9 +72,9 @@ class UpdateBackfill extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP;
|
||||
$nntp = new NNTPService;
|
||||
|
||||
if ($nntp->doConnect() !== true) {
|
||||
throw new \Exception('Unable to connect to usenet.');
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace App\Console\Commands;
|
||||
use App\Models\Settings;
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\NNTP;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -97,9 +97,9 @@ class UpdateBinaries extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP();
|
||||
$nntp = new NNTPService();
|
||||
|
||||
if ($nntp->doConnect() !== true) {
|
||||
throw new \RuntimeException('Unable to connect to usenet.');
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -57,9 +57,9 @@ class UpdateGroupHeaders extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP;
|
||||
$nntp = new NNTPService;
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
? $nntp->doConnect(false, true)
|
||||
|
||||
@@ -10,8 +10,8 @@ use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use App\Services\Backfill\BackfillService;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use App\Services\ReleaseProcessingService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Blacklight\NNTP;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -125,9 +125,9 @@ class UpdatePerGroup extends Command
|
||||
*
|
||||
* @throws \Exception If unable to connect to usenet
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP();
|
||||
$nntp = new NNTPService();
|
||||
|
||||
$useAlternate = config('nntmux_nntp.use_alternate_nntp_server') === true;
|
||||
$connected = $useAlternate
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\PostProcessService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class UpdatePostProcess extends Command
|
||||
@@ -129,9 +129,9 @@ class UpdatePostProcess extends Command
|
||||
/**
|
||||
* Get NNTP connection.
|
||||
*/
|
||||
private function getNntp(): NNTP
|
||||
private function getNntp(): NNTPService
|
||||
{
|
||||
$nntp = new NNTP();
|
||||
$nntp = new NNTPService();
|
||||
|
||||
if ((config('nntmux_nntp.use_alternate_nntp_server') === true
|
||||
? $nntp->doConnect(false, true)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\ReleaseImageService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\NNTP;
|
||||
use Blacklight\NZB;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -426,7 +426,7 @@ class UsenetGroup extends Model
|
||||
if (preg_match('/^\s*$/m', $groupList)) {
|
||||
$ret = 'No group list provided.';
|
||||
} else {
|
||||
$nntp = new NNTP(['Echo' => false]);
|
||||
$nntp = new NNTPService();
|
||||
if ($nntp->doConnect() !== true) {
|
||||
return 'Problem connecting to usenet.';
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ class ReleaseFileManager
|
||||
public function processNfoFile(
|
||||
string $fileLocation,
|
||||
ReleaseProcessingContext $context,
|
||||
\Blacklight\NNTP $nntp
|
||||
NNTPService $nntp
|
||||
): bool {
|
||||
try {
|
||||
$data = File::get($fileLocation);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Services\AdditionalProcessing;
|
||||
|
||||
use App\Services\AdditionalProcessing\Config\ProcessingConfiguration;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -13,12 +13,12 @@ use Illuminate\Support\Facades\Log;
|
||||
*/
|
||||
class UsenetDownloadService
|
||||
{
|
||||
private NNTP $nntp;
|
||||
private NNTPService $nntp;
|
||||
|
||||
public function __construct(
|
||||
private readonly ProcessingConfiguration $config
|
||||
) {
|
||||
$this->nntp = new NNTP();
|
||||
$this->nntp = new NNTPService();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ class UsenetDownloadService
|
||||
/**
|
||||
* Get the NNTP client instance.
|
||||
*/
|
||||
public function getNNTP(): NNTP
|
||||
public function getNNTP(): NNTPService
|
||||
{
|
||||
return $this->nntp;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Services\Backfill;
|
||||
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\Binaries\BinariesService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\NNTP;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -28,19 +28,19 @@ final class BackfillService
|
||||
|
||||
private BinariesService $binaries;
|
||||
|
||||
private NNTP $nntp;
|
||||
private NNTPService $nntp;
|
||||
|
||||
private ColorCLI $colorCli;
|
||||
|
||||
public function __construct(
|
||||
?BackfillConfig $config = null,
|
||||
?BinariesService $binaries = null,
|
||||
?NNTP $nntp = null,
|
||||
?NNTPService $nntp = null,
|
||||
?ColorCLI $colorCli = null,
|
||||
) {
|
||||
$this->config = $config ?? BackfillConfig::fromSettings();
|
||||
$this->binaries = $binaries ?? new BinariesService;
|
||||
$this->nntp = $nntp ?? new NNTP;
|
||||
$this->nntp = $nntp ?? new NNTPService;
|
||||
$this->colorCli = $colorCli ?? new ColorCLI;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Services\Binaries;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\NNTP;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -34,7 +34,7 @@ class BinariesService
|
||||
|
||||
private ColorCLI $colorCli;
|
||||
|
||||
private ?NNTP $nntp = null;
|
||||
private ?NNTPService $nntp = null;
|
||||
|
||||
// Timing metrics
|
||||
private float $timeHeaders = 0;
|
||||
@@ -70,7 +70,7 @@ class BinariesService
|
||||
?HeaderStorageService $headerStorage = null,
|
||||
?MissedPartHandler $missedPartHandler = null,
|
||||
?ColorCLI $colorCli = null,
|
||||
?NNTP $nntp = null
|
||||
?NNTPService $nntp = null
|
||||
) {
|
||||
$this->config = $config ?? BinariesConfig::fromSettings();
|
||||
$this->headerParser = $headerParser ?? new HeaderParser;
|
||||
@@ -87,7 +87,7 @@ class BinariesService
|
||||
/**
|
||||
* Set NNTP connection (for external injection).
|
||||
*/
|
||||
public function setNntp(NNTP $nntp): void
|
||||
public function setNntp(NNTPService $nntp): void
|
||||
{
|
||||
$this->nntp = $nntp;
|
||||
}
|
||||
@@ -95,10 +95,10 @@ class BinariesService
|
||||
/**
|
||||
* Get the NNTP connection, creating one if needed.
|
||||
*/
|
||||
public function getNntp(): NNTP
|
||||
public function getNntp(): NNTPService
|
||||
{
|
||||
if ($this->nntp === null) {
|
||||
$this->nntp = new NNTP;
|
||||
$this->nntp = new NNTPService;
|
||||
}
|
||||
|
||||
return $this->nntp;
|
||||
@@ -432,7 +432,7 @@ class BinariesService
|
||||
|
||||
// Try usenet
|
||||
$header = $nntp->getXOVER((string) $currentPost);
|
||||
if (! NNTP::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') {
|
||||
if (! NNTPService::isError($header) && isset($header[0]['Date']) && $header[0]['Date'] !== '') {
|
||||
$date = $header[0]['Date'];
|
||||
break;
|
||||
}
|
||||
@@ -484,18 +484,18 @@ class BinariesService
|
||||
|
||||
// ==================== Private Helper Methods ====================
|
||||
|
||||
private function selectNntpGroup(array &$groupMySQL, NNTP $nntp): ?array
|
||||
private function selectNntpGroup(array &$groupMySQL, NNTPService $nntp): ?array
|
||||
{
|
||||
$groupNNTP = $nntp->selectGroup($groupMySQL['name']);
|
||||
|
||||
if (NNTP::isError($groupNNTP)) {
|
||||
if (NNTPService::isError($groupNNTP)) {
|
||||
$groupNNTP = $nntp->dataError($nntp, $groupMySQL['name']);
|
||||
|
||||
if (isset($groupNNTP['code']) && (int) $groupNNTP['code'] === 411) {
|
||||
UsenetGroup::disableIfNotExist($groupMySQL['id']);
|
||||
}
|
||||
|
||||
if (NNTP::isError($groupNNTP)) {
|
||||
if (NNTPService::isError($groupNNTP)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -660,7 +660,7 @@ class BinariesService
|
||||
$headers = $nntp->getXOVER($this->first.'-'.$this->last);
|
||||
}
|
||||
|
||||
if (NNTP::isError($headers)) {
|
||||
if (NNTPService::isError($headers)) {
|
||||
if ($partRepair) {
|
||||
return null;
|
||||
}
|
||||
@@ -675,7 +675,7 @@ class BinariesService
|
||||
$headers = $nntp->getXOVER($this->first.'-'.$this->last);
|
||||
$nntp->enableCompression();
|
||||
|
||||
if (NNTP::isError($headers)) {
|
||||
if (NNTPService::isError($headers)) {
|
||||
$message = ((int) $headers->code === 0 ? 'Unknown error' : $headers->message);
|
||||
$this->log("Code {$headers->code}: $message\nSkipping group: {$this->groupMySQL['name']}", __FUNCTION__, 'error');
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Services\NameFixing\Contracts\NameSourceFixerInterface;
|
||||
use App\Services\NameFixing\DTO\NameFixResult;
|
||||
use App\Services\NameFixing\Extractors\NfoNameExtractor;
|
||||
use App\Services\NameFixing\Extractors\FileNameExtractor;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use App\Services\Search\ElasticSearchService;
|
||||
use App\Services\Search\ManticoreSearchService;
|
||||
use Blacklight\ColorCLI;
|
||||
@@ -956,7 +957,7 @@ class NameFixingService
|
||||
/**
|
||||
* Fix names using PAR2 files (requires NNTP connection).
|
||||
*/
|
||||
public function fixNamesWithPar2(int $time, bool $echo, int $cats, bool $nameStatus, bool $show, \Blacklight\NNTP $nntp): void
|
||||
public function fixNamesWithPar2(int $time, bool $echo, int $cats, bool $nameStatus, bool $show, NNTPService $nntp): void
|
||||
{
|
||||
$this->echoStartMessage($time, 'par2 files');
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Settings;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Blacklight\NNTP;
|
||||
|
||||
class NfoProcessor
|
||||
{
|
||||
@@ -19,7 +19,7 @@ class NfoProcessor
|
||||
/**
|
||||
* Process NFO files if enabled by settings.
|
||||
*/
|
||||
public function process(NNTP $nntp, string $groupID = '', string $guidChar = ''): void
|
||||
public function process(NNTPService $nntp, string $groupID = '', string $guidChar = ''): void
|
||||
{
|
||||
if ((int) Settings::settingValue('lookupnfo') === 1) {
|
||||
$this->nfo->processNfoFiles(
|
||||
|
||||
@@ -7,7 +7,7 @@ use App\Models\Release;
|
||||
use App\Models\ReleaseFile;
|
||||
use App\Models\UsenetGroup;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use dariusiii\rarinfo\Par2Info;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -38,10 +38,10 @@ class Par2Processor
|
||||
* @param string $messageID MessageID from NZB file.
|
||||
* @param int $relID ID of the release.
|
||||
* @param int $groupID Group ID of the release.
|
||||
* @param NNTP $nntp Class NNTP
|
||||
* @param NNTPService $nntp Class NNTPService
|
||||
* @param int $show Only show result or apply it.
|
||||
*/
|
||||
public function parseFromMessage(string $messageID, int $relID, int $groupID, NNTP $nntp, int $show): bool
|
||||
public function parseFromMessage(string $messageID, int $relID, int $groupID, NNTPService $nntp, int $show): bool
|
||||
{
|
||||
if ($messageID === '') {
|
||||
return false;
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace App\Services;
|
||||
|
||||
use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\Nfo;
|
||||
use Blacklight\NNTP;
|
||||
use dariusiii\rarinfo\Par2Info;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
@@ -179,13 +179,13 @@ final class PostProcessService
|
||||
/**
|
||||
* Process NFO files for releases.
|
||||
*
|
||||
* @param NNTP $nntp NNTP connection for downloading NFOs
|
||||
* @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(NNTP $nntp, string $groupID = '', string $guidChar = ''): void
|
||||
public function processNfos(NNTPService $nntp, string $groupID = '', string $guidChar = ''): void
|
||||
{
|
||||
$this->nfoProcessor->process($nntp, $groupID, $guidChar);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ final class PostProcessService
|
||||
* @param string $messageID Message ID from NZB
|
||||
* @param int $relID Release ID
|
||||
* @param int $groupID Group ID
|
||||
* @param NNTP $nntp NNTP connection
|
||||
* @param NNTPService $nntp NNTP connection
|
||||
* @param int $show Display mode (0=apply, 1=show only)
|
||||
*
|
||||
* @throws \Exception
|
||||
@@ -257,7 +257,7 @@ final class PostProcessService
|
||||
string $messageID,
|
||||
int $relID,
|
||||
int $groupID,
|
||||
NNTP $nntp,
|
||||
NNTPService $nntp,
|
||||
int $show
|
||||
): bool {
|
||||
return $this->par2Processor->parseFromMessage($messageID, $relID, $groupID, $nntp, $show);
|
||||
|
||||
@@ -17,9 +17,9 @@ use App\Services\Releases\ReleaseManagementService;
|
||||
use App\Support\DTOs\ProcessReleasesSettings;
|
||||
use App\Support\DTOs\ReleaseCreationResult;
|
||||
use App\Support\DTOs\ReleaseDeleteStats;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\Genres;
|
||||
use Blacklight\NNTP;
|
||||
use Blacklight\NZB;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -177,7 +177,7 @@ final class ReleaseProcessingService
|
||||
* @param int $categorize Categorization type (1=name, 2=searchname)
|
||||
* @param int $postProcess Whether to run post-processing (1=yes)
|
||||
* @param string $groupName Optional group name to filter processing
|
||||
* @param NNTP $nntp NNTP connection for post-processing
|
||||
* @param NNTPService $nntp NNTP connection for post-processing
|
||||
* @return int Total number of releases added
|
||||
*
|
||||
* @throws Throwable
|
||||
@@ -186,7 +186,7 @@ final class ReleaseProcessingService
|
||||
int $categorize,
|
||||
int $postProcess,
|
||||
string $groupName,
|
||||
NNTP $nntp
|
||||
NNTPService $nntp
|
||||
): int {
|
||||
$this->echoCLI = (bool) config('nntmux.echocli');
|
||||
$overallStartTime = now()->toImmutable();
|
||||
@@ -238,7 +238,7 @@ final class ReleaseProcessingService
|
||||
?int $normalizedGroupId,
|
||||
int $categorize,
|
||||
int $postProcess,
|
||||
NNTP $nntp
|
||||
NNTPService $nntp
|
||||
): array {
|
||||
$totals = ['releases' => 0, 'nzbs' => 0, 'dupes' => 0, 'iterations' => 0];
|
||||
$limit = $this->settings->releaseCreationLimit;
|
||||
@@ -537,7 +537,7 @@ final class ReleaseProcessingService
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function postProcessReleases(int $postProcess, NNTP $nntp): void
|
||||
public function postProcessReleases(int $postProcess, NNTPService $nntp): void
|
||||
{
|
||||
if ($postProcess !== 1) {
|
||||
return;
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
|
||||
|
||||
use App\Services\NameFixing\NameFixingService;
|
||||
use Blacklight\NNTP;
|
||||
use App\Services\NNTP\NNTPService;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
$output = new ConsoleOutput;
|
||||
$nameFixingService = new NameFixingService;
|
||||
$nntp = new NNTP;
|
||||
$nntp = new NNTPService;
|
||||
|
||||
if (isset($argv[1], $argv[2], $argv[3], $argv[4])) {
|
||||
$update = $argv[2] === 'true';
|
||||
|
||||
Reference in New Issue
Block a user