Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavion committed Jan 15, 2017
1 parent 938c05d commit d3424a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/tsrplugin/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
package tsrplugin;

/**
*
* @author Pav
* Configuration panel for TV-Browser
* @author Pavion
*/
public class Config extends javax.swing.JPanel {

Expand Down
37 changes: 7 additions & 30 deletions src/tsrplugin/TsrPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.awt.event.ActionEvent;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
Expand All @@ -28,7 +27,7 @@
import javax.swing.Action;

/**
*
* Main class for this plugin
* @author Pavion
*/
public class TsrPlugin extends devplugin.Plugin {
Expand Down Expand Up @@ -92,9 +91,8 @@ public String getTitle() {
public ActionMenu getContextMenuActions(Program program) {
AbstractAction action = new AbstractAction() {

@Override
public void actionPerformed(ActionEvent evt) {

//Program pro = (Program) evt; //getProgramFromContextMenuActionEvent(evt);
sendAnTSR(program);
}
};
Expand All @@ -111,42 +109,25 @@ public void actionPerformed(ActionEvent evt) {
return new ActionMenu(action);
}


protected void sendAnTSR(Program program) {
try {
String url = mSettings.getProperty("URL") + "/createtvb";
//String url = "http://localhost:8030/createtvb";
String USER_AGENT = "Mozilla/5.0";



URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();

//add request header
con.setRequestMethod("POST");
//con.setRequestProperty("User-Agent", USER_AGENT);
//con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

String recname="", sender="", von="", bis="", am="";
recname = program.getTitle();
sender = program.getChannel().getName();
von = program.getTimeString();
bis = program.getEndTimeString();
String recname = program.getTitle();
String sender = program.getChannel().getName();
String von = program.getTimeString();
String bis = program.getEndTimeString();

//java.util.Date dAm =
Calendar cal = program.getDate().getCalendar();
//cal.setTime(dAm);

am = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
String am = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());

String urlParameters = String.format("recname=%s&sender=%s&von=%s&bis=%s&am=%s", recname, sender, von, bis, am);

PrintWriter out = new PrintWriter("d:/filename.txt");
out.println(recname);
out.close();


// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
Expand All @@ -169,7 +150,6 @@ protected void sendAnTSR(Program program) {
}
in.close();

//print result
//System.out.println(response.toString());
} catch (MalformedURLException ex) {
Logger.getLogger(TsrPlugin.class.getName()).log(Level.SEVERE, null, ex);
Expand All @@ -178,9 +158,6 @@ protected void sendAnTSR(Program program) {
} catch (IOException ex) {
Logger.getLogger(TsrPlugin.class.getName()).log(Level.SEVERE, null, ex);
}




}
}

0 comments on commit d3424a7

Please sign in to comment.