-
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 for chapters
- Loading branch information
1 parent
27164c0
commit c4afa31
Showing
12 changed files
with
132 additions
and
111 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 = "3.0.2-SNAPSHOT" | ||
version = "3.0.3-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
43 changes: 43 additions & 0 deletions
43
music/player/src/main/kotlin/dev/schlaubi/mikmusic/innerttube/test.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package dev.schlaubi.mikmusic.innerttube | ||
|
||
import dev.kord.common.Locale | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
|
||
@Serializable | ||
data class Entry( | ||
val text: String, | ||
val thumbnail: String? = null, | ||
val url: String? = null, | ||
) | ||
|
||
private fun MusicResponsiveListItemRenderer.NavigationEndpoint.toUrl() = when { | ||
browseEndpoint != null -> "https://music.youtube.com/channel/${browseEndpoint.browseId}" | ||
watchEndpoint != null -> "https://music.youtube.com/watch?v${watchEndpoint.videoId}" | ||
else -> error("Unknown endpoint: $this") | ||
} | ||
|
||
suspend fun main() { | ||
val results = InnerTubeClient.requestMusicAutoComplete("a", Locale.GERMAN) | ||
|
||
val result = results.contents.flatMap { | ||
it.searchSuggestionsSectionRenderer.contents.mapNotNull { | ||
if (it.searchSuggestionRenderer != null) { | ||
Entry(it.searchSuggestionRenderer.suggestion.joinRuns()) | ||
} else if (it.musicResponsiveListItemRenderer?.navigationEndpoint != null | ||
&& it.musicResponsiveListItemRenderer.thumbnail != null | ||
) { | ||
val item = it.musicResponsiveListItemRenderer | ||
Entry( | ||
item.flexColumns.first().musicResponsiveListItemFlexColumnRenderer.text.joinRuns(), | ||
item.thumbnail!!.musicThumbnailRenderer.thumbnail.thumbnails.first().url, | ||
item.navigationEndpoint!!.toUrl() | ||
) | ||
} else { | ||
null | ||
} | ||
} | ||
} | ||
println(Json { prettyPrint = true }.encodeToString(result)) | ||
} |
12 changes: 0 additions & 12 deletions
12
music/player/src/main/kotlin/dev/schlaubi/mikmusic/player/Chapter.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
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,2 +1,4 @@ | ||
:core:gdpr | ||
:core:redeploy-hook | ||
:music:player | ||
:music:commands |
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