4 * Created on 2011/05/28, 18:14:51
6 package yukihane.inqubus.gui;
9 import java.awt.ItemSelectable;
10 import java.awt.Toolkit;
11 import java.awt.datatransfer.DataFlavor;
12 import java.awt.datatransfer.Transferable;
13 import java.awt.event.ActionEvent;
14 import java.awt.event.ActionListener;
15 import java.awt.event.ItemEvent;
16 import java.awt.event.ItemListener;
17 import java.awt.event.KeyEvent;
19 import java.io.FilenameFilter;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.List;
24 import java.util.logging.Level;
25 import java.util.logging.Logger;
26 import java.util.regex.Matcher;
27 import java.util.regex.Pattern;
28 import javax.swing.BorderFactory;
29 import javax.swing.DropMode;
30 import javax.swing.GroupLayout;
31 import javax.swing.GroupLayout.Alignment;
32 import javax.swing.JButton;
33 import javax.swing.JCheckBox;
34 import javax.swing.JFrame;
35 import javax.swing.JLabel;
36 import javax.swing.JMenu;
37 import javax.swing.JMenuBar;
38 import javax.swing.JMenuItem;
39 import javax.swing.JPanel;
40 import javax.swing.JScrollPane;
41 import javax.swing.JTable;
42 import javax.swing.JTextField;
43 import javax.swing.KeyStroke;
44 import javax.swing.LayoutStyle.ComponentPlacement;
45 import javax.swing.TransferHandler;
46 import javax.swing.WindowConstants;
47 import org.apache.commons.lang.StringUtils;
48 import saccubus.MainFrame_AboutBox;
49 import saccubus.worker.Download;
50 import saccubus.worker.profile.CommentProfile;
51 import saccubus.worker.profile.DownloadProfile;
52 import saccubus.worker.profile.GeneralProfile;
53 import saccubus.worker.profile.LoginProfile;
54 import saccubus.worker.profile.ProxyProfile;
55 import saccubus.worker.profile.VideoProfile;
57 import yukihane.inqubus.Config;
58 import yukihane.inqubus.model.Target;
59 import yukihane.inqubus.model.TargetsTableModel;
65 public class MainFrame extends JFrame {
67 private static final long serialVersionUID = 1L;
68 private static final Logger logger = Logger.getLogger(MainFrame.class.getName());
69 private static final String ID_FIELD_TOOLTIP = "動画のIDまたはURLを入力します。";
70 private static final String FILE_LOCALBUTTON_TOOLTIP
71 = "ダウンロードする場合はチェックを外します。ローカルファイルを使用する場合はチェックを入れます。";
72 private static final String FILE_INPUTFIELD_TOOLTIP
73 = "ダウンロードする場合はファイル命名規則を入力します。"
74 + "ローカルファイルを使用する場合はパスを含むファイル名を入力します。";
75 private static final String FILE_OUTPUTFIELD_TOOLTIP
77 private final TargetsTableModel targetModel = new TargetsTableModel();
79 /** Creates new form MainFrame */
81 final URL url = MainFrame_AboutBox.class.getResource("icon.png");
82 final Image icon1 = Toolkit.getDefaultToolkit().createImage(url);
83 final URL url32 = MainFrame_AboutBox.class.getResource("icon32.png");
84 final Image icon2 = Toolkit.getDefaultToolkit().createImage(url32);
85 final List<Image> images = new ArrayList<Image>(2);
88 setIconImages(images);
90 final JPanel pnlMain = new JPanel();
91 final JScrollPane scrDisplay = new JScrollPane();
92 tblDisplay = new JTable();
93 final JPanel pnlButton = new JPanel();
94 btnStart = new JButton();
95 btnStop = new JButton();
96 btnDeselect = new JButton();
97 final JPanel pnlInputMain = new JPanel();
98 final JLabel lblId = new JLabel();
99 fldId = new JTextField();
100 fldId.setToolTipText(ID_FIELD_TOOLTIP);
101 final JLabel lblVideo = new JLabel();
102 cbVideoLocal = new JCheckBox();
103 cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
104 fldVideo = new JTextField();
105 fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
106 btnVideo = new JButton();
107 final JLabel lblComment = new JLabel();
108 cbCommentLocal = new JCheckBox();
109 cbCommentLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
110 cbCommentLocal.addItemListener(new ItemListener() {
113 public void itemStateChanged(ItemEvent e) {
114 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
115 cbBackLogReduce.setEnabled(!selected);
116 cbBackLog.setEnabled(!selected);
118 cbBackLog.setSelected(false);
122 fldComment = new JTextField();
123 fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
124 btnComment = new JButton();
125 final JLabel lblOutput = new JLabel();
126 cbOutputEnable = new JCheckBox();
127 fldOutput = new JTextField();
128 fldOutput.setToolTipText(FILE_OUTPUTFIELD_TOOLTIP);
130 setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
132 btnApply.addActionListener(new ApplyActionListener());
134 pnlMain.setBorder(BorderFactory.createEtchedBorder());
136 tblDisplay.setModel(targetModel);
137 tblDisplay.setDropMode(DropMode.INSERT_ROWS);
138 scrDisplay.setViewportView(tblDisplay);
140 pnlButton.setBorder(BorderFactory.createEtchedBorder());
142 btnStart.setText("開始");
144 btnStop.setText("停止");
146 btnDeselect.setText("選択解除");
148 GroupLayout gl_pnlButton = new GroupLayout(pnlButton);
149 pnlButton.setLayout(gl_pnlButton);
150 gl_pnlButton.setHorizontalGroup(
151 gl_pnlButton.createParallelGroup(Alignment.LEADING)
152 .addGroup(gl_pnlButton.createSequentialGroup()
154 .addComponent(btnStart)
155 .addPreferredGap(ComponentPlacement.RELATED)
156 .addComponent(btnStop)
157 .addPreferredGap(ComponentPlacement.RELATED, 250, Short.MAX_VALUE)
158 .addComponent(btnDeselect)
161 gl_pnlButton.setVerticalGroup(
162 gl_pnlButton.createParallelGroup(Alignment.LEADING)
163 .addGroup(gl_pnlButton.createSequentialGroup()
165 .addGroup(gl_pnlButton.createParallelGroup(Alignment.BASELINE)
166 .addComponent(btnStart)
167 .addComponent(btnStop)
168 .addComponent(btnDeselect))
169 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
172 pnlInputMain.setBorder(BorderFactory.createEtchedBorder());
176 fldId.addFocusListener(new java.awt.event.FocusAdapter() {
178 public void focusLost(java.awt.event.FocusEvent evt) {
179 idFieldFocusLost(evt);
183 lblVideo.setText("動画");
185 cbVideoLocal.setText("local");
186 cbVideoLocal.addItemListener(new java.awt.event.ItemListener() {
188 public void itemStateChanged(java.awt.event.ItemEvent evt) {
189 useMovieLocalCheckBoxItemStateChanged(evt);
193 btnVideo.setText("...");
195 lblComment.setText("コメント");
197 cbCommentLocal.setText("local");
198 cbCommentLocal.addItemListener(new java.awt.event.ItemListener() {
200 public void itemStateChanged(java.awt.event.ItemEvent evt) {
201 useMovieLocalCheckBoxItemStateChanged(evt);
205 btnComment.setText("...");
207 lblOutput.setText("出力");
209 cbOutputEnable.setText("変換");
210 cbOutputEnable.addItemListener(new java.awt.event.ItemListener() {
212 public void itemStateChanged(java.awt.event.ItemEvent evt) {
213 outputConvertCheckBoxItemStateChanged(evt);
218 GroupLayout gl_pnlInputMain = new GroupLayout(pnlInputMain);
219 pnlInputMain.setLayout(gl_pnlInputMain);
220 gl_pnlInputMain.setHorizontalGroup(
221 gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
222 .addGroup(gl_pnlInputMain.createSequentialGroup()
224 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
225 .addGroup(gl_pnlInputMain.createSequentialGroup()
226 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
227 .addComponent(lblComment)
228 .addComponent(lblVideo)
230 .addComponent(lblOutput))
231 .addPreferredGap(ComponentPlacement.RELATED)
232 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
233 .addGroup(gl_pnlInputMain.createSequentialGroup()
234 .addComponent(cbVideoLocal)
235 .addPreferredGap(ComponentPlacement.RELATED)
236 .addComponent(fldVideo, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
237 .addPreferredGap(ComponentPlacement.RELATED)
238 .addComponent(btnVideo))
239 .addGroup(gl_pnlInputMain.createSequentialGroup()
240 .addComponent(fldId, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE)
241 .addPreferredGap(ComponentPlacement.UNRELATED)
242 .addComponent(cbBackLogReduce)
243 .addComponent(cbBackLog)
244 .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
246 .addGroup(Alignment.TRAILING, gl_pnlInputMain.createSequentialGroup()
247 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.TRAILING)
248 .addGroup(Alignment.LEADING, gl_pnlInputMain.createSequentialGroup()
249 .addComponent(cbOutputEnable)
250 .addPreferredGap(ComponentPlacement.RELATED)
251 .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
252 .addGroup(gl_pnlInputMain.createSequentialGroup()
253 .addComponent(cbCommentLocal)
254 .addPreferredGap(ComponentPlacement.RELATED)
255 .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)))
256 .addPreferredGap(ComponentPlacement.RELATED)
257 .addComponent(btnComment))))
258 .addComponent(btnApply, Alignment.TRAILING))
261 gl_pnlInputMain.setVerticalGroup(
262 gl_pnlInputMain.createParallelGroup(Alignment.LEADING)
263 .addGroup(gl_pnlInputMain.createSequentialGroup()
265 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
266 .addComponent(fldId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
268 .addComponent(cbBackLogReduce)
269 .addComponent(cbBackLog)
270 .addComponent(fldBackLog)
272 .addPreferredGap(ComponentPlacement.RELATED)
273 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
274 .addComponent(lblVideo)
275 .addComponent(fldVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
276 .addComponent(btnVideo)
277 .addComponent(cbVideoLocal))
278 .addPreferredGap(ComponentPlacement.RELATED)
279 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
280 .addComponent(lblComment)
281 .addComponent(fldComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
282 .addComponent(btnComment)
283 .addComponent(cbCommentLocal))
284 .addPreferredGap(ComponentPlacement.RELATED)
285 .addGroup(gl_pnlInputMain.createParallelGroup(Alignment.BASELINE)
286 .addComponent(lblOutput)
287 .addComponent(fldOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
288 .addComponent(cbOutputEnable))
289 .addPreferredGap(ComponentPlacement.UNRELATED)
290 .addComponent(btnApply)
291 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
294 GroupLayout gl_pnlMain = new GroupLayout(pnlMain);
295 pnlMain.setLayout(gl_pnlMain);
296 gl_pnlMain.setHorizontalGroup(
297 gl_pnlMain.createParallelGroup(Alignment.LEADING)
298 .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
300 .addGroup(gl_pnlMain.createParallelGroup(Alignment.TRAILING)
301 .addComponent(pnlInputMain, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
302 .addComponent(scrDisplay, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
303 .addComponent(pnlButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
306 gl_pnlMain.setVerticalGroup(
307 gl_pnlMain.createParallelGroup(Alignment.LEADING)
308 .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
310 .addComponent(scrDisplay, GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
311 .addPreferredGap(ComponentPlacement.RELATED)
312 .addComponent(pnlButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
313 .addPreferredGap(ComponentPlacement.RELATED)
314 .addComponent(pnlInputMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
319 JMenuBar menuBar = initMenuBar();
320 setJMenuBar(menuBar);
322 GroupLayout layout = new GroupLayout(getContentPane());
323 getContentPane().setLayout(layout);
324 layout.setHorizontalGroup(
325 layout.createParallelGroup(Alignment.LEADING)
326 .addComponent(pnlMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
328 layout.setVerticalGroup(
329 layout.createParallelGroup(Alignment.LEADING)
330 .addComponent(pnlMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
335 pnlMain.setTransferHandler(new DownloadListTransferHandler());
336 tblDisplay.setTransferHandler(new TableTransferHandler());
339 private class ApplyActionListener implements ActionListener {
342 public void actionPerformed(ActionEvent e) {
343 final DownloadProfile prof = new InqubusDownloadProfile();
344 final String id = Util.getVideoId(fldId.getText());
346 new Download(prof, id).execute();
349 /** This method is called from within the constructor to
350 * initialize the form.
351 * WARNING: Do NOT modify this code. The content of this method is
352 * always regenerated by the Form Editor.
354 @SuppressWarnings("unchecked")
355 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
356 private void initComponents() {
357 }// </editor-fold>//GEN-END:initComponents
359 private File searchFileMatchId(final File dir, final String id) throws UnsupportedOperationException {
360 // TODO 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
365 final File[] lists = dir.listFiles(new FilenameFilter() {
367 final Pattern pattern = Pattern.compile(id + "\\D");
370 public boolean accept(File dir, String name) {
371 return pattern.matcher(name).find();
375 if (lists.length == 1) {
377 } else if (lists.length > 1) {
378 throw new UnsupportedOperationException();
384 private void useMovieLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useMovieLocalCheckBoxItemStateChanged
385 final Config p = Config.INSTANCE;
387 final ItemSelectable source = evt.getItemSelectable();
392 if (source == cbVideoLocal) {
395 dir = new File(p.getVideoDir());
399 dir = new File(p.getCommentDir());
402 final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
403 btn.setEnabled(useLocal);
407 final File f = searchFileMatchId(dir, fldId.getText());
414 text = p.getVideoFileNamePattern();
418 fldId.setEnabled(!(cbVideoLocal.isSelected() && cbCommentLocal.isSelected()));
420 }//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
422 private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
423 final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
424 fldOutput.setEnabled(convert);
425 }//GEN-LAST:event_outputConvertCheckBoxItemStateChanged
427 private void idFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_idFieldFocusLost
428 final Config p = Config.INSTANCE;
429 final String id = fldId.getText();
434 if (cbVideoLocal.isSelected() && fldVideo.getText().isEmpty()) {
435 final File dir = new File(p.getVideoDir());
436 final File file = searchFileMatchId(dir, id);
438 fldVideo.setText(file.getPath());
442 if (cbCommentLocal.isSelected() && fldComment.getText().isEmpty()) {
443 final File dir = new File(p.getCommentDir());
444 final File file = searchFileMatchId(dir, id);
446 fldComment.setText(file.getPath());
450 }//GEN-LAST:event_idFieldFocusLost
451 // Variables declaration - do not modify//GEN-BEGIN:variables
452 private final JTable tblDisplay;
454 private final JButton btnStart;
455 private final JButton btnStop;
456 private final JButton btnDeselect;
458 private final JTextField fldId;
459 private final JCheckBox cbBackLogReduce = new JCheckBox("コメ数減少");
460 private final JCheckBox cbBackLog = new JCheckBox("過去ログ");
461 private final JTextField fldBackLog = new JTextField();
462 private final JCheckBox cbVideoLocal;
463 private final JTextField fldVideo;
464 private final JButton btnVideo;
465 private final JCheckBox cbCommentLocal;
466 private final JTextField fldComment;
467 private final JButton btnComment;
468 private final JCheckBox cbOutputEnable;
469 private final JTextField fldOutput;
471 private final JButton btnApply = new JButton("適用");
472 // End of variables declaration//GEN-END:variables
474 private void initInputPanel() {
475 final Config p = Config.INSTANCE;
478 fldBackLog.setEnabled(false);
479 fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。");
480 cbBackLog.setEnabled(true);
481 cbBackLog.addItemListener(new ItemListener() {
484 public void itemStateChanged(ItemEvent e) {
485 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
486 fldBackLog.setEnabled(selected);
489 cbBackLogReduce.setToolTipText("「コメントの量を減らす」場合はチェックを付けます。");
491 final boolean movieLocal = p.getVideoUseLocal();
492 cbVideoLocal.setSelected(movieLocal);
493 btnVideo.setEnabled(movieLocal);
495 fldVideo.setText(p.getVideoFileNamePattern());
498 final boolean commentLocal = p.getCommentUseLocal();
499 cbCommentLocal.setSelected(commentLocal);
500 btnComment.setEnabled(commentLocal);
502 fldComment.setText(p.getCommentFileNamePattern());
505 final boolean convert = p.getOutputEnable();
506 cbOutputEnable.setSelected(convert);
507 fldOutput.setEnabled(convert);
508 fldOutput.setText(p.getOutputFileNamePattern());
512 private JMenuBar initMenuBar() {
513 final JMenuBar menuBar = new JMenuBar();
515 final JMenu mnFile = new JMenu("ファイル(F)");
518 final JMenuItem itExit = new JMenuItem("終了(X)", KeyEvent.VK_X);
519 itExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
520 itExit.addActionListener(new ActionListener() {
523 public void actionPerformed(ActionEvent e) {
524 throw new UnsupportedOperationException("Not supported yet.");
529 final JMenu mnTool = new JMenu("ツール(T)");
532 final JMenuItem itOption = new JMenuItem("オプション(O)...", KeyEvent.VK_O);
534 itOption.addActionListener(new ActionListener() {
537 public void actionPerformed(ActionEvent e) {
538 final yukihane.inqubus.gui.ConfigDialog dlg = new yukihane.inqubus.gui.ConfigDialog(MainFrame.this);
539 dlg.setLocationRelativeTo(MainFrame.this);
541 dlg.setVisible(true);
544 mnTool.add(itOption);
546 final JMenu mnHelp = new JMenu("ヘルプ(H)");
549 final JMenuItem itAbout = new JMenuItem("このソフトウェアについて(A)...", KeyEvent.VK_A);
550 itAbout.addActionListener(new ActionListener() {
553 public void actionPerformed(ActionEvent e) {
554 MainFrame_AboutBox dlg = new MainFrame_AboutBox(MainFrame.this);
556 dlg.setLocationRelativeTo(MainFrame.this);
558 dlg.setVisible(true);
566 private class DownloadListTransferHandler extends TransferHandler {
568 private static final long serialVersionUID = 1L;
569 private final Pattern movieIdPattern = Pattern.compile("(\\w\\w\\d+)");
572 public boolean canImport(TransferHandler.TransferSupport support) {
573 Transferable transferable = support.getTransferable();
574 if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)
575 || transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
582 public boolean importData(TransferHandler.TransferSupport support) {
584 Transferable transferable = support.getTransferable();
585 if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
586 @SuppressWarnings("unchecked")
587 final List<File> data = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
588 Collection<Target> targets = Target.from(data);
589 targetModel.addTarget(targets);
590 } else if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
591 String data = (String) transferable.getTransferData(DataFlavor.stringFlavor);
592 Matcher matcher = movieIdPattern.matcher(data);
593 if (matcher.find()) {
594 String movieId = matcher.group(1);
595 Target target = Target.fromId(movieId);
596 targetModel.addTarget(target);
603 } catch (Exception e) {
604 logger.log(Level.SEVERE, null, e);
610 private class TableTransferHandler extends DownloadListTransferHandler {
612 private static final long serialVersionUID = 1L;
615 public boolean canImport(TransferHandler.TransferSupport support) {
616 return super.canImport(support);
620 public boolean importData(TransferHandler.TransferSupport support) {
621 return super.importData(support);
626 private class InqubusDownloadProfile implements DownloadProfile {
628 private final LoginProfile loginProfile;
629 private final ProxyProfile proxyProfile;
630 private final VideoProfile videoProfile;
631 private final CommentProfile commentProfile;
632 private final GeneralProfile generalProfile;
634 private InqubusDownloadProfile() {
635 this.loginProfile = new InqubusLoginProfile();
636 this.proxyProfile = new InqubusProxyProfile();
637 this.videoProfile = new InqubusVideoProfile();
638 this.commentProfile = new InqubusCommentProfile();
639 this.generalProfile = new InqubusGeneralProfile();
643 public LoginProfile getLoginInfo() {
644 return this.loginProfile;
648 public ProxyProfile getProxyProfile() {
649 return this.proxyProfile;
653 public VideoProfile getVideoProfile() {
654 return this.videoProfile;
658 public CommentProfile getCommentProfile() {
659 return this.commentProfile;
663 public GeneralProfile getGeneralProfile() {
664 return this.generalProfile;
668 private class InqubusLoginProfile implements LoginProfile {
669 private final String mail;
670 private final String password;
672 private InqubusLoginProfile(){
673 final Config p = Config.INSTANCE;
674 this.mail = p.getId();
675 this.password = p.getPassword();
679 public String getMail() {
684 public String getPassword() {
685 return this.password;
689 private class InqubusProxyProfile implements ProxyProfile {
690 private final boolean use;
691 private final String host;
692 private final int port;
694 private InqubusProxyProfile(){
695 final Config p = Config.INSTANCE;
696 this.use = p.getProxyUse();
697 this.host = p.getProxyHost();
698 final String pp = p.getProxyPort();
699 this.port = StringUtils.isBlank(pp) ? -1 : Integer.parseInt(pp);
703 public boolean use() {
708 public String getHost() {
713 public int getPort() {
718 private class InqubusVideoProfile implements VideoProfile {
719 private final boolean download;
720 private final File dir;
721 private final String fileName;
722 private final File localFile;
724 private InqubusVideoProfile(){
725 this.download = !cbVideoLocal.isSelected();
727 this.dir = new File(fldVideo.getText());
728 // TODO ディレクトリとファイル名の入力欄を分ける
729 this.fileName = "{id}_{title}";
730 this.localFile = null;
733 this.fileName = null;
734 this.localFile = new File(fldVideo.getText());
739 public boolean isDownload() {
740 return this.download;
744 public File getDir() {
749 public String getFileName() {
750 return this.fileName;
754 public File getLocalFile() {
755 return this.localFile;
759 private class InqubusCommentProfile implements CommentProfile {
762 public int getLengthRelatedCommentSize() {
763 throw new UnsupportedOperationException("Not supported yet.");
767 public boolean isDisablePerMinComment() {
768 throw new UnsupportedOperationException("Not supported yet.");
772 public int getPerMinCommentSize() {
773 throw new UnsupportedOperationException("Not supported yet.");
777 public long getBackLogPoint() {
778 throw new UnsupportedOperationException("Not supported yet.");
782 public boolean isDownload() {
783 throw new UnsupportedOperationException("Not supported yet.");
787 public File getDir() {
788 throw new UnsupportedOperationException("Not supported yet.");
792 public String getFileName() {
793 throw new UnsupportedOperationException("Not supported yet.");
797 public File getLocalFile() {
798 throw new UnsupportedOperationException("Not supported yet.");
803 private class InqubusGeneralProfile implements GeneralProfile {
804 // private final String replaceFrom;
805 private InqubusGeneralProfile() {
806 final Config p = Config.INSTANCE;
807 // TODO 置換文字設定コンフィグが無い
808 // this.replaceFrom = p.get
812 public String getReplaceFrom() {
813 // return this.replaceFrom;
814 throw new UnsupportedOperationException("Not supported yet.");
818 public String getReplaceTo() {
819 throw new UnsupportedOperationException("Not supported yet.");