Skip to content

Commit

Permalink
Switch to lavalink's new YouTube audio source manager (jagrosh#1552)
Browse files Browse the repository at this point in the history
* Switch to new lavalink's new YouTube audio source manager

* Add back setPlaylistPageCount call for the youtube audio source manager

* Manually add all the individual audio sources EXCEPT for old youtube

* Remove unused import

* Upgrade lavaplayer-youtube-source to 1.0.3

* Upgrade lavaplayer-youtube-source to 1.0.4
  • Loading branch information
MichailiK authored May 10, 2024
1 parent 6d066bd commit 45b9273
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 49 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@
<dependency>
<groupId>dev.arbjerg</groupId>
<artifactId>lavaplayer</artifactId>
<version>727959e9f621fc457b3a5adafcfffb55fdeaa538-SNAPSHOT</version>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.github.lavalink-devs</groupId>
<artifactId>lavaplayer-youtube-source</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>com.github.jagrosh</groupId>
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/com/jagrosh/jmusicbot/audio/PlayerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@

import com.dunctebot.sourcemanagers.DuncteBotSources;
import com.jagrosh.jmusicbot.Bot;
import com.sedmelluq.discord.lavaplayer.container.MediaContainerRegistry;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
import com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.bandcamp.BandcampAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.getyarn.GetyarnAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.http.HttpAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.nico.NicoAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.soundcloud.SoundCloudAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager;
import com.sedmelluq.discord.lavaplayer.source.vimeo.VimeoAudioSourceManager;
import dev.lavalink.youtube.YoutubeAudioSourceManager;
import net.dv8tion.jda.api.entities.Guild;

/**
Expand All @@ -39,9 +48,22 @@ public PlayerManager(Bot bot)
public void init()
{
TransformativeAudioSourceManager.createTransforms(bot.getConfig().getTransforms()).forEach(t -> registerSourceManager(t));
AudioSourceManagers.registerRemoteSources(this);

registerSourceManager(new YoutubeAudioSourceManager(true));

registerSourceManager(SoundCloudAudioSourceManager.createDefault());
registerSourceManager(new BandcampAudioSourceManager());
registerSourceManager(new VimeoAudioSourceManager());
registerSourceManager(new TwitchStreamAudioSourceManager());
registerSourceManager(new BeamAudioSourceManager());
registerSourceManager(new GetyarnAudioSourceManager());
registerSourceManager(new NicoAudioSourceManager());
registerSourceManager(new HttpAudioSourceManager(MediaContainerRegistry.DEFAULT_REGISTRY));

AudioSourceManagers.registerLocalSource(this);

DuncteBotSources.registerAll(this, "en-US");

source(YoutubeAudioSourceManager.class).setPlaylistPageCount(10);
}

Expand Down
44 changes: 0 additions & 44 deletions src/main/java/com/jagrosh/jmusicbot/utils/LogBackTurboFilter.java

This file was deleted.

2 changes: 0 additions & 2 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
<appender-ref ref="Simple"/>
</root>

<turboFilter class="com.jagrosh.jmusicbot.utils.LogBackTurboFilter" />

</configuration>

0 comments on commit 45b9273

Please sign in to comment.