|
@@ 164-185 (lines=22) @@
|
| 161 |
|
* @NoAdminRequired |
| 162 |
|
* @NoCSRFRequired |
| 163 |
|
*/ |
| 164 |
|
public function artist() { |
| 165 |
|
$fulltree = filter_var($this->params('fulltree'), FILTER_VALIDATE_BOOLEAN); |
| 166 |
|
$artistId = $this->getIdFromSlug($this->params('artistIdOrSlug')); |
| 167 |
|
/** @var Artist $artist */ |
| 168 |
|
$artist = $this->artistBusinessLayer->find($artistId, $this->userId); |
| 169 |
|
$artist = $artist->toAPI($this->urlGenerator, $this->l10n); |
| 170 |
|
if($fulltree) { |
| 171 |
|
$artistId = $artist['id']; |
| 172 |
|
$albums = $this->albumBusinessLayer->findAllByArtist($artistId, $this->userId); |
| 173 |
|
foreach($albums as &$album) { |
| 174 |
|
$album = $album->toAPI($this->urlGenerator, $this->l10n); |
| 175 |
|
$albumId = $album['id']; |
| 176 |
|
$tracks = $this->trackBusinessLayer->findAllByAlbum($albumId, $this->userId, $artistId); |
| 177 |
|
foreach($tracks as &$track) { |
| 178 |
|
$track = $track->toAPI($this->urlGenerator); |
| 179 |
|
} |
| 180 |
|
$album['tracks'] = $tracks; |
| 181 |
|
} |
| 182 |
|
$artist['albums'] = $albums; |
| 183 |
|
} |
| 184 |
|
return new JSONResponse($artist); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
/** |
| 188 |
|
* @NoAdminRequired |
|
@@ 218-240 (lines=23) @@
|
| 215 |
|
* @NoAdminRequired |
| 216 |
|
* @NoCSRFRequired |
| 217 |
|
*/ |
| 218 |
|
public function album() { |
| 219 |
|
$fulltree = filter_var($this->params('fulltree'), FILTER_VALIDATE_BOOLEAN); |
| 220 |
|
$albumId = $this->getIdFromSlug($this->params('albumIdOrSlug')); |
| 221 |
|
$album = $this->albumBusinessLayer->find($albumId, $this->userId); |
| 222 |
|
|
| 223 |
|
$artistIds = $album->getArtistIds(); |
| 224 |
|
$album = $album->toAPI($this->urlGenerator, $this->l10n); |
| 225 |
|
if($fulltree) { |
| 226 |
|
$albumId = $album['id']; |
| 227 |
|
$tracks = $this->trackBusinessLayer->findAllByAlbum($albumId, $this->userId); |
| 228 |
|
foreach($tracks as &$track) { |
| 229 |
|
$track = $track->toAPI($this->urlGenerator); |
| 230 |
|
} |
| 231 |
|
$album['tracks'] = $tracks; |
| 232 |
|
$artists = $this->artistBusinessLayer->findMultipleById($artistIds, $this->userId); |
| 233 |
|
foreach($artists as &$artist) { |
| 234 |
|
$artist = $artist->toAPI($this->urlGenerator, $this->l10n); |
| 235 |
|
} |
| 236 |
|
$album['artists'] = $artists; |
| 237 |
|
} |
| 238 |
|
|
| 239 |
|
return new JSONResponse($album); |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
/** |
| 243 |
|
* @NoAdminRequired |