Skip to content

Commit

Permalink
another fix problem child
Browse files Browse the repository at this point in the history
  • Loading branch information
brahmkshatriya committed Mar 3, 2024
1 parent 2093c67 commit b299cf2
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.ContentUris
import android.content.Context
import android.net.Uri
import android.provider.MediaStore
import androidx.core.database.getLongOrNull
import androidx.core.database.getStringOrNull
import dev.brahmkshatriya.echo.common.models.Album
import dev.brahmkshatriya.echo.common.models.Artist
Expand Down Expand Up @@ -81,6 +82,7 @@ class TrackResolver(val context: Context) {
val albumColumn = it.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM)
val albumIdColumn = it.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM_ID)
val durationColumn = it.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION)
val releaseDateColumn = it.getColumnIndexOrThrow(MediaStore.Audio.Media.YEAR)

while (it.moveToNext()) {
val uri = Uri.parse("$URI$TRACK_AUTH${it.getLong(idColumn)}")
Expand All @@ -94,11 +96,19 @@ class TrackResolver(val context: Context) {
Track(
uri = uri,
title = it.getString(titleColumn),
artists = listOf(Artist.Small(artistUri, it.getStringOrNull(artistColumn) ?: "PROBLEM CHILD")),
album = Album.Small(albumUri, it.getString(albumColumn)),
artists = listOf(
Artist.Small(
artistUri,
it.getStringOrNull(artistColumn) ?: "PROBLEM CHILD"
)
),
album = Album.Small(
albumUri,
it.getStringOrNull(albumColumn) ?: "PROBLEM CHILD"
),
cover = coverUri.toImageHolder(),
duration = it.getLong(durationColumn),
releaseDate = it.getString(it.getColumnIndexOrThrow(MediaStore.Audio.Media.YEAR)),
duration = it.getLongOrNull(durationColumn),
releaseDate = it.getStringOrNull(releaseDateColumn),
plays = null,
liked = false,
)
Expand Down

0 comments on commit b299cf2

Please sign in to comment.