Skip to content

Commit

Permalink
Attempt to fix compat with the new youtube source
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 authored Apr 26, 2024
1 parent cb986a7 commit 96ead18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public HttpClientProvider(AbstractRoutePlanner routePlanner, ServerConfig server
rotator = new YoutubeIpRotatorSetup(routePlanner).withRetryLimit(retryLimit);
}

rotator.forConfiguration(this.httpInterfaceManager, false).setup();
rotator.forConfiguration(this.httpInterfaceManager, false)
// Necessary to avoid NPEs.
.withMainDelegateFilter(null)
.setup();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.duncte123.lyrics;

import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack;
import com.sedmelluq.discord.lavaplayer.tools.JsonBrowser;
import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
Expand Down Expand Up @@ -47,8 +46,8 @@ public Future<Lyrics> findLyrics(AudioTrack track) {
try {
final String videoId;

if (track instanceof YoutubeAudioTrack ytTrack) {
videoId = ytTrack.getInfo().identifier;
if ("youtube".equalsIgnoreCase(track.getSourceManager().getSourceName())) {
videoId = track.getInfo().identifier;
} else if (track.getInfo().isrc != null) {
// So, turns out that yt needs the ISRC in quotes. Whoops
final var searched = search(
Expand Down

0 comments on commit 96ead18

Please sign in to comment.