mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-29 15:11:34 +03:00
Limit GetSongs if length is too short
This commit is contained in:
parent
a23e5ff794
commit
7eb3d01ae8
@ -42,6 +42,7 @@ import org.moire.ultrasonic.util.Constants
|
|||||||
import org.moire.ultrasonic.util.FileUtil
|
import org.moire.ultrasonic.util.FileUtil
|
||||||
import org.moire.ultrasonic.util.Util
|
import org.moire.ultrasonic.util.Util
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import java.lang.Math.min
|
||||||
|
|
||||||
// TODO: There are quite a number of deeply nested and complicated functions in this class..
|
// TODO: There are quite a number of deeply nested and complicated functions in this class..
|
||||||
// Simplify them :)
|
// Simplify them :)
|
||||||
@ -257,7 +258,8 @@ class OfflineMusicService : MusicService, KoinComponent {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
children.shuffle()
|
children.shuffle()
|
||||||
for (i in 0 until size) {
|
val finalSize: Int = min(children.size, size)
|
||||||
|
for (i in 0 until finalSize) {
|
||||||
val file = children[i % children.size]
|
val file = children[i % children.size]
|
||||||
result.addChild(createEntry(file, getName(file)))
|
result.addChild(createEntry(file, getName(file)))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user