mirror of
https://github.com/Michatec/Radio.git
synced 2026-11-16 12:41:38 +01:00
fix: prevent station name from being added to metadata history
- Skip adding metadata to the history list if the metadata string matches the current station name. - Move `currentMediaItem` retrieval earlier in the processing logic to facilitate the station name comparison.
This commit is contained in:
1 parent
33ff113989
commit
008ac4bc34
1 file changed
+6
-1
@@ -420,6 +420,12 @@ class PlayerService : MediaLibraryService(), SharedPreferences.OnSharedPreferenc
|
||||
return
|
||||
}
|
||||
|
||||
val currentMediaItem = player.currentMediaItem
|
||||
val stationName = currentMediaItem?.let { CollectionHelper.getStation(collection, it.mediaId).name } ?: ""
|
||||
if (metadataString == stationName) {
|
||||
return
|
||||
}
|
||||
|
||||
// remove duplicates
|
||||
if (metadataHistory.contains(metadataString)) {
|
||||
metadataHistory.removeAll { it == metadataString }
|
||||
@@ -434,7 +440,6 @@ class PlayerService : MediaLibraryService(), SharedPreferences.OnSharedPreferenc
|
||||
PreferencesHelper.saveMetadataHistory(metadataHistory)
|
||||
|
||||
if (metadata.isNotEmpty()) {
|
||||
val currentMediaItem = player.currentMediaItem
|
||||
if (currentMediaItem != null && currentMediaItem.mediaMetadata.title?.toString() != metadataString) {
|
||||
val stationName = CollectionHelper.getStation(collection, currentMediaItem.mediaId).name.ifEmpty {
|
||||
currentMediaItem.mediaMetadata.artist?.toString() ?: ""
|
||||
|
||||
Reference in new issue
Block a user