feat: permit to play Funkwhale songs
This commit is contained in:
@@ -953,6 +953,14 @@ function getFunkwhaleTracks($funkwhaleUrl = null, $count = null) {
|
||||
|
||||
// Ne garder que les morceaux locaux
|
||||
if ($isLocal) {
|
||||
// Récupérer l'URL d'écoute depuis l'API (peut être relative)
|
||||
$listenUrl = $item['listen_url'] ?? '';
|
||||
|
||||
// Si l'URL est relative, la transformer en URL absolue
|
||||
if (!empty($listenUrl) && strpos($listenUrl, 'http') !== 0) {
|
||||
$listenUrl = rtrim($funkwhaleUrl, '/') . $listenUrl;
|
||||
}
|
||||
|
||||
$track = [
|
||||
'title' => $item['title'] ?? '',
|
||||
'artist' => $item['artist']['name'] ?? 'Artiste inconnu',
|
||||
@@ -961,6 +969,7 @@ function getFunkwhaleTracks($funkwhaleUrl = null, $count = null) {
|
||||
'duration' => $item['uploads'][0]['duration'] ?? 0,
|
||||
'link' => rtrim($funkwhaleUrl, '/') . '/library/tracks/' . ($item['id'] ?? ''),
|
||||
'trackId' => $item['id'] ?? 0,
|
||||
'audioUrl' => $listenUrl,
|
||||
];
|
||||
|
||||
// Formater la durée
|
||||
|
||||
Reference in New Issue
Block a user