diff --git a/src/tsrplugin/Config.java b/src/tsrplugin/Config.java index 2d384a9..3c25ca0 100644 --- a/src/tsrplugin/Config.java +++ b/src/tsrplugin/Config.java @@ -6,8 +6,8 @@ package tsrplugin; /** - * - * @author Pav + * Configuration panel for TV-Browser + * @author Pavion */ public class Config extends javax.swing.JPanel { diff --git a/src/tsrplugin/TsrPlugin.java b/src/tsrplugin/TsrPlugin.java index e2b4bc4..4871c2b 100644 --- a/src/tsrplugin/TsrPlugin.java +++ b/src/tsrplugin/TsrPlugin.java @@ -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; @@ -28,7 +27,7 @@ import javax.swing.Action; /** - * + * Main class for this plugin * @author Pavion */ public class TsrPlugin extends devplugin.Plugin { @@ -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); } }; @@ -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()); @@ -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); @@ -178,9 +158,6 @@ protected void sendAnTSR(Program program) { } catch (IOException ex) { Logger.getLogger(TsrPlugin.class.getName()).log(Level.SEVERE, null, ex); } - - - } }