|
@@ -17,10 +17,12 @@
|
|
|
package de.nplusc.izc.izpl.plugins.jukebox;
|
|
|
|
|
|
import de.nplusc.izc.iZpl.API.shared.InvalidPlayListFileException;
|
|
|
+import de.nplusc.izc.iZpl.API.shared.networking.Packet;
|
|
|
import java.io.IOException;
|
|
|
import java.net.ServerSocket;
|
|
|
import java.net.Socket;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
import org.apache.logging.log4j.Logger;
|
|
@@ -74,39 +76,53 @@ public class JukeboxServer implements PlaybackStatusUpdater,Backend
|
|
|
|
|
|
|
|
|
|
|
|
+ private void sendUpdate(String action,String value)
|
|
|
+ {
|
|
|
+ HashMap<String,Object> data = new HashMap<>();
|
|
|
+ final Packet response = new Packet();
|
|
|
+ data.put("RESPONSE", "UPDATE");
|
|
|
+ data.put("TOPIC", action);
|
|
|
+ data.put("VALUE", value);
|
|
|
+ response.setData(data);
|
|
|
+ currentClients.forEach((c->c.respondToLinkedClient(response)));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public void setPlayStatus(boolean playing)
|
|
|
+ {
|
|
|
+ sendUpdate("PLAYING", playing+"");
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void updateTrackLength(int length)
|
|
|
{
|
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
+ sendUpdate("LENGTH", length+"");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void updateTrackTitle(String title)
|
|
|
{
|
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
+ sendUpdate("TITLE", title+"");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void updateCurrentPlaybackPosition(int position)
|
|
|
{
|
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
+ sendUpdate("POSTITION",position+"");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void triggerTableRefresh()
|
|
|
{
|
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
+ sendUpdate("TRACKS", "");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void triggerScheduleRefresh()
|
|
|
{
|
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
+ sendUpdate("QUEUE", "");
|
|
|
}
|
|
|
|
|
|
|