try harder at fetching folder tracks too
This commit is contained in:
parent
ccdbf7ac63
commit
200686da3f
1 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue