2018-08-18 13:19:40 +00:00
|
|
|
<?php
|
2018-08-18 13:20:02 +00:00
|
|
|
|
2018-08-18 13:19:40 +00:00
|
|
|
namespace App\Http\Controllers\API\MediaInformation;
|
|
|
|
|
|
|
|
use App\Models\Song;
|
2018-08-19 11:08:16 +00:00
|
|
|
use App\Services\MediaInformationService;
|
|
|
|
use App\Services\YouTubeService;
|
2018-08-18 13:19:40 +00:00
|
|
|
|
|
|
|
class SongController extends Controller
|
|
|
|
{
|
2022-07-08 14:53:04 +00:00
|
|
|
public function __construct(
|
|
|
|
protected MediaInformationService $mediaInformationService,
|
|
|
|
private YouTubeService $youTubeService
|
|
|
|
) {
|
2018-08-19 11:08:16 +00:00
|
|
|
parent::__construct($mediaInformationService);
|
|
|
|
}
|
|
|
|
|
2018-08-18 13:19:40 +00:00
|
|
|
public function show(Song $song)
|
|
|
|
{
|
|
|
|
return response()->json([
|
|
|
|
'lyrics' => $song->lyrics,
|
2022-07-08 14:53:04 +00:00
|
|
|
'album_info' => $this->mediaInformationService->getAlbumInformation($song->album)?->toArray() ?: [],
|
|
|
|
'artist_info' => $this->mediaInformationService->getArtistInformation($song->artist)?->toArray() ?: [],
|
2018-08-19 11:08:16 +00:00
|
|
|
'youtube' => $this->youTubeService->searchVideosRelatedToSong($song),
|
2018-08-18 13:19:40 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|