2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
5 package saccubus.prompt;
8 import saccubus.worker.profile.CommentProfile;
9 import saccubus.worker.profile.DownloadProfile;
10 import saccubus.worker.profile.GeneralProfile;
11 import saccubus.worker.profile.LoginProfile;
12 import saccubus.worker.profile.ProxyProfile;
13 import saccubus.worker.profile.VideoProfile;
14 import yukihane.inqubus.Config;
20 public class DownloadProfileImpl implements DownloadProfile {
22 private final LoginProfile loginProfile;
23 private final ProxyProfile proxyProfile;
24 private final VideoProfile videoProfile;
25 private final CommentProfile commentProfile;
26 private final GeneralProfile generalProfile;
28 DownloadProfileImpl(final String mail, final String pass, final long time) {
29 this.loginProfile = new LoginProfile() {
32 public String getMail() {
37 public String getPassword() {
42 this.proxyProfile = new ProxyProfileImpl();
43 this.videoProfile = new VideoProfileImpl();
44 this.commentProfile = new CommentProfileImpl(time);
45 this.generalProfile = new GeneralProfileImpl();
49 public LoginProfile getLoginInfo() {
54 public ProxyProfile getProxyProfile() {
55 return this.proxyProfile;
59 public VideoProfile getVideoProfile() {
60 return this.videoProfile;
64 public CommentProfile getCommentProfile() {
65 return this.commentProfile;
69 public GeneralProfile getGeneralProfile() {
70 return this.generalProfile;
74 class ProxyProfileImpl implements ProxyProfile {
76 private final boolean use;
77 private final String host;
78 private final int port;
81 final Config p = Config.INSTANCE;
82 use = p.getProxyUse();
83 host = p.getProxyHost();
84 port = Integer.parseInt(p.getProxyPort());
88 public boolean use() {
93 public String getHost() {
98 public int getPort() {
103 class VideoProfileImpl implements VideoProfile {
105 private final boolean download;
106 private final File dir;
107 private final String fileName;
110 final Config p = Config.INSTANCE;
111 this.download = !p.getVideoUseLocal();
112 this.dir = new File(p.getVideoDir());
113 this.fileName = p.getVideoFileNamePattern();
117 public boolean isDownload() {
122 public File getDir() {
127 public String getFileName() {
132 public File getLocalFile() {
137 class CommentProfileImpl implements CommentProfile {
139 private final int lengthRelatedCommentSize;
140 private final int perMinCommentSize;
141 private final boolean disablePerMinComment;
142 private final long backLogPoint;
143 private final boolean download;
144 private final File dir;
145 private final String fileName;
147 CommentProfileImpl(final long backLogPoint) {
148 final Config p = Config.INSTANCE;
149 this.lengthRelatedCommentSize = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
150 this.perMinCommentSize = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
151 // TODO disablePerMinComment がデフォルト設定値に無い
152 this.disablePerMinComment = false;
153 this.backLogPoint = backLogPoint;
154 this.download = !p.getCommentUseLocal();
155 this.dir = new File(p.getCommentDir());
156 this.fileName = p.getCommentFileNamePattern();
160 public int getLengthRelatedCommentSize() {
161 return lengthRelatedCommentSize;
165 public boolean isDisablePerMinComment() {
166 return disablePerMinComment;
170 public int getPerMinCommentSize() {
171 return perMinCommentSize;
175 public long getBackLogPoint() {
180 public boolean isDownload() {
185 public File getDir() {
190 public String getFileName() {
195 public File getLocalFile() {
200 class GeneralProfileImpl implements GeneralProfile {
202 private final String replaceFrom;
203 private final String replaceTo;
205 GeneralProfileImpl() {
206 final Config p = Config.INSTANCE;
207 this.replaceFrom = p.getReplaceFrom();
208 this.replaceTo = p.getReplaceTo();
212 public String getReplaceFrom() {
217 public String getReplaceTo() {