Skip to content

Commit 96ead18

Browse files
authored
Attempt to fix compat with the new youtube source
1 parent cb986a7 commit 96ead18

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

application/src/main/java/me/duncte123/lyrics/HttpClientProvider.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ public HttpClientProvider(AbstractRoutePlanner routePlanner, ServerConfig server
3232
rotator = new YoutubeIpRotatorSetup(routePlanner).withRetryLimit(retryLimit);
3333
}
3434

35-
rotator.forConfiguration(this.httpInterfaceManager, false).setup();
35+
rotator.forConfiguration(this.httpInterfaceManager, false)
36+
// Necessary to avoid NPEs.
37+
.withMainDelegateFilter(null)
38+
.setup();
3639
}
3740
}
3841

application/src/main/java/me/duncte123/lyrics/LyricsClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package me.duncte123.lyrics;
22

3-
import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack;
43
import com.sedmelluq.discord.lavaplayer.tools.JsonBrowser;
54
import com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface;
65
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
@@ -47,8 +46,8 @@ public Future<Lyrics> findLyrics(AudioTrack track) {
4746
try {
4847
final String videoId;
4948

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

0 commit comments

Comments
 (0)