mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
WIP
This commit is contained in:
parent
2c6ecc24ea
commit
b47ef4d9f1
2 changed files with 21 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
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.preferences.UserPreferences
|
||||
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.setValueOnMain
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import org.jellyfin.sdk.api.client.ApiClient
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
|
|
@ -32,11 +35,25 @@ class SeerrDiscoverViewModel
|
|||
constructor(
|
||||
private val seerrService: SeerrService,
|
||||
val navigationManager: NavigationManager,
|
||||
private val api: ApiClient,
|
||||
) : ViewModel() {
|
||||
val recentlyAdded = MutableLiveData<List<DiscoverItem>>(listOf())
|
||||
val discoverMovies = MutableLiveData<List<DiscoverItem>>(listOf())
|
||||
val discoverTv = MutableLiveData<List<DiscoverItem>>(listOf())
|
||||
|
||||
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 {
|
||||
val movies = seerrService.discoverMovies()
|
||||
discoverMovies.setValueOnMain(movies)
|
||||
|
|
|
|||
|
|
@ -1296,6 +1296,10 @@ components:
|
|||
type: string
|
||||
example: '2020-09-12T10:00:27.000Z'
|
||||
readOnly: true
|
||||
jellyfinMediaId:
|
||||
type: string
|
||||
jellyfinMediaId4k:
|
||||
type: string
|
||||
Cast:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue