Skip to content

Commit 49c3ec7

Browse files
MichailiKjagrosh
andauthored
Switch to lavalink's lavaplayer fork (#1490)
* Switch to lavalink's lavaplayer fork * Create logback turbofilter to suppress YouTube auth tokens warning * added license header --------- Co-authored-by: unknown <john.a.grosh@gmail.com>
1 parent 6752695 commit 49c3ec7

File tree

3 files changed

+56
-11
lines changed

3 files changed

+56
-11
lines changed

pom.xml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
<name>m2-duncte123</name>
3131
<url>https://m2.duncte123.dev/releases</url>
3232
</repository>
33+
<repository>
34+
<id>arbjergDev-snapshots</id>
35+
<name>Lavalink Repository</name>
36+
<url>https://maven.lavalink.dev/snapshots</url>
37+
</repository>
3338
</repositories>
3439

3540
<dependencies>
@@ -47,17 +52,11 @@
4752
</dependency>
4853

4954
<!-- Music Dependencies -->
50-
<!-- using a fork of this to fix some issues faster -->
51-
<!-- dependency>
52-
<groupId>com.sedmelluq</groupId>
53-
<artifactId>lavaplayer</artifactId>
54-
<version>1.3.78</version>
55-
</dependency -->
5655
<dependency>
57-
<groupId>com.github.jagrosh</groupId>
58-
<artifactId>lavaplayer</artifactId>
59-
<version>jmusicbot-SNAPSHOT</version>
60-
</dependency>
56+
<groupId>dev.arbjerg</groupId>
57+
<artifactId>lavaplayer</artifactId>
58+
<version>727959e9f621fc457b3a5adafcfffb55fdeaa538-SNAPSHOT</version>
59+
</dependency>
6160
<dependency>
6261
<groupId>com.github.jagrosh</groupId>
6362
<artifactId>JLyrics</artifactId>
@@ -68,7 +67,7 @@
6867
<artifactId>sourcemanagers</artifactId>
6968
<version>1.9.0</version>
7069
</dependency>
71-
70+
7271
<!-- Misc Internal Dependencies -->
7372
<dependency>
7473
<groupId>ch.qos.logback</groupId>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2024 John Grosh <john.a.grosh@gmail.com>.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.jagrosh.jmusicbot.utils;
17+
18+
import ch.qos.logback.classic.Level;
19+
import ch.qos.logback.classic.Logger;
20+
import ch.qos.logback.classic.turbo.TurboFilter;
21+
import ch.qos.logback.core.spi.FilterReply;
22+
import org.slf4j.Marker;
23+
24+
/**
25+
* A TurboFilter, currently only used to suppress specific log messages from libraries.
26+
*
27+
* @author Michaili K. <git@michaili.dev>
28+
*/
29+
public class LogBackTurboFilter extends TurboFilter
30+
{
31+
@Override
32+
public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t)
33+
{
34+
// Suppresses the auth token warning from the YoutubeAudioSourceManager
35+
// https://github.com/jagrosh/MusicBot/pull/1490#issuecomment-1974070225
36+
if (logger.getName().equals("com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAccessTokenTracker")
37+
&& format.equals("YouTube auth tokens can't be retrieved because email and password is not set in YoutubeAudioSourceManager, age restricted videos will throw exceptions.")
38+
) {
39+
return FilterReply.DENY;
40+
}
41+
42+
return FilterReply.NEUTRAL;
43+
}
44+
}

src/main/resources/logback.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
<appender-ref ref="Simple"/>
1515
</root>
1616

17+
<turboFilter class="com.jagrosh.jmusicbot.utils.LogBackTurboFilter" />
18+
1719
</configuration>

0 commit comments

Comments
 (0)