stream(); case 'x-accel-redirect': return (new XAccelRedirectStreamer($id))->stream(); default: return (new PHPStreamer($id))->stream(); } } /** * Get extra information about a song via Last.fm. * * @param string $id * * @return \Illuminate\Http\JsonResponse */ public function getInfo($id) { $song = Song::with('album.artist')->findOrFail($id); return response()->json([ 'lyrics' => $song->lyrics, 'album_info' => $song->album->getInfo(), 'artist_info' => $song->album->artist->getInfo(), ]); } /** * Scrobble a song. * * @param string $id The song's ID * @param string $timestamp The UNIX timestamp when the song started playing. * * @return \Illuminate\Http\JsonResponse */ public function scrobble($id, $timestamp) { return response()->json(Song::with('album.artist')->findOrFail($id)->scrobble($timestamp)); } }