OSDN Git Service

インタフェース名変更: LoginInfo -> LoginProfile
[coroid/inqubus.git] / frontend / src / saccubus / converter / filegetter / WebFileInstanciator.java
index 0401729..23940a9 100644 (file)
@@ -5,12 +5,13 @@ import java.io.IOException;
 import java.text.Normalizer;
 import org.apache.commons.lang.StringUtils;
 import saccubus.ConvertStopFlag;
-import saccubus.converter.profile.Proxy;
 import saccubus.net.CommentInfo;
 import saccubus.net.NicoClient;
 import saccubus.net.VideoInfo;
 import saccubus.util.WayBackTimeParser;
 import yukihane.inqubus.saccubus_adapter.NicoBrowserAdapter;
+import yukihane.saccubus.converter.profile.Proxy;
+import yukihane.saccubus.converter.profile.LoinProfile;
 
 /**
  * 動画ファイル, コメントファイルなど必要なファイルのうち, 1つでもダウンロード処理を必要とする場合のインスタンス化クラス.
@@ -27,7 +28,8 @@ public class WebFileInstanciator extends FileInstanciator {
             InstanciationType videoType,
             CommentInstanciationType commentType,
             InstanciationType tcommType,
-            LoginInfo li,
+            LoinProfile li,
+            Proxy proxy,
             String tag,
             String time) throws IOException {
         super(videoType, commentType, tcommType, tag);
@@ -38,9 +40,9 @@ public class WebFileInstanciator extends FileInstanciator {
 
         String host;
         int port;
-        if (li.getProxy() != Proxy.NO_PROXY) {
-            host = li.getProxy().getHost();
-            port = li.getProxy().getPort();
+        if (proxy.use()) {
+            host = proxy.getHost();
+            port = proxy.getPort();
         } else {
             host = null;
             port = -1;
@@ -59,24 +61,27 @@ public class WebFileInstanciator extends FileInstanciator {
                 final long waybacktime = WayBackTimeParser.parse(time);
                 String waybackkey = client.getWayBackKey(videoInfo);
                 commentInfo = new CommentInfo(waybackkey, waybacktime);
-            }else{
+            } else {
                 commentInfo = null;
             }
 
         } catch (IOException ex) {
-            throw new IOException(tag + "の情報の取得に失敗", ex);
+            final String text = tag + "の情報の取得に失敗";
+            final String cause = (ex.getMessage() != null) ? "(" + ex.getMessage() + ")" : "";
+
+            throw new IOException(text + cause, ex);
         }
 
-        if (videoType.isDoanload()) {
+        if (videoType.isDownload()) {
             setVideoFileGetter(new VideoFileWebGetter(client, videoInfo));
         }
 
-        if (commentType.isDoanload()) {
+        if (commentType.isDownload()) {
             setCommentFileGetter(new CommentFileWebGetter(client, videoInfo, commentInfo, commentType.isAutoCommentNum(),
-                    commentType.getBackComment()));
+                    commentType.getBackComment(), commentType.isReduceComment()));
         }
 
-        if (tcommType.isDoanload()) {
+        if (tcommType.isDownload()) {
             setTcommFileGetter(new TcommFileWebGetter(client, videoInfo));
         }
     }