mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Add settings for max days in next up (#850)
## Description Add a settings to set the maximum amount of time items can appear in Next Up. Options range from 7 days to a year, or no limit (current & default behavior) ### Related issues Closes #662 ### Testing Tested on the emulator and verified URLs, added unit tests ## Screenshots N/A, just a new slider bar setting ## AI or LLM usage None
This commit is contained in:
parent
63b37ef3f4
commit
e7da5ca007
11 changed files with 208 additions and 7 deletions
|
|
@ -10,6 +10,7 @@ import com.github.damontecres.wholphin.preferences.AppPreference
|
|||
import com.github.damontecres.wholphin.preferences.AppPreferences
|
||||
import com.github.damontecres.wholphin.preferences.update
|
||||
import com.github.damontecres.wholphin.preferences.updateAdvancedPreferences
|
||||
import com.github.damontecres.wholphin.preferences.updateHomePagePreferences
|
||||
import com.github.damontecres.wholphin.preferences.updateInterfacePreferences
|
||||
import com.github.damontecres.wholphin.preferences.updateLiveTvPreferences
|
||||
import com.github.damontecres.wholphin.preferences.updateMpvOptions
|
||||
|
|
@ -237,4 +238,12 @@ suspend fun upgradeApp(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (previous.isEqualOrBefore(Version.fromString("0.4.1-14-g0"))) {
|
||||
appPreferences.updateData {
|
||||
it.updateHomePagePreferences {
|
||||
maxDaysNextUp = AppPreference.MaxDaysNextUp.defaultValue.toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,10 @@ class LatestNextUpService
|
|||
limit: Int,
|
||||
enableRewatching: Boolean,
|
||||
enableResumable: Boolean,
|
||||
maxDays: Int,
|
||||
): List<BaseItem> {
|
||||
val nextUpDateCutoff =
|
||||
maxDays.takeIf { it > 0 }?.let { LocalDateTime.now().minusDays(it.toLong()) }
|
||||
val request =
|
||||
GetNextUpRequest(
|
||||
userId = userId,
|
||||
|
|
@ -86,6 +89,7 @@ class LatestNextUpService
|
|||
enableResumable = enableResumable,
|
||||
enableUserData = true,
|
||||
enableRewatching = enableRewatching,
|
||||
nextUpDateCutoff = nextUpDateCutoff,
|
||||
)
|
||||
val nextUp =
|
||||
api.tvShowsApi
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ class TvProviderWorker
|
|||
userId,
|
||||
prefs.homePagePreferences.enableRewatchingNextUp,
|
||||
prefs.homePagePreferences.combineContinueNext,
|
||||
prefs.homePagePreferences.maxDaysNextUp,
|
||||
)
|
||||
val potentialItemsToAddIds = potentialItemsToAdd.map { it.id.toString() }
|
||||
|
||||
|
|
@ -145,12 +146,13 @@ class TvProviderWorker
|
|||
userId: UUID,
|
||||
enableRewatching: Boolean,
|
||||
combineContinueNext: Boolean,
|
||||
maxDaysNextUp: Int,
|
||||
): List<BaseItem> {
|
||||
val resumeItems = latestNextUpService.getResume(userId, 10, true)
|
||||
val seriesIds = resumeItems.mapNotNull { it.data.seriesId }
|
||||
val nextUpItems =
|
||||
latestNextUpService
|
||||
.getNextUp(userId, 10, enableRewatching, false)
|
||||
.getNextUp(userId, 10, enableRewatching, false, maxDaysNextUp)
|
||||
.filter { it.data.seriesId != null && it.data.seriesId !in seriesIds }
|
||||
return if (combineContinueNext) {
|
||||
latestNextUpService.buildCombined(resumeItems, nextUpItems)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue