mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-23 19:26:50 +00:00
feat: Added getGenre api wrapper function
This commit is contained in:
@@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.first
|
|||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.jellyfin.sdk.api.client.Response
|
import org.jellyfin.sdk.api.client.Response
|
||||||
import org.jellyfin.sdk.api.client.extensions.authenticateUserByName
|
import org.jellyfin.sdk.api.client.extensions.authenticateUserByName
|
||||||
|
import org.jellyfin.sdk.api.client.extensions.genresApi
|
||||||
import org.jellyfin.sdk.api.client.extensions.itemsApi
|
import org.jellyfin.sdk.api.client.extensions.itemsApi
|
||||||
import org.jellyfin.sdk.api.client.extensions.mediaInfoApi
|
import org.jellyfin.sdk.api.client.extensions.mediaInfoApi
|
||||||
import org.jellyfin.sdk.api.client.extensions.mediaSegmentsApi
|
import org.jellyfin.sdk.api.client.extensions.mediaSegmentsApi
|
||||||
@@ -250,6 +251,18 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
nextUpEpisodes
|
nextUpEpisodes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getGenres(id: UUID? = null) : List<BaseItemDto> = withContext(Dispatchers.IO) {
|
||||||
|
if (!ensureConfigured()) {
|
||||||
|
return@withContext emptyList()
|
||||||
|
}
|
||||||
|
val result = api.genresApi.getGenres(
|
||||||
|
userId = getUserId(),
|
||||||
|
parentId = id,
|
||||||
|
)
|
||||||
|
Log.d("getGenres", result.toString())
|
||||||
|
result.content.items
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun getMediaSources(mediaId: UUID): List<MediaSourceInfo> = withContext(Dispatchers.IO) {
|
suspend fun getMediaSources(mediaId: UUID): List<MediaSourceInfo> = withContext(Dispatchers.IO) {
|
||||||
if (!ensureConfigured()) {
|
if (!ensureConfigured()) {
|
||||||
return@withContext emptyList()
|
return@withContext emptyList()
|
||||||
|
|||||||
Reference in New Issue
Block a user