Sort items alphabetical on name
This commit is contained in:
parent
07d9ae676c
commit
c7a816ff6f
2 changed files with 10 additions and 3 deletions
|
@ -3,6 +3,7 @@ package dev.jdtech.jellyfin.repository
|
||||||
import org.jellyfin.sdk.model.api.BaseItemDto
|
import org.jellyfin.sdk.model.api.BaseItemDto
|
||||||
import org.jellyfin.sdk.model.api.ItemFields
|
import org.jellyfin.sdk.model.api.ItemFields
|
||||||
import org.jellyfin.sdk.model.api.MediaSourceInfo
|
import org.jellyfin.sdk.model.api.MediaSourceInfo
|
||||||
|
import org.jellyfin.sdk.model.api.SortOrder
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
interface JellyfinRepository {
|
interface JellyfinRepository {
|
||||||
|
@ -13,7 +14,9 @@ interface JellyfinRepository {
|
||||||
suspend fun getItems(
|
suspend fun getItems(
|
||||||
parentId: UUID? = null,
|
parentId: UUID? = null,
|
||||||
includeTypes: List<String>? = null,
|
includeTypes: List<String>? = null,
|
||||||
recursive: Boolean = false
|
recursive: Boolean = false,
|
||||||
|
sortBy: String = "SortName",
|
||||||
|
sortOrder: SortOrder = SortOrder.ASCENDING
|
||||||
): List<BaseItemDto>
|
): List<BaseItemDto>
|
||||||
|
|
||||||
suspend fun getFavoriteItems(): List<BaseItemDto>
|
suspend fun getFavoriteItems(): List<BaseItemDto>
|
||||||
|
|
|
@ -28,7 +28,9 @@ class JellyfinRepositoryImpl(private val jellyfinApi: JellyfinApi) : JellyfinRep
|
||||||
override suspend fun getItems(
|
override suspend fun getItems(
|
||||||
parentId: UUID?,
|
parentId: UUID?,
|
||||||
includeTypes: List<String>?,
|
includeTypes: List<String>?,
|
||||||
recursive: Boolean
|
recursive: Boolean,
|
||||||
|
sortBy: String,
|
||||||
|
sortOrder: SortOrder
|
||||||
): List<BaseItemDto> {
|
): List<BaseItemDto> {
|
||||||
val items: List<BaseItemDto>
|
val items: List<BaseItemDto>
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
|
@ -36,7 +38,9 @@ class JellyfinRepositoryImpl(private val jellyfinApi: JellyfinApi) : JellyfinRep
|
||||||
jellyfinApi.userId!!,
|
jellyfinApi.userId!!,
|
||||||
parentId = parentId,
|
parentId = parentId,
|
||||||
includeItemTypes = includeTypes,
|
includeItemTypes = includeTypes,
|
||||||
recursive = recursive
|
recursive = recursive,
|
||||||
|
sortBy = listOf(sortBy),
|
||||||
|
sortOrder = listOf(sortOrder)
|
||||||
).content.items ?: listOf()
|
).content.items ?: listOf()
|
||||||
}
|
}
|
||||||
return items
|
return items
|
||||||
|
|
Loading…
Reference in a new issue