OSDN Git Service

過去ログ取得時点をlong値に変更
authoryukihane <yukihane.feather@gmail.com>
Sat, 20 Aug 2011 00:10:48 +0000 (09:10 +0900)
committeryukihane <yukihane.feather@gmail.com>
Sat, 20 Aug 2011 00:10:48 +0000 (09:10 +0900)
frontend/src/saccubus/MainFrame.java
frontend/src/saccubus/converter/classic/profile/InputFileSetting.java
frontend/src/saccubus/converter/filegetter/FileInstanciator.java
frontend/src/saccubus/converter/filegetter/WebFileInstanciator.java
frontend/src/saccubus/prompt/Prompt.java
frontend/src/saccubus/properties/InputCommentSetting.java
frontend/src/yukihane/saccubus/converter/profile/CommentProfile.java

index 5b7c34c..40f5213 100644 (file)
@@ -58,6 +58,7 @@ import saccubus.properties.MovieSetting;
 import saccubus.properties.OutputVideoSetting;
 import saccubus.util.FileDropTarget;
 import saccubus.util.PopupRightClick;
 import saccubus.properties.OutputVideoSetting;
 import saccubus.util.FileDropTarget;
 import saccubus.util.PopupRightClick;
+import saccubus.util.WayBackTimeParser;
 import yukihane.nicovideo.NicoDBFinder;
 
 /**
 import yukihane.nicovideo.NicoDBFinder;
 
 /**
@@ -1391,8 +1392,15 @@ public class MainFrame extends JFrame {
         String folder = savePanel.getCommentSavedFolderField().getText();
         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
 
         String folder = savePanel.getCommentSavedFolderField().getText();
         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
 
+        final String txt = wayBackField.getText();
+        long backLogPoint;
+        try {
+            backLogPoint = (StringUtils.isNotBlank(txt)) ? WayBackTimeParser.parse(txt) : -1;
+        } catch (IOException ex) {
+            backLogPoint = -1;
+        }
         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
-                back_comment, reduceCommentCheckBox.isSelected(), wayBackField.getText());
+                back_comment, reduceCommentCheckBox.isSelected(), backLogPoint);
     }
 
     /**
     }
 
     /**
index 0e164fb..29da07b 100644 (file)
@@ -14,14 +14,14 @@ public class InputFileSetting implements yukihane.saccubus.converter.profile.Inp
     private final boolean download;
     private final boolean delete;
     private final CommentGetInfo commentGetInfo;
     private final boolean download;
     private final boolean delete;
     private final CommentGetInfo commentGetInfo;
-    private final String backLogPoint;
+    private final long backLogPoint;
 
     /**
      * @param file 対象ファイル.
      * @param download ダウンロードする必要があればtrue, ローカルファイルを用いるのであればfalse.
      * @param delete 変換後にファイルを削除するのであればtrue, 残したままにするのであればfalse.
      */
 
     /**
      * @param file 対象ファイル.
      * @param download ダウンロードする必要があればtrue, ローカルファイルを用いるのであればfalse.
      * @param delete 変換後にファイルを削除するのであればtrue, 残したままにするのであればfalse.
      */
-    public InputFileSetting(SFile file, boolean download, boolean delete, CommentGetInfo cominfo, String backLogPoint) {
+    public InputFileSetting(SFile file, boolean download, boolean delete, CommentGetInfo cominfo, long backLogPoint) {
         this.file = file;
         this.download = download;
         this.delete = delete;
         this.file = file;
         this.download = download;
         this.delete = delete;
@@ -59,7 +59,7 @@ public class InputFileSetting implements yukihane.saccubus.converter.profile.Inp
     }
 
     @Override
     }
 
     @Override
-    public String getBackLogPoint() {
+    public long getBackLogPoint() {
         return backLogPoint;
     }
 }
         return backLogPoint;
     }
 }
index 1bffb42..e9a8e7a 100644 (file)
@@ -44,7 +44,8 @@ public class FileInstanciator {
             InstanciationType tcommType,
             LoinProfile li,
             ProxyProfile proxy,
             InstanciationType tcommType,
             LoinProfile li,
             ProxyProfile proxy,
-            String tag, String time) throws
+            String tag,
+            long time) throws
             IOException {
         FileInstanciator getter;
         if (videoType.isDownload() || commentType.isDownload() || tcommType.isDownload()) {
             IOException {
         FileInstanciator getter;
         if (videoType.isDownload() || commentType.isDownload() || tcommType.isDownload()) {
index 5d72627..730c151 100644 (file)
@@ -31,7 +31,7 @@ public class WebFileInstanciator extends FileInstanciator {
             LoinProfile li,
             ProxyProfile proxy,
             String tag,
             LoinProfile li,
             ProxyProfile proxy,
             String tag,
-            String time) throws IOException {
+            long time) throws IOException {
         super(videoType, commentType, tcommType, tag);
 
         if (li.getMail() == null || li.getPass() == null || li.getMail().equals("") || li.getPass().equals("")) {
         super(videoType, commentType, tcommType, tag);
 
         if (li.getMail() == null || li.getPass() == null || li.getMail().equals("") || li.getPass().equals("")) {
@@ -56,9 +56,9 @@ public class WebFileInstanciator extends FileInstanciator {
 
         try {
             videoInfo = client.getVideoInfo(tag);
 
         try {
             videoInfo = client.getVideoInfo(tag);
-            if (StringUtils.isNotBlank(time)) {
+            if (time >= 0) {
                 System.out.print("Setting wayback time...");
                 System.out.print("Setting wayback time...");
-                final long waybacktime = WayBackTimeParser.parse(time);
+                final long waybacktime = time;
                 String waybackkey = client.getWayBackKey(videoInfo);
                 commentInfo = new CommentInfo(waybackkey, waybacktime);
             } else {
                 String waybackkey = client.getWayBackKey(videoInfo);
                 commentInfo = new CommentInfo(waybackkey, waybacktime);
             } else {
index 21111d1..e969693 100644 (file)
@@ -139,9 +139,9 @@ public class Prompt {
 
         FfmpegOption newFfmpegOption = new FfmpegOption(ffmpeg.getFfmpegOption().getExtOption(), "", "", ff, "", false,
                 "", "", false);
 
         FfmpegOption newFfmpegOption = new FfmpegOption(ffmpeg.getFfmpegOption().getExtOption(), "", "", ff, "", false,
                 "", "", false);
-        InputFileSetting newVideoSetting = new InputFileSetting(new SFile(true, new File(video)), false, false, commentGetInfo, "");
-        InputFileSetting newCommentSetting = new InputFileSetting(new SFile(true, new File(comm)), false, false, commentGetInfo, "");
-        InputFileSetting newTcommentSetting = new InputFileSetting(new SFile(true, new File(tcomm)), false, false, commentGetInfo, "");
+        InputFileSetting newVideoSetting = new InputFileSetting(new SFile(true, new File(video)), false, false, commentGetInfo, -1);
+        InputFileSetting newCommentSetting = new InputFileSetting(new SFile(true, new File(comm)), false, false, commentGetInfo, -1);
+        InputFileSetting newTcommentSetting = new InputFileSetting(new SFile(true, new File(tcomm)), false, false, commentGetInfo, -1);
         OutputFileSetting newOutputFileSetting = new OutputFileSetting(new SFile(true, new File(output)), true, false,
                 true, true);
         Ffmpeg newFfmpeg = new Ffmpeg(ffmpeg.getFfmpeg(), ffmpeg.getVhook(), newFfmpegOption, ffmpeg.isVhookDisabled(), ffmpeg.
         OutputFileSetting newOutputFileSetting = new OutputFileSetting(new SFile(true, new File(output)), true, false,
                 true, true);
         Ffmpeg newFfmpeg = new Ffmpeg(ffmpeg.getFfmpeg(), ffmpeg.getVhook(), newFfmpegOption, ffmpeg.isVhookDisabled(), ffmpeg.
index 69b7eb4..003bbf4 100644 (file)
@@ -27,10 +27,10 @@ public class InputCommentSetting extends InputFileSetting<Boolean> {
     private final boolean selfAdjustNumOfComment;
     private final int numOfComment;
     private final boolean reduceComment;
     private final boolean selfAdjustNumOfComment;
     private final int numOfComment;
     private final boolean reduceComment;
-    private final String backLogPoint;
+    private final long backLogPoint;
 
     public InputCommentSetting(boolean download, boolean autoNaming, File folder, File file, boolean deleteAfterConvert,
 
     public InputCommentSetting(boolean download, boolean autoNaming, File folder, File file, boolean deleteAfterConvert,
-            boolean adjust, int numOfCom, boolean reduceComment, String backLogPoint) {
+            boolean adjust, int numOfCom, boolean reduceComment, long backLogPoint) {
         super(Boolean.valueOf(download), autoNaming, folder, file, deleteAfterConvert);
         this.selfAdjustNumOfComment = adjust;
         this.numOfComment = numOfCom;
         super(Boolean.valueOf(download), autoNaming, folder, file, deleteAfterConvert);
         this.selfAdjustNumOfComment = adjust;
         this.numOfComment = numOfCom;
@@ -61,7 +61,7 @@ public class InputCommentSetting extends InputFileSetting<Boolean> {
 
         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete,
                 adjustNumOfComment,
 
         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete,
                 adjustNumOfComment,
-                Integer.parseInt(numOfComment), false, "");
+                Integer.parseInt(numOfComment), false, -1);
     }
 
     public final boolean isSelfAdjustNumOfComment() {
     }
 
     public final boolean isSelfAdjustNumOfComment() {
@@ -76,7 +76,7 @@ public class InputCommentSetting extends InputFileSetting<Boolean> {
         return reduceComment;
     }
 
         return reduceComment;
     }
 
-    public String getBackLogPoint() {
+    public long getBackLogPoint() {
         return backLogPoint;
     }
 }
         return backLogPoint;
     }
 }
index c1a65cb..8e3305b 100644 (file)
@@ -12,7 +12,9 @@ public interface CommentProfile extends InputFileSetting {
 
     boolean isReduceComment();
 
 
     boolean isReduceComment();
 
-    // TODO 戻り値はlongにする
-    /** @過去ログを取得する時点 */
-    String getBackLogPoint();
+    /**
+     * @return 過去ログを取得する時点. 1970/1/1 00:00:00 GMT からの経過秒数(ミリ秒ではない).
+     * マイナス値指定の場合は過去ログ取得ではない.
+     */
+    long getBackLogPoint();
 }
 }