import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.WindowConstants;
import org.apache.commons.lang.StringUtils;
import saccubus.MainFrame_AboutBox;
+import saccubus.util.WayBackTimeParser;
import saccubus.worker.Download;
import saccubus.worker.profile.CommentProfile;
import saccubus.worker.profile.DownloadProfile;
private final File localFile;
private InqubusVideoProfile(){
+ final Config p = Config.INSTANCE;
this.download = !cbVideoLocal.isSelected();
if (this.download) {
- this.dir = new File(fldVideo.getText());
- // TODO ディレクトリとファイル名の入力欄を分ける
- this.fileName = "{id}_{title}";
+ this.dir = new File(p.getVideoDir());
+ this.fileName = fldVideo.getText();
this.localFile = null;
} else {
this.dir = null;
}
private class InqubusCommentProfile implements CommentProfile {
+ private final boolean download;
+ private final File dir;
+ private final String fileName;
+ private final File localFile;
+ private final int lengthRelatedCommentSize;
+ private final boolean disablePerMinComment;
+ private final int perMinCommentSize;
+ private final long backLogPoint;
- @Override
- public int getLengthRelatedCommentSize() {
- throw new UnsupportedOperationException("Not supported yet.");
+ private InqubusCommentProfile() {
+ final Config p = Config.INSTANCE;
+ this.download = !cbVideoLocal.isSelected();
+ if (this.download) {
+ this.dir = new File(p.getVideoDir());
+ this.fileName = fldVideo.getText();
+ this.localFile = null;
+ } else {
+ this.dir = null;
+ this.fileName = null;
+ this.localFile = new File(fldVideo.getText());
+ }
+
+ if(cbBackLog.isSelected()) {
+ try {
+ this.backLogPoint = WayBackTimeParser.parse(fldBackLog.getText());
+ } catch (IOException ex) {
+ throw new IllegalArgumentException("過去ログ時刻指定が誤っています。", ex);
+ }
+ } else {
+ this.backLogPoint = -1L;
+ }
+
+ this.disablePerMinComment = cbBackLogReduce.isSelected();
+ this.lengthRelatedCommentSize
+ = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
+ this.perMinCommentSize
+ = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
}
@Override
- public boolean isDisablePerMinComment() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isDownload() {
+ return this.download;
}
@Override
- public int getPerMinCommentSize() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public File getDir() {
+ return this.dir;
}
@Override
- public long getBackLogPoint() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public String getFileName() {
+ return this.fileName;
}
@Override
- public boolean isDownload() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public File getLocalFile() {
+ return this.localFile;
}
@Override
- public File getDir() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public int getLengthRelatedCommentSize() {
+ return this.lengthRelatedCommentSize;
}
@Override
- public String getFileName() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public boolean isDisablePerMinComment() {
+ return this.disablePerMinComment;
}
@Override
- public File getLocalFile() {
- throw new UnsupportedOperationException("Not supported yet.");
+ public int getPerMinCommentSize() {
+ return this.perMinCommentSize;
}
+ @Override
+ public long getBackLogPoint() {
+ return this.backLogPoint;
+ }
}
private class InqubusGeneralProfile implements GeneralProfile {