fix: improve station name retrieval for media metadata updates

- Update `PlayerService.kt` to fetch the station name from the collection using `mediaId` via `CollectionHelper`.
- Fall back to the existing artist metadata if the retrieved station name is empty.
This commit is contained in:
Michatec committed 2026-10-31 20:42:39 +01:00
1 parent 34aa8cde03
commit eed4b097b8
1 file changed
+3 -1
@@ -436,7 +436,9 @@ class PlayerService : MediaLibraryService(), SharedPreferences.OnSharedPreferenc
if (metadata.isNotEmpty()) {
val currentMediaItem = player.currentMediaItem
if (currentMediaItem != null && currentMediaItem.mediaMetadata.title?.toString() != metadataString) {
val stationName = currentMediaItem.mediaMetadata.title?.toString() ?: ""
val stationName = CollectionHelper.getStation(collection, currentMediaItem.mediaId).name.ifEmpty {
currentMediaItem.mediaMetadata.artist?.toString() ?: ""
}
val newMediaMetadata = currentMediaItem.mediaMetadata.buildUpon()
.setTitle(metadataString)
.setArtist(stationName)