From 1eb554e59bc2ae7a813af03d884bda54efbcbef5 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 6 Jun 2024 15:05:52 +0000 Subject: Playlist: add m3u files --- laravel/app/Playlist.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'laravel/app/Playlist.php') diff --git a/laravel/app/Playlist.php b/laravel/app/Playlist.php index 7284b0e..f56e1be 100644 --- a/laravel/app/Playlist.php +++ b/laravel/app/Playlist.php @@ -11,4 +11,14 @@ class Playlist extends Model { return $this->belongsToMany('App\Song'); } + public function getM3uAttribute() + { + $output = "#EXTM3U\n"; + foreach($this->songs as $song) { + if ($song->audio){ + $output .= config('app.url') . $song->audio . "\n"; + } + } + return $output; + } } -- cgit 1.4.1