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

commonMain.dev.schlaubi.lavakord.plugins.lavasrc.DeezerHelperFunctions.kt Maven / Gradle / Ivy

There is a newer version: 8.1.0
Show newest version
// DO NOT EDIT!! - This code has been generated by QueryUtilityProcessor
// Edit this file instead lavasrc/src/commonMain/kotlin/QueryUtils.kt
@file:Suppress(names = arrayOf("IncorrectFormatting", "INVISIBLE_REFERENCE"))

package dev.schlaubi.lavakord.plugins.lavasrc

import dev.arbjerg.lavalink.protocol.v4.LoadResult
import dev.schlaubi.lavakord.audio.Node
import dev.schlaubi.lavakord.audio.player.PlayOptions
import dev.schlaubi.lavakord.audio.player.Player
import dev.schlaubi.lavakord.rest.loadItem
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract

/**
 * Performs a track search and plays the result using [Deezer](https://deezer.com).
 */
public suspend fun Player.searchAndPlayUsingDeezer(query: String,
        playOptionsBuilder: PlayOptions.() -> Unit = {}) {
    contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) }
    searchAndPlayTrack("dzsearch:$query", playOptionsBuilder)
}

/**
 * Performs a track search using [Deezer](https://deezer.com).
 */
public suspend fun Node.searchUsingDeezer(query: String): LoadResult = loadItem("dzsearch:$query")

/**
 * Performs a track search and plays the result using [Deezer](https://deezer.com).
 *
 * @param isrc The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of
 * the song you want to play
 */
public suspend fun Player.loadAndPlayUsingDeezer(isrc: String,
        playOptionsBuilder: PlayOptions.() -> Unit = {}) {
    contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) }
    searchAndPlayTrack("dzisrc:$isrc", playOptionsBuilder)
}

/**
 * Performs a track search using [Deezer](https://deezer.com).
 *
 * @param isrc The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of
 * the song you want to play
 */
public suspend fun Node.loadUsingDeezer(isrc: String): LoadResult = loadItem("dzisrc:$isrc")




© 2015 - 2024 Weber Informatics LLC | Privacy Policy