feat(library): extract track duration via ffprobe #13

Merged
bvandeusen merged 262 commits from dev into main 2026-04-20 08:11:10 -04:00
Showing only changes of commit a37fe4c167 - Show all commits
@@ -141,6 +141,7 @@ private fun ArtistBody(
ArtistHeader(
artist = detail.artist,
artistLiked = artistLiked,
fallbackAlbumId = detail.albums.firstOrNull()?.id,
onPlay = onPlay,
onToggleLike = onToggleLike,
)
@@ -161,6 +162,7 @@ private fun ArtistBody(
private fun ArtistHeader(
artist: ArtistRef,
artistLiked: Boolean,
fallbackAlbumId: String?,
onPlay: () -> Unit,
onToggleLike: () -> Unit,
) {
@@ -171,7 +173,7 @@ private fun ArtistHeader(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
) {
ArtistAvatar(artist)
ArtistAvatar(artist, fallbackAlbumId)
Column(modifier = Modifier.weight(1f)) {
Text(
text = artist.name,
@@ -198,7 +200,16 @@ private fun ArtistHeader(
}
@Composable
private fun ArtistAvatar(artist: ArtistRef) {
private fun ArtistAvatar(artist: ArtistRef, fallbackAlbumId: String? = null) {
// Server coverUrl wins; otherwise mirror the server's "use the
// first album's cover" rule via the loaded album list (Flutter
// _ArtistAvatar). Bare Lucide.User only when neither exists.
val model = when {
artist.coverUrl.isNotEmpty() -> artist.coverUrl
fallbackAlbumId != null ->
"http://placeholder.invalid/api/albums/$fallbackAlbumId/cover"
else -> null
}
Box(
modifier = Modifier
.size(96.dp)
@@ -206,7 +217,7 @@ private fun ArtistAvatar(artist: ArtistRef) {
.background(MaterialTheme.colorScheme.surfaceVariant),
contentAlignment = Alignment.Center,
) {
if (artist.coverUrl.isEmpty()) {
if (model == null) {
Icon(
imageVector = Lucide.User,
contentDescription = null,
@@ -215,7 +226,7 @@ private fun ArtistAvatar(artist: ArtistRef) {
)
} else {
AsyncImage(
model = artist.coverUrl,
model = model,
contentDescription = artist.name,
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,