])->throw()->json();
foreach ($hthSchedule['data']['series']['event']['races'] as $hthEntry) {
try {
- $this->syncSchedule($event, $hthEntry);
+ $this->syncSchedule($event, $hthHandle, $hthEntry);
} catch (\Exception $e) {
$this->error('error syncing episode '.$hthEntry['id'].': '.$e->getMessage());
}
}
}
- private function syncSchedule(Event $event, $hthEntry): void {
+ private function syncSchedule(Event $event, $hthHandle, $hthEntry): void {
$ext_id = 'hth:'.$hthEntry['id'];
$episode = Episode::query()->firstWhere('ext_id', '=', $ext_id);
if (!$hthEntry['start']) {
if (!$episode) {
$episode = new Episode();
$episode->ext_id = $ext_id;
+ $episode->ext_info = ['handle' => $hthHandle];
$episode->estimate = 120 * 60;
$episode->confirmed = true;
}
'confirmed' => 'boolean',
'create_raceroom' => 'boolean',
'do_not_restream' => 'boolean',
+ 'ext_info' => 'array',
'start' => 'datetime',
];
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('episodes', function (Blueprint $table) {
+ $table->text('ext_info')->default('{}')->after('ext_id');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('episodes', function (Blueprint $table) {
+ $table->dropColumn('ext_info');
+ });
+ }
+};