From 7edd0ed0d3d7be8547e02cbc6f0990f77306e77c Mon Sep 17 00:00:00 2001 From: Michaili K Date: Tue, 5 Mar 2024 01:38:04 +0100 Subject: [PATCH] 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 --- pom.xml | 21 +++++---- .../jmusicbot/utils/LogBackTurboFilter.java | 44 +++++++++++++++++++ src/main/resources/logback.xml | 2 + 3 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/jagrosh/jmusicbot/utils/LogBackTurboFilter.java diff --git a/pom.xml b/pom.xml index 04f5444ae..699eeb5c1 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,11 @@ m2-duncte123 https://m2.duncte123.dev/releases + + arbjergDev-snapshots + Lavalink Repository + https://maven.lavalink.dev/snapshots + @@ -47,17 +52,11 @@ - - - com.github.jagrosh - lavaplayer - jmusicbot-SNAPSHOT - + dev.arbjerg + lavaplayer + 727959e9f621fc457b3a5adafcfffb55fdeaa538-SNAPSHOT + com.github.jagrosh JLyrics @@ -68,7 +67,7 @@ sourcemanagers 1.9.0 - + ch.qos.logback diff --git a/src/main/java/com/jagrosh/jmusicbot/utils/LogBackTurboFilter.java b/src/main/java/com/jagrosh/jmusicbot/utils/LogBackTurboFilter.java new file mode 100644 index 000000000..c991a07ec --- /dev/null +++ b/src/main/java/com/jagrosh/jmusicbot/utils/LogBackTurboFilter.java @@ -0,0 +1,44 @@ +/* + * Copyright 2024 John Grosh . + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.jagrosh.jmusicbot.utils; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.turbo.TurboFilter; +import ch.qos.logback.core.spi.FilterReply; +import org.slf4j.Marker; + +/** + * A TurboFilter, currently only used to suppress specific log messages from libraries. + * + * @author Michaili K. + */ +public class LogBackTurboFilter extends TurboFilter +{ + @Override + public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) + { + // Suppresses the auth token warning from the YoutubeAudioSourceManager + // https://github.com/jagrosh/MusicBot/pull/1490#issuecomment-1974070225 + if (logger.getName().equals("com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAccessTokenTracker") + && format.equals("YouTube auth tokens can't be retrieved because email and password is not set in YoutubeAudioSourceManager, age restricted videos will throw exceptions.") + ) { + return FilterReply.DENY; + } + + return FilterReply.NEUTRAL; + } +} diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 4a7033f5d..1d03fcc22 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -14,4 +14,6 @@ + +