-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use sponsorblock plugin - Use lavsrc - Add option to specify search provider - Search on deezer by default
- Loading branch information
1 parent
d8e34d8
commit 60b26d0
Showing
35 changed files
with
190 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
subprojects { | ||
version = "2.25.0-SNAPSHOT" | ||
version = "3.0.0-SNAPSHOT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 21 additions & 6 deletions
27
music/commands/src/main/kotlin/dev/schlaubi/mikmusic/playlist/Playlist.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
package dev.schlaubi.mikmusic.playlist | ||
|
||
import dev.arbjerg.lavalink.protocol.v4.Track | ||
import dev.kord.common.entity.Snowflake | ||
import dev.schlaubi.lavakord.audio.player.Track | ||
import dev.schlaubi.mikmusic.core.TrackSerializer | ||
import dev.schlaubi.lavakord.audio.Node | ||
import dev.schlaubi.lavakord.rest.decodeTrack | ||
import dev.schlaubi.lavakord.rest.decodeTracks | ||
import kotlinx.serialization.Contextual | ||
import kotlinx.serialization.KSerializer | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.builtins.ListSerializer | ||
import org.litote.kmongo.Id | ||
|
||
object TrackListSerializer : KSerializer<List<Track>> by ListSerializer(TrackSerializer) | ||
@JvmInline | ||
@Serializable | ||
value class EncodedTrack(val value: String) { | ||
suspend fun toTrack(lavalink: Node): Track = lavalink.decodeTrack(value) | ||
} | ||
|
||
object TrackListSerializer : KSerializer<List<EncodedTrack>> by ListSerializer(EncodedTrack.serializer()) | ||
|
||
fun List<Track>.mapToEncoded(): List<EncodedTrack> = map(Track::toEncodedTrack) | ||
|
||
fun Track.toEncodedTrack() = EncodedTrack(encoded) | ||
|
||
@Serializable | ||
data class Playlist( | ||
@SerialName("_id") @Contextual | ||
val id: Id<Playlist>, | ||
val authorId: Snowflake, | ||
val name: String, | ||
@Serializable(with = TrackListSerializer::class) val songs: List<@Contextual Track>, | ||
@Serializable(with = TrackListSerializer::class) val songs: List<EncodedTrack>, | ||
val public: Boolean = false, | ||
val usages: Int = 0 | ||
) | ||
val usages: Int = 0, | ||
) { | ||
suspend fun getTracks(lavalink: Node) = | ||
lavalink.decodeTracks(songs.map(EncodedTrack::value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
music/player/src/main/kotlin/dev/schlaubi/mikmusic/core/TrackSerializer.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.