add id and file_size on default format ordering

This commit is contained in:
deniscerri 2025-05-25 16:57:44 +02:00
parent 2433b3768c
commit 903293e159
No known key found for this signature in database
GPG key ID: 95C43D517D830350
3 changed files with 10 additions and 8 deletions

View file

@ -216,4 +216,4 @@ dependencies {
implementation "io.noties.markwon:core:4.6.2" implementation "io.noties.markwon:core:4.6.2"
implementation("org.greenrobot:eventbus:3.3.1") implementation("org.greenrobot:eventbus:3.3.1")
implementation("com.github.teamnewpipe:newpipeextractor:0.24.6") implementation("com.github.teamnewpipe:newpipeextractor:0.24.6")
implementation("com.grack:nanojson:1.10")} }

View file

@ -79,7 +79,7 @@ class ObserveSourcesRepository(private val observeSourcesDao: ObserveSourcesDao,
Calendar.getInstance().apply { Calendar.getInstance().apply {
timeInMillis = it.startsTime timeInMillis = it.startsTime
if (it.everyCategory != ObserveSourcesRepository.EveryCategory.HOUR){ if (it.everyCategory != EveryCategory.HOUR){
val hourMin = Calendar.getInstance() val hourMin = Calendar.getInstance()
hourMin.timeInMillis = it.everyTime hourMin.timeInMillis = it.everyTime
set(Calendar.HOUR_OF_DAY, hourMin.get(Calendar.HOUR_OF_DAY)) set(Calendar.HOUR_OF_DAY, hourMin.get(Calendar.HOUR_OF_DAY))
@ -87,9 +87,9 @@ class ObserveSourcesRepository(private val observeSourcesDao: ObserveSourcesDao,
} }
when(it.everyCategory){ when(it.everyCategory){
ObserveSourcesRepository.EveryCategory.HOUR -> {} EveryCategory.HOUR -> {}
ObserveSourcesRepository.EveryCategory.DAY -> {} EveryCategory.DAY -> {}
ObserveSourcesRepository.EveryCategory.WEEK -> { EveryCategory.WEEK -> {
var weekDayNr = get(Calendar.DAY_OF_WEEK) - 1 var weekDayNr = get(Calendar.DAY_OF_WEEK) - 1
if (weekDayNr == 0) weekDayNr = 7 if (weekDayNr == 0) weekDayNr = 7
val followingWeekDay = it.weeklyConfig?.weekDays?.firstOrNull { it >= weekDayNr } val followingWeekDay = it.weeklyConfig?.weekDays?.firstOrNull { it >= weekDayNr }
@ -101,7 +101,7 @@ class ObserveSourcesRepository(private val observeSourcesDao: ObserveSourcesDao,
add(Calendar.DAY_OF_MONTH, followingWeekDay - weekDayNr) add(Calendar.DAY_OF_MONTH, followingWeekDay - weekDayNr)
} }
} }
ObserveSourcesRepository.EveryCategory.MONTH -> { EveryCategory.MONTH -> {
val currentMonthIndex = get(Calendar.MONTH) val currentMonthIndex = get(Calendar.MONTH)
if (it.monthlyConfig?.startsMonth != currentMonthIndex){ if (it.monthlyConfig?.startsMonth != currentMonthIndex){
set(Calendar.MONTH, it.monthlyConfig?.startsMonth ?: 0) set(Calendar.MONTH, it.monthlyConfig?.startsMonth ?: 0)

View file

@ -45,9 +45,10 @@ class FormatUtil(private var context: Context) {
return orderPreferences return orderPreferences
}else { }else {
val formatImportance = mutableListOf("codec", "container", "language") val formatImportance = mutableListOf("id","codec", "container", "language", "file_size")
if (sharedPreferences.getBoolean("prefer_smaller_formats", false)) { if (sharedPreferences.getBoolean("prefer_smaller_formats", false)) {
formatImportance.add(0, "smallsize") formatImportance.add(0, "smallsize")
formatImportance.remove("file_size")
} }
val preferContainerOverCodec = sharedPreferences.getBoolean("prefer_container_over_codec_audio", false) val preferContainerOverCodec = sharedPreferences.getBoolean("prefer_container_over_codec_audio", false)
@ -71,9 +72,10 @@ class FormatUtil(private var context: Context) {
return orderPreferences return orderPreferences
}else { }else {
val formatImportance = mutableListOf("resolution", "codec", "container") val formatImportance = mutableListOf("id","resolution", "codec", "container", "file_size")
if (sharedPreferences.getBoolean("prefer_smaller_formats", false)) { if (sharedPreferences.getBoolean("prefer_smaller_formats", false)) {
formatImportance.add("smallsize") formatImportance.add("smallsize")
formatImportance.remove("file_size")
} }
return formatImportance return formatImportance