OSDN Git Service

過去ログ取得時点をConverterコンストラクタ引数からProfileに移動
[coroid/inqubus.git] / frontend / src / saccubus / converter / Converter.java
index e9f9cb5..84c934f 100644 (file)
@@ -23,11 +23,10 @@ import yukihane.saccubus.converter.profile.Profile;
  * @author 未入力
  * @version 1.0
  */
-public class Converter extends AbstractCommand implements Runnable, Callable<Boolean> {
+public class Converter extends AbstractCommand implements Callable<Boolean> {
 
     private final Profile profile;
     private final String movieId;
-    private final String time;
 
     /**
      * コンバータを構築します.
@@ -37,7 +36,7 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
      * @param listener
      * @param flag
      */
-    public Converter(String url, String time, Profile profile,
+    public Converter(String url, Profile profile,
             TextProgressListener listener, ConvertStopFlag flag) {
         super(listener, flag);
 
@@ -52,10 +51,10 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
             throw new IllegalArgumentException("URL/IDの指定が不正です: " + url);
         }
 
-        this.time = time;
         this.profile = profile;
     }
 
+    @Override
     public Boolean call() throws Exception {
         boolean result = false;
         try {
@@ -66,6 +65,7 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
         return Boolean.valueOf(result);
     }
 
+    // TODO Runnableを実装しなくなったので削除する
     public void run() {
         try {
             call();
@@ -101,7 +101,7 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
 
         File tcommFile = fi.getTcommFile(getListener());
 
-        if (!profile.needsConvert()) {
+        if (!profile.getOutputFileSetting().isConvert()) {
             sendText("動画・コメントを保存し、変換は行いませんでした。");
             return true;
         }
@@ -156,14 +156,14 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
         FileInstanciator.InstanciationType videoType = new FileInstanciator.InstanciationType(profile.getVideoSetting());
 
         FileInstanciator.CommentInstanciationType commentType = new FileInstanciator.CommentInstanciationType(profile.
-                getCommentSetting(), profile.getCommentGetInfo().isSelfAdjustCommentNum(), profile.getCommentGetInfo().
-                getBackComment(), profile.getCommentGetInfo().isReduceComment());
+                getCommentSetting(), profile.getCommentSetting().isSelfAdjustCommentNum(), profile.getCommentSetting().
+                getBackComment(), profile.getCommentSetting().isReduceComment());
 
         FileInstanciator.InstanciationType tcommType = new FileInstanciator.InstanciationType(
-                profile.getTcommentSetting());
+                profile.getCommentSetting());
 
         fi = FileInstanciator.create(getStopFlag(), videoType, commentType, tcommType, profile.getLoginInfo(), profile.
-                getProxySetting(), movieId, time);
+                getProxySetting(), movieId, profile.getCommentSetting().getBackLogPoint());
         return fi;
     }
 
@@ -172,7 +172,7 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
      * @throws IllegalArgumentException 設定に不備がある場合.
      */
     private void validSetting() {
-        if (profile.needsConvert()) {
+        if (profile.getOutputFileSetting().isConvert()) {
             File a = profile.getFfmpeg().getFfmpeg();
             if (!a.canRead()) {
                 throw new IllegalArgumentException("FFmpegが見つかりません。");
@@ -211,7 +211,6 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
 
     /** @return 何かダウンロードするものがあればtrue. */
     private static boolean needsDownload(Profile profile) {
-        return (profile.getVideoSetting().isDownload() || profile.getCommentSetting().isDownload() || profile.
-                getTcommentSetting().isDownload());
+        return (profile.getVideoSetting().isDownload() || profile.getCommentSetting().isDownload());
     }
 }