Verder gewerkt aan VLC. Door met URL's te werken zou het een stuk makkelijker moeten worden. Toch werkt het nog niet.
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
package pm.application.vlc;
|
package pm.application.vlc;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.net.MalformedURLException;
|
||||||
import java.net.Socket;
|
import java.net.URL;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
import pm.application.cmd.CMDApplication;
|
import pm.application.cmd.CMDApplication;
|
||||||
import pm.exception.application.ApplicationInitialiseException;
|
import pm.exception.application.ApplicationInitialiseException;
|
||||||
@@ -18,9 +17,6 @@ public class VLCApplication extends CMDApplication {
|
|||||||
|
|
||||||
protected static final String HOST = "127.0.0.1"; // localhost
|
protected static final String HOST = "127.0.0.1"; // localhost
|
||||||
protected static final int PORT = 8080;
|
protected static final int PORT = 8080;
|
||||||
protected Socket socket;
|
|
||||||
PrintStream output;
|
|
||||||
Scanner feedback;
|
|
||||||
|
|
||||||
public VLCApplication() {
|
public VLCApplication() {
|
||||||
super(PROGRAM, TITLE);
|
super(PROGRAM, TITLE);
|
||||||
@@ -28,38 +24,20 @@ public class VLCApplication extends CMDApplication {
|
|||||||
|
|
||||||
public void initialise() throws ApplicationInitialiseException {
|
public void initialise() throws ApplicationInitialiseException {
|
||||||
super.initialise();
|
super.initialise();
|
||||||
connect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect() {
|
|
||||||
System.out.println("Connecting to VLC");
|
|
||||||
try {
|
|
||||||
socket = new Socket(HOST, PORT);
|
|
||||||
output = new PrintStream(socket.getOutputStream());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.out.println("Connection established");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void command(String command) {
|
public void command(String command) {
|
||||||
//String request = "GET /requests/status.xml?command=" + command + " /HTTP/1.1\r\n\n";
|
String url = "http://" + HOST + ":" + PORT;
|
||||||
output.println(request);
|
String request = "/requests/status.xml?command=" + command;
|
||||||
//System.out.printf("%s", request);
|
System.out.println(url + request);
|
||||||
/*System.out.println(request);
|
|
||||||
try {
|
try {
|
||||||
Scanner feedback = new Scanner(socket.getInputStream());
|
new URL(url + request + "\r\n\n").openConnection();
|
||||||
while(feedback.hasNext()) {
|
} catch (MalformedURLException e) {
|
||||||
System.out.printf("!!!%s!!!", feedback.nextLine());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}*/
|
} catch (IOException e) {
|
||||||
|
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user