some progress on processing

This commit is contained in:
2025-01-27 22:40:26 +02:00
parent e5df18f43e
commit b4df3c216e
17 changed files with 346 additions and 8 deletions
@@ -3,6 +3,8 @@
namespace App\Console\Commands\ItemProcessing;
use App\Models\ItemToFetch;
use App\Models\ItemToFetchJobs;
use App\Models\Movie;
use App\Service\MediaProcessing\FactoryService;
use Illuminate\Console\Command;
@@ -45,9 +47,16 @@ class FetchItemDataCommand extends Command
private function getBatch(string $type, int $batch, string $job)
{
return ItemToFetch::whereHas('jobs', function($query) use ($job){
// if job <> Details the movie in movie table should exist
$query = ItemToFetch::whereHas('jobs', function($query) use ($job){
return $query->where('jobs', '<>', null)->whereRaw('FIND_IN_SET(?, jobs)', [$job]);
})->with(['jobs'])
})->with(['jobs']);
if ($job !== ItemToFetchJobs::JOB_DETAILS) {
$query = $query->join('movies', 'movies.tmdb_id', '=', 'items_to_fetch.tmdb_id');
}
return $query
->where('type', $type)
->take($batch)
->get();