Allowed all logging to be viewed by the interface.

It is just much easier this way.
This commit is contained in:
Markil3
2021-10-09 15:52:34 -06:00
parent 72ccfbc444
commit a92d686ddb
17 changed files with 1087 additions and 138 deletions

View File

@@ -56,4 +56,10 @@ mainClassName = defaultPackage + '.PlayerEnvironment'
artifacts {
install(distTar)
}
}
processResources {
filesMatching("**/log4j2.xml") {
expand(rootProject.properties)
}
}

View File

@@ -131,8 +131,8 @@ public class PlayerEnvironment
}
}
private static void init(HashMap<String, Object> ops,
ArrayList<String> params)
public static void init(Map<String, Object> ops,
List<String> params)
{
/*
* Add this just in case of a crash or something. It won't work if the
@@ -154,25 +154,28 @@ public class PlayerEnvironment
queue.addSongChangeListener(queue1 -> ForkJoinPool.commonPool().submit(() -> {
ForkJoinTask<Void> command = PlayerManager.getPlayers()
.stopSong();
command.join();
if (command.isCompletedAbnormally())
if (command != null)
{
logger.error("Could not run command",
command.getException());
if (Interface.getInstance() != null)
command.join();
if (command.isCompletedAbnormally())
{
JOptionPane
.showMessageDialog(Interface.getInstance(),
command.getException(),
command.getException().getMessage(),
JOptionPane.ERROR_MESSAGE);
logger.error("Could not run command",
command.getException());
if (Interface.getInstance() != null)
{
JOptionPane
.showMessageDialog(Interface.getInstance(),
command.getException(),
command.getException().getMessage(),
JOptionPane.ERROR_MESSAGE);
}
}
}
else if (queue1.getCurrentSong() != null)
if (queue1.getCurrentSong() != null)
{
command =
PlayerManager.getPlayers()
.playSong(queue1.getCurrentSong());
.playSong(queue1.getCurrentSong());
command.join();
if (command.isCompletedAbnormally())
{
@@ -249,7 +252,6 @@ public class PlayerEnvironment
else
{
equals = args[i].length();
valStr = null;
}
key = args[i].substring(2, equals);
}
@@ -478,7 +480,7 @@ public class PlayerEnvironment
.map(Map.Entry::getKey)
.collect(Collectors.toList());
Collections.reverse(songs);
out.println("Playing " + songs.toString());
out.println("Playing " + songs);
Queue.getInstance().addAll(songs);
}
}