mirror of
https://github.com/bbara04/Purefin.git
synced 2026-03-31 17:10:08 +02:00
refactor: extract itemFields list for cleaner API method calls in JellyfinApiClient
This commit is contained in:
@@ -94,6 +94,14 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
return libraries
|
return libraries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val itemFields =
|
||||||
|
listOf(
|
||||||
|
ItemFields.CHILD_COUNT,
|
||||||
|
ItemFields.PARENT_ID,
|
||||||
|
ItemFields.DATE_LAST_REFRESHED,
|
||||||
|
ItemFields.OVERVIEW
|
||||||
|
)
|
||||||
|
|
||||||
suspend fun getLibraryContent(libraryId: UUID): List<BaseItemDto> {
|
suspend fun getLibraryContent(libraryId: UUID): List<BaseItemDto> {
|
||||||
if (!ensureConfigured()) {
|
if (!ensureConfigured()) {
|
||||||
return emptyList()
|
return emptyList()
|
||||||
@@ -102,7 +110,7 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
userId = getUserId(),
|
userId = getUserId(),
|
||||||
enableImages = false,
|
enableImages = false,
|
||||||
parentId = libraryId,
|
parentId = libraryId,
|
||||||
fields = listOf(ItemFields.CHILD_COUNT, ItemFields.PARENT_ID, ItemFields.DATE_LAST_REFRESHED),
|
fields = itemFields,
|
||||||
enableUserData = true,
|
enableUserData = true,
|
||||||
includeItemTypes = listOf(BaseItemKind.MOVIE, BaseItemKind.SERIES),
|
includeItemTypes = listOf(BaseItemKind.MOVIE, BaseItemKind.SERIES),
|
||||||
recursive = true,
|
recursive = true,
|
||||||
@@ -122,7 +130,7 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
}
|
}
|
||||||
val getResumeItemsRequest = GetResumeItemsRequest(
|
val getResumeItemsRequest = GetResumeItemsRequest(
|
||||||
userId = userId,
|
userId = userId,
|
||||||
fields = listOf(ItemFields.CHILD_COUNT, ItemFields.PARENT_ID, ItemFields.DATE_LAST_REFRESHED),
|
fields = itemFields,
|
||||||
includeItemTypes = listOf(BaseItemKind.MOVIE, BaseItemKind.EPISODE),
|
includeItemTypes = listOf(BaseItemKind.MOVIE, BaseItemKind.EPISODE),
|
||||||
enableUserData = true,
|
enableUserData = true,
|
||||||
startIndex = 0,
|
startIndex = 0,
|
||||||
@@ -138,7 +146,7 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
}
|
}
|
||||||
val getNextUpRequest = GetNextUpRequest(
|
val getNextUpRequest = GetNextUpRequest(
|
||||||
userId = getUserId(),
|
userId = getUserId(),
|
||||||
fields = listOf(ItemFields.CHILD_COUNT, ItemFields.PARENT_ID, ItemFields.DATE_LAST_REFRESHED),
|
fields = itemFields,
|
||||||
enableResumable = true,
|
enableResumable = true,
|
||||||
seriesId = mediaId,
|
seriesId = mediaId,
|
||||||
)
|
)
|
||||||
@@ -160,7 +168,7 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
val response = api.userLibraryApi.getLatestMedia(
|
val response = api.userLibraryApi.getLatestMedia(
|
||||||
userId = getUserId(),
|
userId = getUserId(),
|
||||||
parentId = libraryId,
|
parentId = libraryId,
|
||||||
fields = listOf(ItemFields.CHILD_COUNT, ItemFields.PARENT_ID, ItemFields.DATE_LAST_REFRESHED),
|
fields = itemFields,
|
||||||
includeItemTypes = listOf(BaseItemKind.MOVIE, BaseItemKind.EPISODE, BaseItemKind.SEASON),
|
includeItemTypes = listOf(BaseItemKind.MOVIE, BaseItemKind.EPISODE, BaseItemKind.SEASON),
|
||||||
limit = 10
|
limit = 10
|
||||||
)
|
)
|
||||||
@@ -187,7 +195,7 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
val result = api.tvShowsApi.getSeasons(
|
val result = api.tvShowsApi.getSeasons(
|
||||||
userId = getUserId(),
|
userId = getUserId(),
|
||||||
seriesId = seriesId,
|
seriesId = seriesId,
|
||||||
fields = listOf(ItemFields.CHILD_COUNT, ItemFields.PARENT_ID, ItemFields.DATE_LAST_REFRESHED),
|
fields = itemFields,
|
||||||
enableUserData = true
|
enableUserData = true
|
||||||
)
|
)
|
||||||
Log.d("getSeasons", result.content.toString())
|
Log.d("getSeasons", result.content.toString())
|
||||||
@@ -202,7 +210,7 @@ class JellyfinApiClient @Inject constructor(
|
|||||||
userId = getUserId(),
|
userId = getUserId(),
|
||||||
seriesId = seriesId,
|
seriesId = seriesId,
|
||||||
seasonId = seasonId,
|
seasonId = seasonId,
|
||||||
fields = listOf(ItemFields.CHILD_COUNT, ItemFields.PARENT_ID, ItemFields.DATE_LAST_REFRESHED),
|
fields = itemFields,
|
||||||
enableUserData = true
|
enableUserData = true
|
||||||
)
|
)
|
||||||
Log.d("getEpisodesInSeason", result.content.toString())
|
Log.d("getEpisodesInSeason", result.content.toString())
|
||||||
|
|||||||
Reference in New Issue
Block a user