} else {
$episode->title = $entry['summary'];
}
- if (preg_match('/Restream: https?:\/\/(www\.)?twitch\.tv\/(\w+)/u', $entry['description'], $matches)) {
- $channel = $this->syncChannel($episode, $matches[2]);
- if ($channel) {
- $episode->channels()->syncWithoutDetaching([$channel->id]);
- }
- }
- if (preg_match('/^(.*) - (.*?) vs (.*?)$/u', $episode->title, $matches)) {
- $episode->title = $matches[1];
- $this->syncPlayer($episode, $matches[2]);
- $this->syncPlayer($episode, $matches[3]);
- }
$start = Carbon::parse($entry['start']['dateTime'])->setTimezone('UTC');
if (!$episode->start || $start->ne($episode->start)) {
$episode->start = $start;
$end = Carbon::parse($entry['end']['dateTime'])->setTimezone('UTC');
$episode->estimate = $start->diffInSeconds($end);
$episode->confirmed = true;
- $episode->save();
+ if (preg_match('/^(.*) - (.*?) vs\.? (.*?) vs\.? (.*?) vs\.? (.*?)$/u', $episode->title, $matches)) {
+ $episode->title = $matches[1];
+ $episode->save();
+ $this->syncPlayer($episode, $matches[2]);
+ $this->syncPlayer($episode, $matches[3]);
+ $this->syncPlayer($episode, $matches[4]);
+ $this->syncPlayer($episode, $matches[5]);
+ } else if (preg_match('/^(.*) - (.*?) vs\.? (.*?) vs\.? (.*?)$/u', $episode->title, $matches)) {
+ $episode->title = $matches[1];
+ $episode->save();
+ $this->syncPlayer($episode, $matches[2]);
+ $this->syncPlayer($episode, $matches[3]);
+ $this->syncPlayer($episode, $matches[4]);
+ } else if (preg_match('/^(.*) - (.*?) vs\.? (.*?)$/u', $episode->title, $matches)) {
+ $episode->title = $matches[1];
+ $episode->save();
+ $this->syncPlayer($episode, $matches[2]);
+ $this->syncPlayer($episode, $matches[3]);
+ } else {
+ $episode->save();
+ }
+ if (preg_match('/Restream: https?:\/\/(www\.)?twitch\.tv\/(\w+)/u', $entry['description'], $matches)) {
+ $channel = $this->syncChannel($episode, $matches[2]);
+ if ($channel) {
+ $episode->channels()->syncWithoutDetaching([$channel->id]);
+ }
+ }
}
private function syncChannel(Episode $episode, $zsrChannel) {