From: Daniel Karbach Date: Mon, 2 Feb 2026 13:06:58 +0000 (+0100) Subject: store hth handle for episodes X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=d3785e24335cf27f10184c2a1fa99f78aa34cece;p=alttp.git store hth handle for episodes --- diff --git a/app/Console/Commands/SyncHTH.php b/app/Console/Commands/SyncHTH.php index 1979c1d..310a596 100644 --- a/app/Console/Commands/SyncHTH.php +++ b/app/Console/Commands/SyncHTH.php @@ -120,14 +120,14 @@ class SyncHTH extends Command { ])->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']) { @@ -144,6 +144,7 @@ class SyncHTH extends Command { if (!$episode) { $episode = new Episode(); $episode->ext_id = $ext_id; + $episode->ext_info = ['handle' => $hthHandle]; $episode->estimate = 120 * 60; $episode->confirmed = true; } diff --git a/app/Models/Episode.php b/app/Models/Episode.php index 611a69c..1ace6bd 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -176,6 +176,7 @@ class Episode extends Model 'confirmed' => 'boolean', 'create_raceroom' => 'boolean', 'do_not_restream' => 'boolean', + 'ext_info' => 'array', 'start' => 'datetime', ]; diff --git a/database/migrations/2026_02_02_121807_episode_ext_info.php b/database/migrations/2026_02_02_121807_episode_ext_info.php new file mode 100644 index 0000000..51aef14 --- /dev/null +++ b/database/migrations/2026_02_02_121807_episode_ext_info.php @@ -0,0 +1,28 @@ +text('ext_info')->default('{}')->after('ext_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('episodes', function (Blueprint $table) { + $table->dropColumn('ext_info'); + }); + } +};