feat(songs): add SoundCloud as a song source - #2
Merged
Merged
Conversation
- detect source from pasted URL host (lib/sources.ts), search via scsearch/ytsearch with a source toggle, and add single tracks, YouTube playlists, and SoundCloud sets through one shared resolver - store source + thumbnail on songs (SoundCloud has no derivable thumbnail CDN pattern like YouTube's i.ytimg.com) - drop the embedded YouTube preview player for artwork + an open-in-source link, removing the react-youtube dependency - extend the Discord /play command to accept SoundCloud URLs too - guard double-submit on the add-song form
The skip endpoint and the songs poll both picked "current" as the highest-voted unplayed song. While a song plays it stays played=false in the DB, so once a pending song's votes overtake it mid-playback, both picked the wrong song: the vote-skip would 404/403 against votes that don't belong to what's on air, mark that wrong song played (never having streamed a second of it), and the real track would also get marked played when the player stopped — skipping two songs per click. Thread currentTracks' songId through as currentSongId so the skip route and the frontend's "now playing" both anchor to what's actually streaming, falling back to vote order only when nothing is (bot not connected).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
search (YT/SC toggle). The backend resolves, searches, and streams SoundCloud via
yt-dlpthe same way it already does YouTube — no new dependencies.
shared between the HTTP add-song endpoint and the Discord
/playcommand.the
react-youtubedependency.highest-voted unplayed song" as a stand-in for "what's actually streaming," which diverges
as soon as a pending song's votes overtake the one currently playing (it stays
played=falseuntil it finishes). That let a single skip mark two songs as played.Both are now anchored to the real
songIdtracked incurrentTracks.Test plan
bun testinpackages/server(23/23)bun run buildinpackages/serverandpackages/webyt-dlp: YT/SC search, adding a track by URL on bothsources, invalid-URL rejection, a SoundCloud set (11 tracks, deferred titles resolved), a
YouTube playlist (100 tracks, regression)
/play <soundcloud url>on Discord with the bot connected to a voice channelnow-playing panel / skip button stay in sync when a queued song's votes overtake the one
currently playing