try harder at fetching folder tracks too

This commit is contained in:
tibbi 2020-11-02 18:46:07 +01:00
parent ccdbf7ac63
commit 200686da3f

View file

@ -315,11 +315,19 @@ fun Context.getFolderTracks(path: String): ArrayList<Track> {
val wantedTracks = ArrayList<Track>()
folderTracks.forEach { trackPath ->
var trackAdded = false
val mediaStoreId = getMediaStoreIdFromPath(trackPath)
if (mediaStoreId != 0L) {
allTracks.firstOrNull { it.mediaStoreId == mediaStoreId }?.apply {
id = 0
wantedTracks.add(this)
trackAdded = true
}
}
if (!trackAdded) {
RoomHelper(this).getTrackFromPath(trackPath)?.apply {
wantedTracks.add(this)
}
}
}