Show album artist under album name on album cards (#2117)
## Description Show album artist under album name on album cards ### Related issues Fixes #2055 ### Testing Android TV ## Screenshots <img width="1920" height="1080" alt="pr1-albums-grid-artist-year" src="https://github.com/user-attachments/assets/d00a8f78-8bf9-41da-8220-5cc7f6862cf5" /> ### AI or LLM usage Claude did the code, I reviewed it, then deployed a -debug.apk to my device to confirm feature live. Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
de67bccb39
commit
90a2d6d459
3 changed files with 54 additions and 2 deletions
|
|
@ -68,6 +68,7 @@ data class BaseItem(
|
|||
BaseItemKind.EPISODE -> listOf(data.seasonEpisode, name).joinNotBlank(" - ")
|
||||
BaseItemKind.SERIES -> data.seriesProductionYears
|
||||
BaseItemKind.AUDIO -> listOf(data.album, artistsString).joinNotBlank(" - ")
|
||||
BaseItemKind.MUSIC_ALBUM -> listOf(data.albumArtist ?: artistsString, data.productionYear?.toString()).joinNotBlank(" - ")
|
||||
else -> data.productionYear?.toString()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -522,9 +522,12 @@ fun ListItemAlbum(
|
|||
}
|
||||
val supportingContent =
|
||||
remember(item, dense) {
|
||||
if (!dense && item?.subtitle != null) {
|
||||
// Album artist is already shown as the overline
|
||||
val subtitle =
|
||||
if (item?.type == BaseItemKind.MUSIC_ALBUM) item.data.productionYear?.toString() else item?.subtitle
|
||||
if (!dense && subtitle != null) {
|
||||
@Composable {
|
||||
Text(item.subtitle ?: "")
|
||||
Text(subtitle)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.github.damontecres.wholphin.data.model
|
||||
|
||||
import org.jellyfin.sdk.model.api.BaseItemDto
|
||||
import org.jellyfin.sdk.model.api.BaseItemKind
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
import java.util.UUID
|
||||
|
||||
class BaseItemSubtitleTest {
|
||||
private fun album(
|
||||
albumArtist: String? = null,
|
||||
artists: List<String>? = null,
|
||||
productionYear: Int? = null,
|
||||
) = BaseItem(
|
||||
BaseItemDto(
|
||||
id = UUID.randomUUID(),
|
||||
type = BaseItemKind.MUSIC_ALBUM,
|
||||
name = "Test Album",
|
||||
albumArtist = albumArtist,
|
||||
artists = artists,
|
||||
productionYear = productionYear,
|
||||
),
|
||||
)
|
||||
|
||||
@Test
|
||||
fun albumPrefersAlbumArtist() {
|
||||
val item = album(albumArtist = "Album Artist", artists = listOf("A", "B"), productionYear = 2021)
|
||||
assertEquals("Album Artist - 2021", item.subtitle)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun albumFallsBackToArtists() {
|
||||
val item = album(artists = listOf("A", "B"), productionYear = 2021)
|
||||
assertEquals("A, B - 2021", item.subtitle)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun albumWithoutYear() {
|
||||
assertEquals("Album Artist", album(albumArtist = "Album Artist").subtitle)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun albumWithoutArtist() {
|
||||
assertEquals("2021", album(productionYear = 2021).subtitle)
|
||||
assertNull(album(artists = emptyList()).subtitle)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue