This commit is contained in:
Damontecres 2025-12-08 14:28:32 -05:00
parent 2c6ecc24ea
commit b47ef4d9f1
No known key found for this signature in database
2 changed files with 21 additions and 0 deletions

View file

@ -14,6 +14,7 @@ import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.github.damontecres.wholphin.api.seerr.MediaApi
import com.github.damontecres.wholphin.data.model.DiscoverItem import com.github.damontecres.wholphin.data.model.DiscoverItem
import com.github.damontecres.wholphin.preferences.UserPreferences import com.github.damontecres.wholphin.preferences.UserPreferences
import com.github.damontecres.wholphin.services.NavigationManager import com.github.damontecres.wholphin.services.NavigationManager
@ -24,6 +25,8 @@ import com.github.damontecres.wholphin.ui.launchIO
import com.github.damontecres.wholphin.ui.nav.Destination import com.github.damontecres.wholphin.ui.nav.Destination
import com.github.damontecres.wholphin.ui.setValueOnMain import com.github.damontecres.wholphin.ui.setValueOnMain
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import org.jellyfin.sdk.api.client.ApiClient
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
@ -32,11 +35,25 @@ class SeerrDiscoverViewModel
constructor( constructor(
private val seerrService: SeerrService, private val seerrService: SeerrService,
val navigationManager: NavigationManager, val navigationManager: NavigationManager,
private val api: ApiClient,
) : ViewModel() { ) : ViewModel() {
val recentlyAdded = MutableLiveData<List<DiscoverItem>>(listOf())
val discoverMovies = MutableLiveData<List<DiscoverItem>>(listOf()) val discoverMovies = MutableLiveData<List<DiscoverItem>>(listOf())
val discoverTv = MutableLiveData<List<DiscoverItem>>(listOf()) val discoverTv = MutableLiveData<List<DiscoverItem>>(listOf())
init { init {
viewModelScope.launchIO {
val tv =
seerrService.api.mediaApi
.mediaGet(
take = 20,
filter = MediaApi.FilterMediaGet.ALLAVAILABLE,
sort = MediaApi.SortMediaGet.MEDIA_ADDED,
).results
.orEmpty()
Timber.v(tv.firstOrNull()?.jellyfinMediaId)
}
viewModelScope.launchIO { viewModelScope.launchIO {
val movies = seerrService.discoverMovies() val movies = seerrService.discoverMovies()
discoverMovies.setValueOnMain(movies) discoverMovies.setValueOnMain(movies)

View file

@ -1296,6 +1296,10 @@ components:
type: string type: string
example: '2020-09-12T10:00:27.000Z' example: '2020-09-12T10:00:27.000Z'
readOnly: true readOnly: true
jellyfinMediaId:
type: string
jellyfinMediaId4k:
type: string
Cast: Cast:
type: object type: object
properties: properties: