koel/app/Http/Controllers/API/MediaInformation/SongController.php

30 lines
888 B
PHP
Raw Normal View History

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;
use App\Services\MediaInformationService;
use App\Services\YouTubeService;
2018-08-18 13:19:40 +00:00
class SongController extends Controller
{
2021-06-05 10:47:56 +00:00
private YouTubeService $youTubeService;
public function __construct(MediaInformationService $mediaInformationService, YouTubeService $youTubeService)
{
parent::__construct($mediaInformationService);
2020-12-22 20:11:22 +00:00
$this->youTubeService = $youTubeService;
}
2018-08-18 13:19:40 +00:00
public function show(Song $song)
{
return response()->json([
'lyrics' => $song->lyrics,
'album_info' => $this->mediaInformationService->getAlbumInformation($song->album),
'artist_info' => $this->mediaInformationService->getArtistInformation($song->artist),
'youtube' => $this->youTubeService->searchVideosRelatedToSong($song),
2018-08-18 13:19:40 +00:00
]);
}
}