Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Audio Filters #809

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/target/
/Playlists/
/test/
.idea
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not modify the gitignore

Suggested change
.idea

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.idea is to be excluded tho.

*.json
*.txt
nb*.xml
88 changes: 88 additions & 0 deletions JMusicBot.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JVM 1.8" allPlatforms="JVM [1.8]" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="jvmTarget" value="1.8" />
<option name="languageVersion" value="1.4" />
<option name="apiVersion" value="1.4" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array />
</option>
<option name="errors">
<ArgumentParseErrors />
</option>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.mashape.unirest:unirest-java:1.4.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20160212" level="project" />
<orderEntry type="library" name="Maven: club.minnced:discord-webhooks:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.12.0" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.15.0" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:16.0.1" level="project" />
<orderEntry type="library" name="Maven: net.dv8tion:JDA:4.2.0_214" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.neovisionaries:nv-websocket-client:2.10" level="project" />
<orderEntry type="library" name="Maven: club.minnced:opus-java-api:1.0.4" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" name="Maven: club.minnced:opus-java-natives:1.0.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.1" level="project" />
<orderEntry type="library" name="Maven: com.sedmelluq:lavaplayer:1.3.55" level="project" />
<orderEntry type="library" name="Maven: com.sedmelluq:lava-common:1.1.2" level="project" />
<orderEntry type="library" name="Maven: com.sedmelluq:lavaplayer-natives:1.3.13" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.0" level="project" />
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.12.1" level="project" />
<orderEntry type="library" name="Maven: net.iharder:base64:2.3.9" level="project" />
<orderEntry type="library" name="Maven: com.sedmelluq:lavaplayer-natives-extra:1.3.13" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:jda-utilities-command:3.0.5" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:jda-utilities-commons:3.0.5" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:jda-utilities-doc:3.0.5" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:jda-utilities-examples:3.0.5" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:jda-utilities-menu:3.0.5" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:jda-utilities-oauth2:3.0.5" level="project" />
<orderEntry type="library" name="Maven: com.jagrosh:JLyrics:0.4" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: com.typesafe:config:1.3.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: com.github.natanbc:lavadsp:0.7.5" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: com.github.natanbc:native-loader:0.7.0" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.4.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.30" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test:1.4.30" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test-common:1.4.30" level="project" />
</component>
</module>
88 changes: 85 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@
</repositories>

<dependencies>
<!-- <dependency>-->
<!-- <groupId>com.jagrosh</groupId>-->
<!-- <artifactId>JagTag</artifactId>-->
<!-- <version>0.5</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>club.minnced</groupId>
<artifactId>discord-webhooks</artifactId>
<version>0.3.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>de.dfki.mary</groupId>-->
<!-- <artifactId>voice-cmu-slt-hsmm</artifactId>-->
<!-- <version>5.2</version>-->
<!-- </dependency>-->
Comment on lines +28 to +48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented & unused dependencies.

Suggested change
<!-- <dependency>-->
<!-- <groupId>com.jagrosh</groupId>-->
<!-- <artifactId>JagTag</artifactId>-->
<!-- <version>0.5</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>club.minnced</groupId>
<artifactId>discord-webhooks</artifactId>
<version>0.3.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>de.dfki.mary</groupId>-->
<!-- <artifactId>voice-cmu-slt-hsmm</artifactId>-->
<!-- <version>5.2</version>-->
<!-- </dependency>-->

<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
Expand Down Expand Up @@ -72,10 +93,26 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.hamcrest</groupId>-->
<!-- <artifactId>hamcrest-core</artifactId>-->
<!-- <version>1.3</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
Comment on lines +96 to +101
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented dependency.

Suggested change
<!-- <dependency>-->
<!-- <groupId>org.hamcrest</groupId>-->
<!-- <artifactId>hamcrest-core</artifactId>-->
<!-- <version>1.3</version>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->

<dependency>
<groupId>com.github.natanbc</groupId>
<artifactId>lavadsp</artifactId>
<version>0.7.5</version>
</dependency>
Comment on lines +102 to +106
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not checked, but is this dependency needed?

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
Comment on lines +107 to +111
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project does not use Kotlin.

Suggested change
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
Comment on lines -76 to +115
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project does not Kotlin. Revert this to the original state.

Suggested change
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>

<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -119,12 +156,57 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
Comment on lines +159 to +202
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project does not use Kotlin & this configuration.

Suggested change
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<kotlin.version>1.4.30</kotlin.version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project does not use Kotlin.

Suggested change
<kotlin.version>1.4.30</kotlin.version>

</properties>
</project>
10 changes: 9 additions & 1 deletion src/main/java/com/jagrosh/jmusicbot/Bot.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
import com.jagrosh.jdautilities.commons.waiter.EventWaiter;
import com.jagrosh.jmusicbot.audio.AloneInVoiceHandler;
import com.jagrosh.jmusicbot.audio.AudioHandler;
import com.jagrosh.jmusicbot.audio.FilterManager;
import com.jagrosh.jmusicbot.audio.NowplayingHandler;
import com.jagrosh.jmusicbot.audio.PlayerManager;
import com.jagrosh.jmusicbot.gui.GUI;
import com.jagrosh.jmusicbot.playlist.PlaylistLoader;
import com.jagrosh.jmusicbot.settings.SettingsManager;
import java.util.Objects;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, try to undo any of these whitespace changes. If not, I can try to remove them.

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Guild;
Expand All @@ -43,8 +45,9 @@ public class Bot
private final PlayerManager players;
private final PlaylistLoader playlists;
private final NowplayingHandler nowplaying;
private final FilterManager filterManager;
private final AloneInVoiceHandler aloneInVoiceHandler;

private boolean shuttingDown = false;
private JDA jda;
private GUI gui;
Expand All @@ -60,6 +63,7 @@ public Bot(EventWaiter waiter, BotConfig config, SettingsManager settings)
this.players.init();
this.nowplaying = new NowplayingHandler(this);
this.nowplaying.init();
this.filterManager = new FilterManager(this);
this.aloneInVoiceHandler = new AloneInVoiceHandler(this);
this.aloneInVoiceHandler.init();
}
Expand Down Expand Up @@ -158,4 +162,8 @@ public void setGUI(GUI gui)
{
this.gui = gui;
}

public FilterManager getFilterManager() {
return filterManager;
}
}
8 changes: 6 additions & 2 deletions src/main/java/com/jagrosh/jmusicbot/BotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public class BotConfig
private long owner, maxSeconds, aloneTimeUntilStop;
private OnlineStatus status;
private Activity game;
private Config aliases, transforms;
private Config aliases;

private Config config;

public Config getConfig() { return config; }
Comment on lines -49 to +53
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo this. Pass the config using a constructor


private boolean valid = false;

Expand All @@ -73,7 +77,7 @@ public void load()

// load in the config file, plus the default values
//Config config = ConfigFactory.parseFile(path.toFile()).withFallback(ConfigFactory.load());
Config config = ConfigFactory.load();
config = ConfigFactory.load();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo this. Pass the config using a constructor

Suggested change
config = ConfigFactory.load();
Config config = ConfigFactory.load();


// set values
token = config.getString("token");
Expand Down
Loading