VLCApplication verder geimplementeerd. Op dit moment werkt het niet, ik heb geen idee waarom hij niet reageerd. Via netcat werkt hetzelfde commando wel.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package pm.application.vlc;
|
package pm.application.vlc;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
@@ -12,10 +13,12 @@ public class VLCApplication extends CMDApplication {
|
|||||||
protected final static String PROGRAM = "vlc.exe";
|
protected final static String PROGRAM = "vlc.exe";
|
||||||
protected final static String TITLE = "VLC media player";
|
protected final static String TITLE = "VLC media player";
|
||||||
|
|
||||||
protected static final String HOST = "127.0.0.1"; // localhost
|
protected static final int POSTION_CHANGE_RATE = 1;
|
||||||
|
protected static final int VOLUME_CHANGE_RATE = 20;
|
||||||
|
|
||||||
|
protected static final String HOST = "192.168.1.105"; // localhost
|
||||||
protected static final int PORT = 8080;
|
protected static final int PORT = 8080;
|
||||||
protected Socket socket;
|
protected Socket socket;
|
||||||
Scanner input;
|
|
||||||
PrintStream output;
|
PrintStream output;
|
||||||
Scanner feedback;
|
Scanner feedback;
|
||||||
|
|
||||||
@@ -26,63 +29,74 @@ public class VLCApplication extends CMDApplication {
|
|||||||
public void initialise() throws ApplicationInitialiseException {
|
public void initialise() throws ApplicationInitialiseException {
|
||||||
super.initialise();
|
super.initialise();
|
||||||
connect();
|
connect();
|
||||||
test();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
System.out.println("Connecting to VLC");
|
System.out.println("Connecting to VLC");
|
||||||
try {
|
try {
|
||||||
socket = new Socket(HOST, PORT);
|
socket = new Socket(HOST, PORT);
|
||||||
input = new Scanner(System.in);
|
|
||||||
output = new PrintStream(socket.getOutputStream());
|
output = new PrintStream(socket.getOutputStream());
|
||||||
feedback = new Scanner(socket.getInputStream());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println("Connection established");
|
System.out.println("Connection established");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test() {
|
public void command(String command) {
|
||||||
output.println("GET /requests/status.xml?command=volume&val=-20 HTTP/1.1\r\n");
|
String request = "GET /requests/status.xml?command=" + command + " /HTTP/1.1\r\n\n";
|
||||||
|
output.println(request);
|
||||||
|
/*System.out.println(request);
|
||||||
|
try {
|
||||||
|
Scanner feedback = new Scanner(socket.getInputStream());
|
||||||
while(feedback.hasNext()) {
|
while(feedback.hasNext()) {
|
||||||
String message = feedback.next();
|
System.out.printf("!!!%s!!!", feedback.nextLine());
|
||||||
System.out.printf("%s", message);
|
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//System.out.println("GET /requests/status.xml?command=" + command + " /HTTP/1.1\r\n");
|
||||||
|
// Voorbeeld
|
||||||
|
// GET /requests/status.xml?command=volume&val=+20 HTTP/1.1
|
||||||
}
|
}
|
||||||
|
|
||||||
public void action(Action action) {
|
public void action(Action action) {
|
||||||
System.out.println("VLCApplication: " + action);/*
|
System.out.println("VLCApplication: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command(18808);
|
command("pl_pause");
|
||||||
break;
|
break;
|
||||||
case NEXT:
|
case NEXT:
|
||||||
command(18811);
|
command("pl_next");
|
||||||
break;
|
break;
|
||||||
case PREVIOUS:
|
case PREVIOUS:
|
||||||
command(18810);
|
command("pl_previous");
|
||||||
break;
|
break;
|
||||||
case FORWARD:
|
case FORWARD:
|
||||||
command(18813);
|
command("command=seek&val=+" + POSTION_CHANGE_RATE);
|
||||||
break;
|
break;
|
||||||
case REWIND:
|
case REWIND:
|
||||||
command(18814);
|
command("command=seek&val=-" + POSTION_CHANGE_RATE);
|
||||||
break;
|
break;
|
||||||
case MUTE:
|
case MUTE:
|
||||||
command(18817);
|
/*
|
||||||
|
* Nog implementeren
|
||||||
|
* command=volume&val=
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
case VOLUME_UP:
|
case VOLUME_UP:
|
||||||
command(18815);
|
command("volume&val=+" + VOLUME_CHANGE_RATE);
|
||||||
break;
|
break;
|
||||||
case VOLUME_DOWN:
|
case VOLUME_DOWN:
|
||||||
command(18816);
|
command("volume&val=-" + VOLUME_CHANGE_RATE);
|
||||||
break;
|
break;
|
||||||
case SHUFFLE:
|
case SHUFFLE:
|
||||||
command(18842);
|
command("command=pl_random");
|
||||||
break;
|
break;
|
||||||
case REPEAT:
|
case REPEAT:
|
||||||
command(18843);
|
command("command=pl_repeat");
|
||||||
break;
|
break;
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user