Skip to content

Commit

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

public long getMaxYTPlaylistPages()
public int getMaxYTPlaylistPages()
{
return maxYTPlaylistPages;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/jagrosh/jmusicbot/audio/PlayerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public void init()
{
TransformativeAudioSourceManager.createTransforms(bot.getConfig().getTransforms()).forEach(t -> registerSourceManager(t));

registerSourceManager(new YoutubeAudioSourceManager(true));
YoutubeAudioSourceManager yt = new YoutubeAudioSourceManager(true);
yt.setPlaylistPageCount(bot.getConfig().getMaxYTPlaylistPages());
registerSourceManager(yt);

registerSourceManager(SoundCloudAudioSourceManager.createDefault());
registerSourceManager(new BandcampAudioSourceManager());
Expand All @@ -63,7 +65,6 @@ public void init()
AudioSourceManagers.registerLocalSource(this);

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

public Bot getBot()
Expand Down

0 comments on commit 8f31db5

Please sign in to comment.