]> git.localhorst.tv Git - alttp.git/commitdiff
include comms in event description
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 11 Jul 2025 13:49:05 +0000 (15:49 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 11 Jul 2025 13:49:05 +0000 (15:49 +0200)
app/Models/Episode.php

index c6ac07e935dc8024a945cb196c4173acbb1bb565..fd68cd6c86d0f480a1dc3dccf5d2a22c2e672739 100644 (file)
@@ -50,10 +50,13 @@ class Episode extends Model
                if ($this->title != '') {
                        $parts[] = $this->title;
                }
-               if ($this->event->title != '' && strlen(implode(' - ', $parts).' - '.$this->event->title) < 100) {
+               if ($this->event->title != '') {
                        $parts[] = $this->event->title;
                }
                $name = implode(' - ', $parts);
+               if (strlen($name) > 100) {
+                       $name = substr($name, 0, 99).'…';
+               }
                return $name;
        }
 
@@ -77,6 +80,23 @@ class Episode extends Model
                                }
                        }
                }
+               $comms = [];
+               foreach ($this->confirmedCrew as $crew) {
+                       if ($crew->role == 'commentary') {
+                               $comms[] = $crew;
+                       }
+               }
+               if (count($comms)) {
+                       $description .= "\nComms:\n";
+                       foreach ($comms as $crew) {
+                               $link = $crew->getStreamLink();
+                               if ($link) {
+                                       $description .= '- ['.$crew->getName().']('.$link.")\n";
+                               } else {
+                                       $description .= '- '.$crew->getName()."\n";
+                               }
+                       }
+               }
                return $description;
        }