OSDN Git Service

LoginInfoからProxyを分離
authoryukihane <yukihane.feather@gmail.com>
Sun, 26 Jun 2011 08:40:56 +0000 (17:40 +0900)
committeryukihane <yukihane.feather@gmail.com>
Sun, 26 Jun 2011 08:42:26 +0000 (17:42 +0900)
frontend/src/saccubus/converter/Converter.java
frontend/src/saccubus/converter/classic/profile/Profile.java
frontend/src/saccubus/converter/classic/profile/Proxy.java
frontend/src/saccubus/converter/filegetter/FileInstanciator.java
frontend/src/saccubus/converter/filegetter/WebFileInstanciator.java
frontend/src/yukihane/saccubus/converter/profile/LoginInfo.java
frontend/src/yukihane/saccubus/converter/profile/Profile.java
frontend/src/yukihane/saccubus/converter/profile/Proxy.java

index be10f96..677a8aa 100644 (file)
@@ -171,8 +171,8 @@ public class Converter extends AbstractCommand implements Runnable, Callable<Boo
         FileInstanciator.InstanciationType tcommType = new FileInstanciator.InstanciationType(
                 profile.getTcommentSetting());
 
-        fi = FileInstanciator.create(getStopFlag(), videoType, commentType, tcommType, profile.getLoginInfo(), movieId,
-                time);
+        fi = FileInstanciator.create(getStopFlag(), videoType, commentType, tcommType, profile.getLoginInfo(), profile.
+                getProxySetting(), movieId, time);
         return fi;
     }
 
index 357ec66..82061b2 100644 (file)
@@ -41,6 +41,11 @@ public class Profile implements yukihane.saccubus.converter.profile.Profile {
     }
 
     @Override
+    public Proxy getProxySetting(){
+        return loginInfo.getProxy();
+    }
+
+    @Override
     public InputFileSetting getVideoSetting() {
         return videoSetting;
     }
index f2a339d..a42ee6c 100644 (file)
@@ -26,6 +26,10 @@ public class Proxy implements yukihane.saccubus.converter.profile.Proxy {
         this.port = port;
     }
 
+    public boolean use(){
+        return this != NO_PROXY;
+    }
+
     public String getHost() {
         return host;
     }
index 93b175d..15e2962 100644 (file)
@@ -9,6 +9,7 @@ import saccubus.ConvertStopFlag;
 import yukihane.saccubus.converter.profile.InputFileSetting;
 import saccubus.net.TextProgressListener;
 import yukihane.saccubus.converter.profile.LoginInfo;
+import yukihane.saccubus.converter.profile.Proxy;
 
 /**
  * ダウンロード処理を全く必要としない場合のファイルインスタンス化クラス.
@@ -42,11 +43,12 @@ public class FileInstanciator {
             CommentInstanciationType commentType,
             InstanciationType tcommType,
             LoginInfo li,
+            Proxy proxy,
             String tag, String time) throws
             IOException {
         FileInstanciator getter;
         if (videoType.isDoanload() || commentType.isDoanload() || tcommType.isDoanload()) {
-            getter = new WebFileInstanciator(stopFlag, videoType, commentType, tcommType, li, tag, time);
+            getter = new WebFileInstanciator(stopFlag, videoType, commentType, tcommType, li, proxy, tag, time);
         } else {
             getter = new FileInstanciator(videoType, commentType, tcommType, tag);
         }
index e0aa278..ec0eb0b 100644 (file)
@@ -4,9 +4,9 @@ package saccubus.converter.filegetter;
 import java.io.IOException;
 import java.text.Normalizer;
 import saccubus.ConvertStopFlag;
-import saccubus.converter.classic.profile.Proxy;
 import saccubus.net.NicoClient;
 import saccubus.net.VideoInfo;
+import yukihane.saccubus.converter.profile.Proxy;
 import yukihane.saccubus.converter.profile.LoginInfo;
 
 /**
@@ -24,6 +24,7 @@ public class WebFileInstanciator extends FileInstanciator {
             CommentInstanciationType commentType,
             InstanciationType tcommType,
             LoginInfo li,
+            Proxy proxy,
             String tag,
             String time) throws IOException {
         super(videoType, commentType, tcommType, tag);
@@ -34,9 +35,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;
index 1889481..5d9abb4 100644 (file)
@@ -9,6 +9,4 @@ public interface LoginInfo {
     public String getMail();
 
     public String getPass();
-
-    public Proxy getProxy();
 }
index 531e965..af4e232 100644 (file)
@@ -8,6 +8,8 @@ public interface Profile {
 
     LoginInfo getLoginInfo();
 
+    Proxy getProxySetting();
+
     InputFileSetting getVideoSetting();
 
     InputFileSetting getCommentSetting();
index 8ea8019..667b4a2 100644 (file)
@@ -6,7 +6,9 @@ package yukihane.saccubus.converter.profile;
  */
 public interface Proxy {
 
-    public String getHost();
+    boolean use();
 
-    public int getPort();
+    String getHost();
+
+    int getPort();
 }