All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.org.jellyfin.sdk.model.deviceprofile.ContainerProfileBuilder.kt Maven / Gradle / Ivy

There is a newer version: 1.5.5
Show newest version
package org.jellyfin.sdk.model.deviceprofile

import org.jellyfin.sdk.model.api.ContainerProfile
import org.jellyfin.sdk.model.api.DlnaProfileType
import org.jellyfin.sdk.model.api.ProfileCondition

@DeviceProfileBuilderDsl
public class ContainerProfileBuilder {
	private var containers = mutableListOf()
	private var conditions = mutableListOf()

	public fun container(vararg container: String) {
		containers.addAll(container)
	}

	public fun conditions(body: ProfileConditionsBuilder.() -> Unit) {
		conditions.addAll(ProfileConditionsBuilder().apply(body).build())
	}

	public fun build(): ContainerProfile = ContainerProfile(
		// Server only uses container profiles with video type so the builder only supports that
		type = DlnaProfileType.VIDEO,
		conditions = conditions,
		container = containers.joinToString(","),
	)
}

@DeviceProfileBuilderDsl
public fun buildContainerProfile(
	body: ContainerProfileBuilder.() -> Unit,
): ContainerProfile = ContainerProfileBuilder()
	.apply(body)
	.build()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy