path), 'flac')) { return (new TranscodingStreamer($song))->stream(); } switch (env('STREAMING_METHOD')) { case 'x-sendfile': return (new XSendFileStreamer($song))->stream(); case 'x-accel-redirect': return (new XAccelRedirectStreamer($song))->stream(); default: return (new PHPStreamer($song))->stream(); } } /** * Get extra information about a song via Last.fm. * * @param Song $song * * @return \Illuminate\Http\JsonResponse */ public function getInfo(Song $song) { return response()->json([ 'lyrics' => $song->lyrics, 'album_info' => $song->album->getInfo(), 'artist_info' => $song->album->artist->getInfo(), ]); } /** * Scrobble a song. * * @param Song $song * @param string $timestamp The UNIX timestamp when the song started playing. * * @return \Illuminate\Http\JsonResponse */ public function scrobble(Song $song, $timestamp) { return response()->json($song->scrobble($timestamp)); } /** * Update songs info. * * @param SongUpdateRequest $request * * @return \Illuminate\Http\JsonResponse */ public function update(SongUpdateRequest $request) { return response()->json(Song::updateInfo($request->songs, $request->data)); } }