Video size is handled by the queue job.

This commit is contained in:
Krzysztof Płaczek
2022-09-16 10:52:50 +02:00
parent b158ec6b5d
commit c5f4a8ed2d
5 changed files with 113 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\SymfonyCastDl;
use App\Jobs\GetVideoFileSize;
use App\Models\Chapter;
use App\Models\Course;
use GuzzleHttp\TransferStats;
@@ -40,14 +41,13 @@ class SymfonyCastDlService
$coursePage = $this->client->get('courses/filtering');
$courses = $this->htmlParser->getCourses($coursePage);
$courses->each(fn($course) => $course->save());
// $singleCoursePage = $this->client->get($courses[3]->link);
$courses->each->save();
/** @var Course $course */
foreach ($courses as $course) {
$singleCoursePage = $this->client->get($course->link);
$chapters = $this->htmlParser->getCourseDetails($singleCoursePage, $course->id);
// $chapters->each(fn($chapter) => $this->videoSize($chapter)->save());
$chapters->each(fn($chapter) => $chapter->save());
$chapters->each->save();
$chapters->each(fn($chapter) => GetVideoFileSize::dispatch($chapter->id));
}
}