Fixes #5447 -- Fix places where DJ avatar shows up.
This commit is contained in:
parent
d43aee2a8d
commit
dc62918291
|
@ -129,7 +129,10 @@ final class ListAction
|
|||
$row = new Entity\Api\StationOnDemand();
|
||||
|
||||
$row->track_id = $media->getUniqueId();
|
||||
$row->media = ($this->songApiGenerator)($media, $station);
|
||||
$row->media = ($this->songApiGenerator)(
|
||||
song: $media,
|
||||
station: $station
|
||||
);
|
||||
$row->playlist = $playlist['name'];
|
||||
$row->download_url = (string)$router->named(
|
||||
'api:stations:ondemand:download',
|
||||
|
|
|
@ -41,7 +41,7 @@ class NowPlayingApiGenerator
|
|||
$np->is_online = $npResult->meta->online;
|
||||
$np->station = ($this->stationApiGenerator)($station, $baseUri);
|
||||
$np->listeners = new Entity\Api\NowPlaying\Listeners(
|
||||
total: $npResult->listeners->total,
|
||||
total: $npResult->listeners->total,
|
||||
unique: $npResult->listeners->unique
|
||||
);
|
||||
|
||||
|
@ -102,7 +102,12 @@ class NowPlayingApiGenerator
|
|||
$np->live = new Entity\Api\NowPlaying\Live(false);
|
||||
}
|
||||
|
||||
$apiSongHistory = ($this->songHistoryApiGenerator)($sh_obj, $baseUri, true);
|
||||
$apiSongHistory = ($this->songHistoryApiGenerator)(
|
||||
record: $sh_obj,
|
||||
baseUri: $baseUri,
|
||||
allowRemoteArt: true,
|
||||
isNowPlaying: true
|
||||
);
|
||||
$apiCurrentSong = new Entity\Api\NowPlaying\CurrentSong();
|
||||
$apiCurrentSong->fromParentObject($apiSongHistory);
|
||||
|
||||
|
@ -143,9 +148,9 @@ class NowPlayingApiGenerator
|
|||
$offlineApiNowPlaying = new Entity\Api\NowPlaying\CurrentSong();
|
||||
$offlineApiNowPlaying->sh_id = 0;
|
||||
$offlineApiNowPlaying->song = ($this->songApiGenerator)(
|
||||
$songObj,
|
||||
$station,
|
||||
$baseUri
|
||||
song: $songObj,
|
||||
station: $station,
|
||||
baseUri: $baseUri
|
||||
);
|
||||
$np->now_playing = $offlineApiNowPlaying;
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ class SongApiGenerator
|
|||
Entity\Interfaces\SongInterface $song,
|
||||
?Entity\Station $station = null,
|
||||
?UriInterface $baseUri = null,
|
||||
bool $allowRemoteArt = false
|
||||
bool $allowRemoteArt = false,
|
||||
bool $isNowPlaying = false,
|
||||
): Entity\Api\Song {
|
||||
$response = new Entity\Api\Song();
|
||||
$response->id = $song->getSongId();
|
||||
|
@ -63,7 +64,7 @@ class SongApiGenerator
|
|||
|
||||
$response->art = UriResolver::resolve(
|
||||
$baseUri ?? $this->router->getBaseUrl(),
|
||||
$this->getAlbumArtUrl($song, $station, $allowRemoteArt)
|
||||
$this->getAlbumArtUrl($song, $station, $allowRemoteArt, $isNowPlaying)
|
||||
);
|
||||
|
||||
return $response;
|
||||
|
@ -72,7 +73,8 @@ class SongApiGenerator
|
|||
protected function getAlbumArtUrl(
|
||||
Entity\Interfaces\SongInterface $song,
|
||||
?Entity\Station $station = null,
|
||||
bool $allowRemoteArt = false
|
||||
bool $allowRemoteArt = false,
|
||||
bool $isNowPlaying = false,
|
||||
): UriInterface {
|
||||
if (null !== $station && $song instanceof Entity\StationMedia) {
|
||||
$mediaUpdatedTimestamp = $song->getArtUpdatedAt();
|
||||
|
@ -94,7 +96,7 @@ class SongApiGenerator
|
|||
}
|
||||
}
|
||||
|
||||
if (null !== $station) {
|
||||
if ($isNowPlaying && null !== $station) {
|
||||
$currentStreamer = $station->getCurrentStreamer();
|
||||
if (null !== $currentStreamer && 0 !== $currentStreamer->getArtUpdatedAt()) {
|
||||
return $this->router->named(
|
||||
|
|
|
@ -20,7 +20,8 @@ class SongHistoryApiGenerator
|
|||
public function __invoke(
|
||||
Entity\SongHistory $record,
|
||||
?UriInterface $baseUri = null,
|
||||
bool $allowRemoteArt = false
|
||||
bool $allowRemoteArt = false,
|
||||
bool $isNowPlaying = false,
|
||||
): SongHistory {
|
||||
$response = new SongHistory();
|
||||
$response->sh_id = $record->getIdRequired();
|
||||
|
@ -43,17 +44,19 @@ class SongHistoryApiGenerator
|
|||
|
||||
if (null !== $record->getMedia()) {
|
||||
$response->song = ($this->songApiGenerator)(
|
||||
$record->getMedia(),
|
||||
$record->getStation(),
|
||||
$baseUri,
|
||||
$allowRemoteArt
|
||||
song: $record->getMedia(),
|
||||
station: $record->getStation(),
|
||||
baseUri: $baseUri,
|
||||
allowRemoteArt: $allowRemoteArt,
|
||||
isNowPlaying: $isNowPlaying
|
||||
);
|
||||
} else {
|
||||
$response->song = ($this->songApiGenerator)(
|
||||
$record,
|
||||
$record->getStation(),
|
||||
$baseUri,
|
||||
$allowRemoteArt
|
||||
song: $record,
|
||||
station: $record->getStation(),
|
||||
baseUri: $baseUri,
|
||||
allowRemoteArt: $allowRemoteArt,
|
||||
isNowPlaying: $isNowPlaying
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,17 +36,17 @@ class StationQueueApiGenerator
|
|||
$recordMedia = $record->getMedia();
|
||||
if (null !== $recordMedia) {
|
||||
$response->song = ($this->songApiGenerator)(
|
||||
$recordMedia,
|
||||
$record->getStation(),
|
||||
$baseUri,
|
||||
$allowRemoteArt
|
||||
song: $recordMedia,
|
||||
station: $record->getStation(),
|
||||
baseUri: $baseUri,
|
||||
allowRemoteArt: $allowRemoteArt
|
||||
);
|
||||
} else {
|
||||
$response->song = ($this->songApiGenerator)(
|
||||
$record,
|
||||
$record->getStation(),
|
||||
$baseUri,
|
||||
$allowRemoteArt
|
||||
song: $record,
|
||||
station: $record->getStation(),
|
||||
baseUri: $baseUri,
|
||||
allowRemoteArt: $allowRemoteArt
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue