From 530afaea30c2d13be6c8dea611a59c7d961aa693 Mon Sep 17 00:00:00 2001 From: genuineparts Date: Tue, 17 Jan 2017 22:26:08 +0100 Subject: [PATCH] Language for Tray start #36 , Making Metadata updater more verbose --- src/main/java/at/becast/youploader/gui/FrmMain.java | 2 +- .../youploader/youtube/upload/MetadataUpdater.java | 13 ++++++++++--- src/main/resources/lang/lang.properties | 1 + src/main/resources/lang/lang_de.properties | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/becast/youploader/gui/FrmMain.java b/src/main/java/at/becast/youploader/gui/FrmMain.java index 29f61df..6033c59 100644 --- a/src/main/java/at/becast/youploader/gui/FrmMain.java +++ b/src/main/java/at/becast/youploader/gui/FrmMain.java @@ -743,7 +743,7 @@ public void actionPerformed(ActionEvent evt) { } }); - chkstartintray = new JCheckBoxMenuItem("Start in Tray"); + chkstartintray = new JCheckBoxMenuItem(LANG.getString("frmMain.menu.StartinTray")); if(Main.s.get("startintray").equals("1")){ chkstartintray.setSelected(true); } diff --git a/src/main/java/at/becast/youploader/youtube/upload/MetadataUpdater.java b/src/main/java/at/becast/youploader/youtube/upload/MetadataUpdater.java index 93d647b..c74dbfd 100644 --- a/src/main/java/at/becast/youploader/youtube/upload/MetadataUpdater.java +++ b/src/main/java/at/becast/youploader/youtube/upload/MetadataUpdater.java @@ -65,9 +65,10 @@ public void updateMetadata() throws IOException { con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", Main.APP_NAME+" "+Main.VERSION); int responseCode = con.getResponseCode(); - System.out.println("\nSending 'GET' request to URL : " + url); - System.out.println("Response Code : " + responseCode); - + if(Main.debug){ + LOG.debug("Sending 'GET' request to URL: {}", url); + LOG.debug("Response Code : {}", responseCode); + } BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; @@ -76,6 +77,9 @@ public void updateMetadata() throws IOException { while ((inputLine = in.readLine()) != null) { response.append(inputLine); } + if(Main.debug){ + LOG.debug("Response: {}", response.toString()); + } in.close(); updateAsBrowser(response.toString()); @@ -91,6 +95,9 @@ private void updateAsBrowser(String body) throws IOException { if (m.find( )) { token = m.group().replace("var session_token = \"", "").replace("\";", "");; LOG.debug("Got Token {}",token); + }else{ + LOG.error("Token not found!"); + return; } Map mdata = new HashMap(); mdata.put("creator_share_feeds", "yes"); diff --git a/src/main/resources/lang/lang.properties b/src/main/resources/lang/lang.properties index c17ed44..dbf5503 100644 --- a/src/main/resources/lang/lang.properties +++ b/src/main/resources/lang/lang.properties @@ -24,6 +24,7 @@ frmMain.menu.UploadLatestLogfile = Upload latest logfile frmMain.menu.CheckforUpdates = Check for Updates frmMain.menu.Templates = Templates frmMain.menu.addTemplate = Add Template +frmMain.menu.StartinTray = Start in tray frmMain.tos.Title=Terms of Service frmMain.tos.Message=By clicking 'Start,' you certify that you own all rights to the content or that you are\nauthorized by the owner to make the content publicly available on YouTube, and that it otherwise complies\nwith the YouTube Terms of Service located at http://www.youtube.com/t/terms frmMain.tos.Remember=Do not show this message again. diff --git a/src/main/resources/lang/lang_de.properties b/src/main/resources/lang/lang_de.properties index 1030837..80a7bbd 100644 --- a/src/main/resources/lang/lang_de.properties +++ b/src/main/resources/lang/lang_de.properties @@ -24,6 +24,7 @@ frmMain.menu.UploadLatestLogfile = aktuelle Logdatei hochladen frmMain.menu.CheckforUpdates = Auf Aktualisierungen prüfen frmMain.menu.Templates = Templates frmMain.menu.addTemplate = Template hinzufügen +frmMain.menu.StartinTray = Starte im Tray frmMain.tos.Title=Nutzungsbedingungen frmMain.tos.Message=Mit Klicken auf 'Start' versichern Sie, dass Sie alle Rechte an den Inhalten besitzen oder von ihren Inhabern\ndie Erlaubnis erhalten haben, sie auf YouTube öffentlich zu verbreiten und dass Sie weiterhin die\nYouTube-Nutzungsbedingungen unter https://www.youtube.com/static?gl=DE&template=terms&hl=de erfüllen. frmMain.tos.Remember=Diese Nachricht nicht erneut anzeigen.