Added command to update all courses and chapters, downloading videos and checking video size is split into two queues, chapters can be mark to sync individually, updated readme, check if subscription is active, playback rate controll,
This commit is contained in:
34
app/Console/Commands/Update.php
Normal file
34
app/Console/Commands/Update.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Http\SymfonyCastDl\SymfonyCastDlService;
|
||||
use App\Jobs\DownloadVideoFile;
|
||||
use App\Jobs\GetVideoFileSize;
|
||||
use App\Models\Chapter;
|
||||
use App\Models\Course;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Update extends Command
|
||||
{
|
||||
protected $signature = 'symfonycast:update';
|
||||
|
||||
protected $description = 'Updates information about courses and chapters';
|
||||
|
||||
public function handle(SymfonyCastDlService $symfonyCastDlService)
|
||||
{
|
||||
if (!$symfonyCastDlService->isSubscriptionActive()) {
|
||||
$this->error('To fully update courses and chapters you need active subscription');
|
||||
return self::FAILURE;
|
||||
}
|
||||
$this->info('Start updating courses');
|
||||
$courses = $symfonyCastDlService->updateCourses();
|
||||
$this->output->success(count($courses) . ' courses updated');
|
||||
$this->output->info('Start updating each course chapters');
|
||||
$this->withProgressBar($courses, function (Course $course) use ($symfonyCastDlService) {
|
||||
$symfonyCastDlService->updateChapters($course);
|
||||
});
|
||||
$this->output->success('Course chapters updated.');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user