slight fix
This commit is contained in:
parent
dd43fb0a88
commit
06538f0762
1 changed files with 7 additions and 1 deletions
|
|
@ -8,6 +8,8 @@ import androidx.preference.PreferenceManager
|
||||||
import com.afollestad.materialdialogs.utils.MDUtil.getStringArray
|
import com.afollestad.materialdialogs.utils.MDUtil.getStringArray
|
||||||
import com.deniscerri.ytdl.R
|
import com.deniscerri.ytdl.R
|
||||||
import com.deniscerri.ytdl.database.models.Format
|
import com.deniscerri.ytdl.database.models.Format
|
||||||
|
import kotlin.math.max
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
class FormatUtil(private var context: Context) {
|
class FormatUtil(private var context: Context) {
|
||||||
private val sharedPreferences : SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
private val sharedPreferences : SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||||
|
|
@ -168,8 +170,12 @@ class FormatUtil(private var context: Context) {
|
||||||
"resolution" -> {
|
"resolution" -> {
|
||||||
when (videoQualityPreference) {
|
when (videoQualityPreference) {
|
||||||
"worst" -> {
|
"worst" -> {
|
||||||
b.format_note.contains("worst", ignoreCase = true)
|
val containsWorst = b.format_note.contains("worst", ignoreCase = true)
|
||||||
.compareTo(a.format_note.contains("worst", ignoreCase = true))
|
.compareTo(a.format_note.contains("worst", ignoreCase = true))
|
||||||
|
|
||||||
|
val worstFilesize = a.filesize.compareTo(b.filesize)
|
||||||
|
|
||||||
|
min(containsWorst, worstFilesize)
|
||||||
}
|
}
|
||||||
"best" -> {
|
"best" -> {
|
||||||
b.format_note.contains("best", ignoreCase = true)
|
b.format_note.contains("best", ignoreCase = true)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue