Skip to content

Commit

Permalink
Merge pull request #60 from Devoxin/master
Browse files Browse the repository at this point in the history
Add ability to configure playlist import limit
  • Loading branch information
freyacodes authored Feb 1, 2018
2 parents c620896 + 0097ebd commit 70b99d4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
9 changes: 9 additions & 0 deletions IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,12 @@ Response:
```json
{"op":4,"d":{"self_deaf":false,"guild_id":"GUILD_ID_HERE","channel_id":null,"self_mute":false}}
```

# Common pitfalls
Admidtedly Lavalink isn't inherently the most intuitive thing ever, and people tend to run into the same mistakes over again. Please double check the following if you run into problems developing your client and you can't connect to a voice channel or play audio:

1. Check that you are forwarding sendWS events to **Discord**.
2. Check that you are intercepting **VOICE_SERVER_UPDATE**s to **Lavalink**. Do not edit the event object from Discord.
3. Check that you aren't expecting to hear audio when you have forgotten to queue something up OR forgotten to join a voice channel.
4. Check that you are not trying to create a voice connection with your Discord library.
5. When in doubt, check the debug logfile at `/logs/debug.log`.
7 changes: 7 additions & 0 deletions LavalinkClient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,10 @@ Useful methods:
* `isAvailable()` Whether or not we are connected and can play music.
* `getRemoteUri()` Returns a `URI` of the remote address.
* `getStats()` Returns a nullable `RemoteStats` object, with statistics from the Lavalink Server. Updated every minute.

# Common pitfalls
If you are experiencing problems with playing audio or joining a voice channel with Lavalink please check to see if all these apply to you:

1. You are adding the Lavalink instance to your JDABuilder *before* building it. Lavalink must be able to receive the ready event.
2. You don't have multiple Lavalink instances.
3. You don't attempt to join a voice channel via JDA directly.
1 change: 1 addition & 0 deletions LavalinkServer/application.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ lavalink:
local: false
sentryDsn: ""
bufferDurationMs: 400
youtubePlaylistLoadLimit: 600
12 changes: 12 additions & 0 deletions LavalinkServer/src/main/java/lavalink/server/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ public void setBufferDurationMs(@Nullable Integer bufferDurationMs) {
this.bufferDurationMs = bufferDurationMs;
}

@Nullable
private Integer youtubePlaylistLoadLimit;

@Nullable
public Integer getYoutubePlaylistLoadLimit() {
return youtubePlaylistLoadLimit;
}

public void setYoutubePlaylistLoadLimit(@Nullable Integer youtubePlaylistLoadLimit) {
this.youtubePlaylistLoadLimit = youtubePlaylistLoadLimit;
}

public static class Sources {

private boolean youtube = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ public class Player extends AudioEventAdapter implements AudioSendHandler {
PLAYER_MANAGER.enableGcMonitoring();

Config.Sources sources = Launcher.config.getSources();
if (sources.isYoutube()) PLAYER_MANAGER.registerSourceManager(new YoutubeAudioSourceManager());
if (sources.isYoutube()) {
YoutubeAudioSourceManager youtube = new YoutubeAudioSourceManager();
Integer playlistLoadLimit = Launcher.config.getYoutubePlaylistLoadLimit();

if (playlistLoadLimit != null) youtube.setPlaylistPageCount(playlistLoadLimit);
PLAYER_MANAGER.registerSourceManager(new YoutubeAudioSourceManager());
}
if (sources.isBandcamp()) PLAYER_MANAGER.registerSourceManager(new BandcampAudioSourceManager());
if (sources.isSoundcloud()) PLAYER_MANAGER.registerSourceManager(new SoundCloudAudioSourceManager());
if (sources.isTwitch()) PLAYER_MANAGER.registerSourceManager(new TwitchStreamAudioSourceManager());
Expand Down

0 comments on commit 70b99d4

Please sign in to comment.