return Command::SUCCESS;
}
- $html = Http::get('https://docs.google.com/spreadsheets/d/1xuZggJsTT-USjgZjpI1qW07XIs1uXGToGj7AHY5Xh0A/edit?gid=1433653457')->body();
+ $html = Http::get('https://docs.google.com/spreadsheets/d/e/2PACX-1vQqjtMMKeZ8O4F8JKSfMg2AXMRURfikyRx4rwXCbA4RoPTRROOBmR2U7pR9lnCvrKPEzwEw_mi2VYRX/pubhtml/sheet?headers=false&gid=339001170')->body();
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($html);
foreach ($cells as $cell) {
$entry[] = $cell->textContent;
}
- if (count($entry) == 11) {
+ if (count($entry) == 4) {
$schedule[] = $entry;
}
}
}
$ext_id = 'pilot-spoiler:'.$event->id.':'.$row[0];
$episode = Episode::query()->firstWhere('ext_id', '=', $ext_id);
+ if ($row[3] == 'TBD') {
+ if ($episode) {
+ $this->line('calling off'.$row[0]);
+ $episode->callOff();
+ $episode->delete();
+ }
+ return;
+ }
if (!$episode) {
$episode = new Episode();
$episode->ext_id = $ext_id;
$episode->confirmed = true;
}
$episode->event()->associate($event);
- $episode->title = $row[1].' vs. '.$row[2];
- $start = Carbon::createFromFormat('m/d/Y h:i:s A', $row[3].' '.$row[4], 'America/Detroit')->setTimezone('UTC');
+ $episode->title = $row[0];
+ $start = Carbon::createFromFormat('l F d, Y h:i A \E\T', $row[3], 'America/Detroit')->setTimezone('UTC');
if (!$episode->start || $start->ne($episode->start)) {
$episode->start = $start;
}
$episode->save();
- $players_a = $this->getTeam($row[1]);
- $players_b = $this->getTeam($row[2]);
+ if (!preg_match('/^(.*) and (.*)$/', $row[1], $matches_a)) {
+ return;
+ }
- $this->syncPlayer($episode, $players_a[0]);
- $this->syncPlayer($episode, $players_b[0]);
- $this->syncPlayer($episode, $players_a[1]);
- $this->syncPlayer($episode, $players_b[1]);
+ if (!preg_match('/^(.*) and (.*)$/', $row[2], $matches_b)) {
+ return;
+ }
+
+ $this->syncPlayer($episode, $matches_a[1]);
+ $this->syncPlayer($episode, $matches_b[1]);
+ $this->syncPlayer($episode, $matches_a[2]);
+ $this->syncPlayer($episode, $matches_b[2]);
}
- private function syncPlayer(Episode $episode, string $uid): EpisodePlayer|null {
- $ext_id = 'pilot-spoiler:'.$uid;
+ private function syncPlayer(Episode $episode, string $codename): EpisodePlayer|null {
+ if (empty($codename)) {
+ return null;
+ }
+ $lower_name = strtolower($codename);
+ $ext_id = 'pilot-spoiler:'.$lower_name;
$player = $episode->players()->firstWhere('ext_id', '=', $ext_id);
if (!$player) {
$player = new EpisodePlayer();
$player->ext_id = $ext_id;
$player->episode()->associate($episode);
}
- $user = $this->getUser($uid);
+ $player->name_override = $codename;
+ $user = $this->getUser($lower_name);
if ($user) {
$player->user()->associate($user);
} else {
return $player;
}
- private function getTeam($team_name) {
- if (!isset($this->teams[$team_name])) {
- throw new \Exception('missing team '.$team_name);
+ private function getUser(string $codename): User|null {
+ if (isset($this->codename_table[$codename])) {
+ $user = User::query()->firstWhere('username', 'LIKE', $this->codename_table[$codename]);
+ if ($user) {
+ return $user;
+ }
}
- return $this->teams[$team_name];
- }
-
- private function getUser(string $uid): User|null {
- $user = User::query()->firstWhere('id', '=', $uid);
+ $user = User::query()->firstWhere('discord_nickname', 'LIKE', $codename);
+ if ($user) {
+ return $user;
+ }
+ $user = User::query()->firstWhere('username', 'LIKE', $codename);
+ if ($user) {
+ return $user;
+ }
+ $user = User::query()->firstWhere('stream_link', 'LIKE', '%/'.$codename);
if ($user) {
return $user;
}
return null;
}
- private $teams = [
- 'Hylian Fluff Brigade' => ['250359697352294403', '201148317306978305'],
- 'BA (Bonkers Anonymous)' => ['599373366847209482', '556232109786660885'],
- 'Bonker\'s Anonymous' => ['599373366847209482', '556232109786660885'],
- 'Lost Flight Plan' => ['138876266328752128', '494281016052023307'],
- '"Don\'t Forget Arrows" 2026 Reunion Tour' => ['221090754087354368', '523596161639251999'],
- 'The spoiler logarithms' => ['285792304491528192', '615949908226080781'],
- 'Trading Card Game' => ['226954634894376960', '456652691771359234'],
- 'ratSTEERing the Apple under the Midnight Sun' => ['138692388767006720', '84253020518379520'],
- 'German Fever Dream' => ['95574504360648704', '531429222938443777'],
- 'Suecica-Norvegica' => ['205967929920061441', '148114577475895296'],
- 'Spoil Deez' => ['1256338007607345183', '721148393723920535'],
- 'Service Bunny' => ['259540285380362242', '254933538892283905'],
- 'ShyFeesh UwU' => ['1319432974340722732', '269249177257639936'],
- 'Fluff for Brains' => ['171825625278054409', '116481821147004928'],
- 'Anscylla and Charybdeez' => ['238940719925035008', '255676979460702210'],
- 'Winners Don\'t Do Spiral' => ['747174011380957224', '158012662872014858'],
- 'The Longshots' => ['358327737703989260', '755277999749726319'],
- 'Gaslight, Gatekeep, Go Mode' => ['300998041413091329', '101834678083813376'],
- '12 foot 8' => ['222928132590534656', '254616492992233472'],
- 'Die Namenlosen' => ['986161067975639113', '944262998170693674'],
- 'XIV and Chill' => ['82638364838203392', '65467134536327168'],
+ private $codename_table = [
+ 'jamo' => 'jamo6',
+ 'jem' => 'jem041',
+ 'flying platipus dimitri' => 'flying.platipus.dimitri',
+ 'magno' => 'magnohato',
+ 'skele' => 'iamskelebro',
+ 'specks' => 'speckyspecks',
];
}