Add more searchable types & choose what to search (#1857)
## Description This PR adds several more data types to search. It also adds a setting (per use profile) to choose which types to include/exclude when searching. The combined results now uses the same types instead of a separate list. A user can only search for types that they have access to. For example, they need Live TV access for TV channels/programs or need access to a movies-type library to search movies. Added types to search: - Photos & Photo albums - Playlists - People - TV channels - Live TV programs Clicking a TV channel will play it. Clicking a TV program shows the program dialog allowing for recording or watching live if it's currently airing. On the main search page you can also toggle whether to search Seerr or not. This does not apply to the discover search tab. Dev note: Some minor refactoring to move setting up/canceling live tv recordings into a new service so it can be shared between with the live tv & search pages. Also search related files are moved into the same package now. ### Related issues Closes #409 Closes #646 Closes #1668 Closes #1750 ### Testing Emulator using users with different permissions and library access ## Screenshots <img width="475" height="584" alt="image" src="https://github.com/user-attachments/assets/ebcff697-07ba-4ddd-8c26-57f147cfa02a" /> ## AI or LLM usage None
This commit is contained in:
parent
2b9af1e8bc
commit
f91bca18ff
21 changed files with 1968 additions and 1416 deletions
|
|
@ -0,0 +1,94 @@
|
|||
package com.github.damontecres.wholphin.services
|
||||
|
||||
import com.github.damontecres.wholphin.data.model.BaseItem
|
||||
import com.github.damontecres.wholphin.ui.toServerString
|
||||
import org.jellyfin.sdk.api.client.ApiClient
|
||||
import org.jellyfin.sdk.api.client.extensions.liveTvApi
|
||||
import org.jellyfin.sdk.model.api.TimerInfoDto
|
||||
import java.util.UUID
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Functions for recording live tv programs
|
||||
*/
|
||||
@Singleton
|
||||
class LiveTvService
|
||||
@Inject
|
||||
constructor(
|
||||
private val api: ApiClient,
|
||||
) {
|
||||
/**
|
||||
* Fetch a tv program by ID
|
||||
*/
|
||||
suspend fun fetchProgramForDialog(programId: UUID): BaseItem {
|
||||
val result =
|
||||
api.liveTvApi
|
||||
.getProgram(programId.toServerString())
|
||||
.content
|
||||
.let { BaseItem(it) }
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel a recording by [timerId]
|
||||
*
|
||||
* @param series whether the timerId is a series recording or not
|
||||
* @param timerId the recording ID
|
||||
*/
|
||||
suspend fun cancelRecording(
|
||||
series: Boolean,
|
||||
timerId: String?,
|
||||
): Boolean =
|
||||
if (timerId != null) {
|
||||
if (series) {
|
||||
api.liveTvApi.cancelSeriesTimer(timerId)
|
||||
} else {
|
||||
api.liveTvApi.cancelTimer(timerId)
|
||||
}
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Record tv program
|
||||
*
|
||||
* @param programId the tv program ID
|
||||
* @param series whether to set up series recording or just a single recording
|
||||
*/
|
||||
suspend fun record(
|
||||
programId: UUID,
|
||||
series: Boolean,
|
||||
) {
|
||||
val d by api.liveTvApi.getDefaultTimer(programId.toServerString())
|
||||
if (series) {
|
||||
api.liveTvApi.createSeriesTimer(d)
|
||||
} else {
|
||||
val payload =
|
||||
TimerInfoDto(
|
||||
id = d.id,
|
||||
type = d.type,
|
||||
serverId = d.serverId,
|
||||
externalId = d.externalId,
|
||||
channelId = d.channelId,
|
||||
externalChannelId = d.externalChannelId,
|
||||
channelName = d.channelName,
|
||||
programId = d.programId,
|
||||
externalProgramId = d.externalProgramId,
|
||||
name = d.name,
|
||||
overview = d.overview,
|
||||
startDate = d.startDate,
|
||||
endDate = d.endDate,
|
||||
serviceName = d.serviceName,
|
||||
priority = d.priority,
|
||||
prePaddingSeconds = d.prePaddingSeconds,
|
||||
postPaddingSeconds = d.postPaddingSeconds,
|
||||
isPrePaddingRequired = d.isPrePaddingRequired,
|
||||
isPostPaddingRequired = d.isPostPaddingRequired,
|
||||
keepUntil = d.keepUntil,
|
||||
)
|
||||
api.liveTvApi.createTimer(payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue