mirror of
https://github.com/Michatec/Radio.git
synced 2026-11-16 10:11:38 +01:00
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:
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)
|
||||
|
||||
Reference in new issue
Block a user