+++ /dev/null
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package saccubus.prompt;
-
-import java.io.File;
-import saccubus.worker.profile.CommentProfile;
-import saccubus.worker.profile.DownloadProfile;
-import saccubus.worker.profile.GeneralProfile;
-import saccubus.worker.profile.LoginProfile;
-import saccubus.worker.profile.ProxyProfile;
-import saccubus.worker.profile.VideoProfile;
-import yukihane.inqubus.config.Config;
-
-/**
- *
- * @author user
- */
-public class DownloadProfileImpl implements DownloadProfile {
-
- private final LoginProfile loginProfile;
- private final ProxyProfile proxyProfile;
- private final VideoProfile videoProfile;
- private final CommentProfile commentProfile;
- private final GeneralProfile generalProfile;
-
- DownloadProfileImpl(final String mail, final String pass, final long time) {
- this.loginProfile = new LoginProfile() {
-
- @Override
- public String getMail() {
- return mail;
- }
-
- @Override
- public String getPassword() {
- return pass;
- }
- };
-
- this.proxyProfile = new ProxyProfileImpl();
- this.videoProfile = new VideoProfileImpl();
- this.commentProfile = new CommentProfileImpl(time);
- this.generalProfile = new GeneralProfileImpl();
- }
-
- @Override
- public LoginProfile getLoginProfile() {
- return loginProfile;
- }
-
- @Override
- public ProxyProfile getProxyProfile() {
- return this.proxyProfile;
- }
-
- @Override
- public VideoProfile getVideoProfile() {
- return this.videoProfile;
- }
-
- @Override
- public CommentProfile getCommentProfile() {
- return this.commentProfile;
- }
-
- @Override
- public GeneralProfile getGeneralProfile() {
- return this.generalProfile;
- }
-}
-
-class ProxyProfileImpl implements ProxyProfile {
-
- private final boolean use;
- private final String host;
- private final int port;
-
- ProxyProfileImpl() {
- final Config p = Config.INSTANCE;
- use = p.getProxyUse();
- host = p.getProxyHost();
- port = Integer.parseInt(p.getProxyPort());
- }
-
- @Override
- public boolean use() {
- return use;
- }
-
- @Override
- public String getHost() {
- return host;
- }
-
- @Override
- public int getPort() {
- return port;
- }
-}
-
-class VideoProfileImpl implements VideoProfile {
-
- private final boolean download;
- private final File dir;
- private final String fileName;
-
- VideoProfileImpl() {
- final Config p = Config.INSTANCE;
- this.download = !p.getVideoUseLocal();
- this.dir = new File(p.getVideoDir());
- this.fileName = p.getVideoFileNamePattern();
- }
-
- @Override
- public boolean isDownload() {
- return download;
- }
-
- @Override
- public File getDir() {
- return dir;
- }
-
- @Override
- public String getFileName() {
- return fileName;
- }
-
- @Override
- public File getLocalFile() {
- return getDir();
- }
-}
-
-class CommentProfileImpl implements CommentProfile {
-
- private final int lengthRelatedCommentSize;
- private final int perMinCommentSize;
- private final boolean disablePerMinComment;
- private final long backLogPoint;
- private final boolean download;
- private final File dir;
- private final String fileName;
-
- CommentProfileImpl(final long backLogPoint) {
- final Config p = Config.INSTANCE;
- this.lengthRelatedCommentSize = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
- this.perMinCommentSize = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
- // TODO disablePerMinComment がデフォルト設定値に無い
- this.disablePerMinComment = false;
- this.backLogPoint = backLogPoint;
- this.download = !p.getCommentUseLocal();
- this.dir = new File(p.getCommentDir());
- this.fileName = p.getCommentFileNamePattern();
- }
-
- @Override
- public int getLengthRelatedCommentSize() {
- return lengthRelatedCommentSize;
- }
-
- @Override
- public boolean isDisablePerMinComment() {
- return disablePerMinComment;
- }
-
- @Override
- public int getPerMinCommentSize() {
- return perMinCommentSize;
- }
-
- @Override
- public long getBackLogPoint() {
- return backLogPoint;
- }
-
- @Override
- public boolean isDownload() {
- return download;
- }
-
- @Override
- public File getDir() {
- return dir;
- }
-
- @Override
- public String getFileName() {
- return fileName;
- }
-
- @Override
- public File getLocalFile() {
- return getDir();
- }
-}
-
-class GeneralProfileImpl implements GeneralProfile {
-
- private final String replaceFrom;
- private final String replaceTo;
-
- GeneralProfileImpl() {
- final Config p = Config.INSTANCE;
- this.replaceFrom = p.getReplaceFrom();
- this.replaceTo = p.getReplaceTo();
- }
-
- @Override
- public String getReplaceFrom() {
- return replaceFrom;
- }
-
- @Override
- public String getReplaceTo() {
- return replaceTo;
- }
-}
--- /dev/null
+package yukihane.inqubus.saccubus.prompt;
+
+import saccubus.worker.profile.CommentProfile;
+import saccubus.worker.profile.LoginProfile;
+import yukihane.inqubus.config.ConfigCommentProfile;
+import yukihane.inqubus.config.ConfigDownloadProfile;
+
+/**
+ * さきゅばすのコマンドプロンプト仕様にあわせるためのDownloadProfile実装
+ * @author user
+ */
+class DownloadProfileImpl extends ConfigDownloadProfile {
+
+ private final LoginProfile loginProfile;
+ private final CommentProfile commentProfile;
+
+ DownloadProfileImpl(final String mail, final String pass, final long time) {
+ this.loginProfile = new LoginProfile() {
+
+ @Override
+ public String getMail() {
+ return mail;
+ }
+
+ @Override
+ public String getPassword() {
+ return pass;
+ }
+ };
+
+ this.commentProfile = new ConfigCommentProfile() {
+
+ @Override
+ public long getBackLogPoint() {
+ return time;
+ }
+ };
+ }
+
+ @Override
+ public LoginProfile getLoginProfile() {
+ return loginProfile;
+ }
+
+ @Override
+ public CommentProfile getCommentProfile() {
+ return this.commentProfile;
+ }
+}