Skip to content

Commit d55ec05

Browse files
authored
Merge pull request #194 from duncte123/ytsearch-toggle
Add option to disable ytsearch and scsearch
2 parents 95658cd + 23b8ff2 commit d55ec05

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

LavalinkServer/application.yml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ lavalink:
1818
local: false
1919
bufferDurationMs: 400
2020
youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
21+
youtubeSearchEnabled: true
22+
soundcloudSearchEnabled: true
2123
gc-warnings: true
2224

2325
metrics:

LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public Supplier<AudioPlayerManager> audioPlayerManagerSupplier(AudioSourcesConfi
3131
}
3232

3333
if (sources.isYoutube()) {
34-
YoutubeAudioSourceManager youtube = new YoutubeAudioSourceManager();
34+
YoutubeAudioSourceManager youtube = new YoutubeAudioSourceManager(serverConfig.isYoutubeSearchEnabled());
3535
Integer playlistLoadLimit = serverConfig.getYoutubePlaylistLoadLimit();
3636

3737
if (playlistLoadLimit != null) youtube.setPlaylistPageCount(playlistLoadLimit);
3838
audioPlayerManager.registerSourceManager(youtube);
3939
}
4040
if (sources.isBandcamp()) audioPlayerManager.registerSourceManager(new BandcampAudioSourceManager());
41-
if (sources.isSoundcloud()) audioPlayerManager.registerSourceManager(new SoundCloudAudioSourceManager());
41+
if (sources.isSoundcloud()) audioPlayerManager.registerSourceManager(new SoundCloudAudioSourceManager(serverConfig.isSoundcloudSearchEnabled()));
4242
if (sources.isTwitch()) audioPlayerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
4343
if (sources.isVimeo()) audioPlayerManager.registerSourceManager(new VimeoAudioSourceManager());
4444
if (sources.isMixer()) audioPlayerManager.registerSourceManager(new BeamAudioSourceManager());

LavalinkServer/src/main/java/lavalink/server/config/ServerConfig.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public class ServerConfig {
3838
@Nullable
3939
private Integer youtubePlaylistLoadLimit;
4040
private boolean gcWarnings = true;
41+
private boolean youtubeSearchEnabled = true;
42+
private boolean soundcloudSearchEnabled = true;
4143

4244
public String getPassword() {
4345
return password;
@@ -84,4 +86,20 @@ public boolean isGcWarnings() {
8486
public void setGcWarnings(boolean gcWarnings) {
8587
this.gcWarnings = gcWarnings;
8688
}
89+
90+
public boolean isYoutubeSearchEnabled() {
91+
return youtubeSearchEnabled;
92+
}
93+
94+
public void setYoutubeSearchEnabled(boolean youtubeSearchEnabled) {
95+
this.youtubeSearchEnabled = youtubeSearchEnabled;
96+
}
97+
98+
public boolean isSoundcloudSearchEnabled() {
99+
return soundcloudSearchEnabled;
100+
}
101+
102+
public void setSoundcloudSearchEnabled(boolean soundcloudSearchEnabled) {
103+
this.soundcloudSearchEnabled = soundcloudSearchEnabled;
104+
}
87105
}

0 commit comments

Comments
 (0)