diff --git a/css/funkwhale-tracks.css b/css/funkwhale-tracks.css index 6b3e230..e110685 100644 --- a/css/funkwhale-tracks.css +++ b/css/funkwhale-tracks.css @@ -62,22 +62,28 @@ display: flex; padding: 8px 12px; border-bottom: 1px solid var(--border-color); - text-decoration: none; color: inherit; transition: background-color 0.2s ease; gap: 8px; + position: relative; } .funkwhale-track-item:hover { background: var(--hover-bg); - text-decoration: none; - color: inherit; } .funkwhale-track-item:last-child { border-bottom: none; } +.funkwhale-track-item.playing { + background: var(--hover-bg); +} + +.funkwhale-track-item.playing .funkwhale-track-title { + color: var(--primary-red); +} + .funkwhale-track-thumb { width: 60px; height: 60px; @@ -90,6 +96,14 @@ justify-content: center; color: var(--text-secondary); position: relative; + border: none; + padding: 0; + cursor: pointer; + transition: transform 0.2s ease; +} + +.funkwhale-track-thumb:hover { + transform: scale(1.05); } .funkwhale-track-thumb img { @@ -98,7 +112,8 @@ object-fit: cover; } -.funkwhale-play-icon { +.funkwhale-play-icon, +.funkwhale-pause-icon { position: absolute; top: 50%; left: 50%; @@ -115,6 +130,18 @@ opacity: 1; } +.funkwhale-track-item.playing .funkwhale-play-icon { + opacity: 0; +} + +.funkwhale-track-item.playing .funkwhale-pause-icon { + opacity: 1; +} + +.funkwhale-track-item.playing:hover .funkwhale-pause-icon { + opacity: 1; +} + .funkwhale-track-info { flex: 1; min-width: 0; @@ -170,6 +197,36 @@ font-size: 0.9rem; } +/* Lien externe vers Funkwhale */ +.funkwhale-external-link { + display: flex; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + flex-shrink: 0; + color: var(--text-secondary); + text-decoration: none; + border-radius: 50%; + transition: all 0.2s ease; + margin-left: auto; +} + +.funkwhale-external-link:hover { + background: var(--tag-bg); + color: var(--primary-red); + transform: scale(1.1); +} + +.funkwhale-external-link i { + font-size: 0.85rem; +} + +/* Masquer l'élément audio */ +.funkwhale-track-item audio { + display: none; +} + /* Responsive Design */ @media (max-width: 1024px) { .funkwhale-section { diff --git a/includes/config.php b/includes/config.php index f04249d..52c8f2f 100644 --- a/includes/config.php +++ b/includes/config.php @@ -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 diff --git a/index.php b/index.php index c0d8565..9dfcb7e 100644 --- a/index.php +++ b/index.php @@ -208,15 +208,15 @@ setSecurityHeaders(); if (empty($funkwhaleTracks)) { echo '