mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
29 lines
888 B
PHP
29 lines
888 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\MediaInformation;
|
|
|
|
use App\Models\Song;
|
|
use App\Services\MediaInformationService;
|
|
use App\Services\YouTubeService;
|
|
|
|
class SongController extends Controller
|
|
{
|
|
private YouTubeService $youTubeService;
|
|
|
|
public function __construct(MediaInformationService $mediaInformationService, YouTubeService $youTubeService)
|
|
{
|
|
parent::__construct($mediaInformationService);
|
|
|
|
$this->youTubeService = $youTubeService;
|
|
}
|
|
|
|
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),
|
|
]);
|
|
}
|
|
}
|