Skip to content

Commit

Permalink
make the value configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
jagrosh committed May 10, 2024
1 parent 5378763 commit 40c3d67
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/main/java/com/jagrosh/jmusicbot/BotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class BotConfig
successEmoji, warningEmoji, errorEmoji, loadingEmoji, searchingEmoji,
evalEngine;
private boolean stayInChannel, songInGame, npImages, updatealerts, useEval, dbots;
private long owner, maxSeconds, aloneTimeUntilStop;
private long owner, maxSeconds, aloneTimeUntilStop, maxYTPlaylistPages;
private double skipratio;
private OnlineStatus status;
private Activity game;
Expand Down Expand Up @@ -91,6 +91,7 @@ public void load()
useEval = config.getBoolean("eval");
evalEngine = config.getString("evalengine");
maxSeconds = config.getLong("maxtime");
maxYTPlaylistPages = config.getLong("maxytplaylistpages");
aloneTimeUntilStop = config.getLong("alonetimeuntilstop");
playlistsFolder = config.getString("playlistsfolder");
aliases = config.getConfig("aliases");
Expand Down Expand Up @@ -341,6 +342,11 @@ public long getMaxSeconds()
return maxSeconds;
}

public long getMaxYTPlaylistPages()
{
return maxYTPlaylistPages;
}

public String getMaxTime()
{
return TimeUtil.formatTime(maxSeconds * 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void init()
AudioSourceManagers.registerLocalSource(this);

DuncteBotSources.registerAll(this, "en-US");
source(YoutubeAudioSourceManager.class).setPlaylistPageCount(50);
source(YoutubeAudioSourceManager.class).setPlaylistPageCount((int)bot.getConfig().getMaxYTPlaylistPages());
}

public Bot getBot()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package com.jagrosh.jmusicbot.audio;

import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.track.AudioItem;
import com.sedmelluq.discord.lavaplayer.track.AudioReference;
import com.typesafe.config.Config;
import dev.lavalink.youtube.YoutubeAudioSourceManager;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ stayinchannel = false

maxtime = 0

// This sets the maximum number of pages of songs that can be loaded from a YouTube
// playlist. Each page can contain up to 100 tracks. Playing a playlist with more
// pages than the maximum will stop loading after the provided number of pages.
// For example, if the max was set to 15 and a playlist contained 1850 tracks,
// only the first 1500 tracks (15 pages) would be loaded. By default, this is
// set to 10 pages (1000 tracks).

maxytplaylistpages = 10


// This sets the ratio of users that must vote to skip the currently playing song.
// Guild owners can define their own skip ratios, but this will be used if a guild
Expand Down

0 comments on commit 40c3d67

Please sign in to comment.