mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Improve release indexng on release update
This commit is contained in:
@@ -62,7 +62,9 @@ class NntmuxRemoveBadReleases extends Command
|
||||
|
||||
$count = 0;
|
||||
foreach ($passReleases as $passRelease) {
|
||||
Release::whereId($passRelease->releases_id)->update(['passwordstatus' => 1]);
|
||||
$releasesId = (int) $passRelease->releases_id;
|
||||
Release::whereId($releasesId)->update(['passwordstatus' => 1]);
|
||||
Search::updateRelease($releasesId);
|
||||
$count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Search;
|
||||
use App\Models\Category;
|
||||
use App\Models\Release;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -89,6 +90,7 @@ class NntmuxResetPostProcessing extends Command
|
||||
'nfostatus' => -1,
|
||||
]
|
||||
);
|
||||
Search::updateRelease((int) $releases->id);
|
||||
$bar->advance();
|
||||
}
|
||||
$bar->finish();
|
||||
@@ -244,6 +246,7 @@ class NntmuxResetPostProcessing extends Command
|
||||
'movieinfo_id' => null,
|
||||
'imdbid' => null,
|
||||
]);
|
||||
Search::updateRelease((int) $releases->id);
|
||||
$bar->advance();
|
||||
}
|
||||
$bar->finish();
|
||||
@@ -337,6 +340,7 @@ class NntmuxResetPostProcessing extends Command
|
||||
'videos_id' => 0,
|
||||
'tv_episodes_id' => 0,
|
||||
]);
|
||||
Search::updateRelease((int) $releases->id);
|
||||
$bar->advance();
|
||||
}
|
||||
$bar->finish();
|
||||
@@ -365,6 +369,7 @@ class NntmuxResetPostProcessing extends Command
|
||||
'audiostatus' => 0,
|
||||
'nfostatus' => -1,
|
||||
]);
|
||||
Search::updateRelease((int) $releases->id);
|
||||
$bar->advance();
|
||||
}
|
||||
$bar->finish();
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Search;
|
||||
use App\Models\Category;
|
||||
use App\Models\Release;
|
||||
use App\Models\Video;
|
||||
@@ -71,6 +72,7 @@ class NntmuxResetTvShowPostProcessing extends Command
|
||||
'videos_id' => 0,
|
||||
'tv_episodes_id' => 0,
|
||||
]);
|
||||
Search::updateRelease((int) $release->id);
|
||||
$bar->advance();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Search;
|
||||
use App\Models\Release;
|
||||
use App\Services\AdditionalProcessing\AdditionalProcessingOrchestrator;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -75,6 +76,7 @@ class ProcessAdditionalGuid extends Command
|
||||
'audiostatus' => 0,
|
||||
'nfostatus' => -1,
|
||||
]);
|
||||
Search::updateRelease((int) $release->id);
|
||||
$this->info('Reset postprocessing flags for release ID '.$release->id.' (GUID '.$guid.')');
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Facades\Search;
|
||||
use App\Models\Category;
|
||||
use App\Models\Release;
|
||||
use App\Services\Categorization\CategorizationService;
|
||||
@@ -92,6 +93,8 @@ class RecategorizeReleases extends Command
|
||||
'categories_id' => $catId['categories_id'],
|
||||
]);
|
||||
|
||||
Search::updateRelease((int) $result->id);
|
||||
|
||||
/** @var Category|null $newCatName */
|
||||
$newCatName = Category::query()->where('id', $catId['categories_id'])->first();
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Facades\Search;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\MovieInfo;
|
||||
use App\Models\Release;
|
||||
use App\Services\MovieService;
|
||||
use App\Support\ReleaseSearchIndexSync;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
@@ -87,6 +89,7 @@ class AdminMovieController extends BasePageController
|
||||
if ($movieInfoId !== null) {
|
||||
foreach ($forUpdate as $rel) {
|
||||
Release::query()->where('id', $rel->id)->update(['movieinfo_id' => $movieInfoId->id]);
|
||||
Search::updateRelease((int) $rel->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,6 +200,9 @@ class AdminMovieController extends BasePageController
|
||||
$movieInfo = MovieInfo::query()->where('imdbid', $id)->first(['id']);
|
||||
if ($movieInfo !== null) {
|
||||
Release::query()->where('imdbid', $id)->update(['movieinfo_id' => $movieInfo->id]);
|
||||
ReleaseSearchIndexSync::forIds(
|
||||
Release::query()->where('imdbid', $id)->pluck('id')
|
||||
);
|
||||
}
|
||||
|
||||
return redirect()->to('admin/movie-list')
|
||||
|
||||
+15
-1
@@ -255,7 +255,11 @@ class Release extends Model
|
||||
{
|
||||
$updateGrabs = ((int) Settings::settingValue('grabstatus') !== 0);
|
||||
if ($updateGrabs) {
|
||||
$id = self::whereGuid($guid)->value('id');
|
||||
self::whereGuid($guid)->increment('grabs');
|
||||
if ($id !== null) {
|
||||
Search::updateRelease((int) $id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +277,11 @@ class Release extends Model
|
||||
}
|
||||
$updateGrabs = ((int) Settings::settingValue('grabstatus') !== 0);
|
||||
if ($updateGrabs) {
|
||||
$ids = self::query()->whereIn('guid', $guids)->pluck('id');
|
||||
self::query()->whereIn('guid', $guids)->increment('grabs');
|
||||
foreach ($ids as $id) {
|
||||
Search::updateRelease((int) $id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +295,13 @@ class Release extends Model
|
||||
|
||||
public static function removeVideoIdFromReleases(mixed $videoId): int
|
||||
{
|
||||
return self::whereVideosId($videoId)->update(['videos_id' => 0, 'tv_episodes_id' => 0]);
|
||||
$ids = self::whereVideosId($videoId)->pluck('id');
|
||||
$updated = self::whereVideosId($videoId)->update(['videos_id' => 0, 'tv_episodes_id' => 0]);
|
||||
foreach ($ids as $id) {
|
||||
Search::updateRelease((int) $id);
|
||||
}
|
||||
|
||||
return $updated;
|
||||
}
|
||||
|
||||
public static function removeAnidbIdFromReleases(mixed $anidbID): int
|
||||
|
||||
@@ -190,6 +190,8 @@ class ReleaseFileManager
|
||||
$updateRows['rarinnerfilecount'] = $releaseFilesCount;
|
||||
Release::query()->where('id', $context->release->id)->update($updateRows);
|
||||
}
|
||||
|
||||
Search::updateRelease((int) $context->release->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,6 +223,8 @@ class ReleaseFileManager
|
||||
'passwordstatus' => ReleaseBrowseService::PASSWD_NONE,
|
||||
]);
|
||||
|
||||
Search::updateRelease((int) $release->id);
|
||||
|
||||
Log::warning('Release '.$release->id.' skipped after post-processing timeout ('.$newCount.'/'.$maxTimeoutCount.')');
|
||||
|
||||
return false;
|
||||
|
||||
@@ -485,6 +485,7 @@ class BookService
|
||||
cli()->headerOver('Changing category to misc books: ').cli()->primary($releasename);
|
||||
}
|
||||
Release::query()->where('id', $releaseID)->update(['categories_id' => Category::BOOKS_UNKNOWN]);
|
||||
Search::updateRelease((int) $releaseID);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -494,6 +495,7 @@ class BookService
|
||||
cli()->headerOver('Changing category to magazines: ').cli()->primary($releasename);
|
||||
}
|
||||
Release::query()->where('id', $releaseID)->update(['categories_id' => Category::BOOKS_MAGAZINES]);
|
||||
Search::updateRelease((int) $releaseID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@ declare(strict_types=1);
|
||||
namespace App\Services;
|
||||
|
||||
use aharen\OMDbAPI;
|
||||
use App\Facades\Search;
|
||||
use App\Models\Category;
|
||||
use App\Models\MovieInfo;
|
||||
use App\Models\Release;
|
||||
use App\Models\Settings;
|
||||
use App\Services\Releases\ReleaseBrowseService;
|
||||
use App\Services\TvProcessing\Providers\TraktProvider;
|
||||
use App\Support\ReleaseSearchIndexSync;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -991,6 +993,8 @@ class MovieService
|
||||
'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null,
|
||||
]);
|
||||
|
||||
Search::updateRelease($id);
|
||||
|
||||
if ($processImdb === 1) {
|
||||
$movCheck = $this->getMovieInfo($imdbId);
|
||||
$thirtyDaysInSeconds = 30 * 24 * 60 * 60;
|
||||
@@ -1007,6 +1011,8 @@ class MovieService
|
||||
Release::query()->where('id', $id)->update([
|
||||
'movieinfo_id' => $freshMovieInfo !== null ? $freshMovieInfo['id'] : null,
|
||||
]);
|
||||
|
||||
Search::updateRelease($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,6 +1132,7 @@ class MovieService
|
||||
|
||||
foreach (array_chunk($failedIDs, 100) as $chunk) {
|
||||
Release::query()->whereIn('id', $chunk)->update(['imdbid' => '']);
|
||||
ReleaseSearchIndexSync::forIds($chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,6 +339,7 @@ class ReleaseUpdateService
|
||||
{
|
||||
if ($column !== '' && $id !== 0) {
|
||||
Release::query()->where('id', $id)->update([$column => $status]);
|
||||
Search::updateRelease($id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ use App\Services\Releases\ReleaseManagementService;
|
||||
use App\Support\DTOs\ProcessReleasesSettings;
|
||||
use App\Support\DTOs\ReleaseCreationResult;
|
||||
use App\Support\DTOs\ReleaseDeleteStats;
|
||||
use App\Support\ReleaseSearchIndexSync;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -291,6 +292,8 @@ final class ReleaseProcessingService
|
||||
'iscategorized' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
ReleaseSearchIndexSync::reindexMatchingWhere($where);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,6 +337,8 @@ final class ReleaseProcessingService
|
||||
'iscategorized' => 1,
|
||||
]);
|
||||
|
||||
ReleaseSearchIndexSync::forIds([(int) $release->id]);
|
||||
|
||||
$categorized++;
|
||||
$this->outputProgress($categorized, $total, 'Categorizing');
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Facades\Search;
|
||||
use App\Models\Release;
|
||||
use App\Services\Nzb\NzbService;
|
||||
use App\Services\ReleaseImageService;
|
||||
use App\Support\ReleaseSearchIndexSync;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -103,7 +104,11 @@ class ReleaseManagementService
|
||||
'imdbid' => $imdbId,
|
||||
];
|
||||
|
||||
return Release::query()->whereIn('guid', $guids)->update($update);
|
||||
$releaseIds = Release::query()->whereIn('guid', $guids)->pluck('id');
|
||||
$updated = Release::query()->whereIn('guid', $guids)->update($update);
|
||||
ReleaseSearchIndexSync::forIds($releaseIds);
|
||||
|
||||
return $updated;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user