package saccubus;
+import java.io.IOException;
import saccubus.converter.Converter;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
-import java.io.IOException;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import nicobrowser.entity.NicoContent;
+import org.apache.commons.lang.StringUtils;
import saccubus.ConvertStopFlag.State;
-import saccubus.converter.FfmpegOption;
+import saccubus.converter.profile.FfmpegOption;
+import saccubus.converter.profile.NgSetting;
import saccubus.net.TextProgressListener;
import saccubus.properties.BasicSetting;
import saccubus.properties.ConvertSetting;
public class MainFrame extends JFrame {
private static final long serialVersionUID = 2564486741331062989L;
- public static final String VERSION = "1.22r NicoBrowser\8ag\92£ 1.1.1";
+ public static final String VERSION = "1.22r NicoBrowser\8ag\92£ 1.3.5";
public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
"icon32.png"));
JPanel contentPane;
private void setSetting(SProperties setting) {
// \8aî\96{\90Ý\92è
final BasicSetting basic = setting.getBasicSetting();
- MailAddrField.setText(basic.getMail());
- PasswordField.setText(basic.getPassword());
+ MailAddrField.setText(basic.getUser().getMail());
+ PasswordField.setText(basic.getUser().getPassword());
// \83v\83\8d\83L\83V\8aÖ\98A
UseProxyCheckBox.setSelected(basic.isProxyUse());
ProxyTextField.setText(basic.getProxyHost());
final boolean videoFixName = inVideo.isAutoNaming();
videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
+ videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
// \95Û\91¶\90Ý\92è - \93ü\97Í\83R\83\81\83\93\83g
final InputCommentSetting inputComment = setting.getInputCommentSetting();
NGIDTextField.setText(conv.getNgSetting().getId());
}
- private FfmpegOption detectOption() throws IOException {
- // TODO detectOption\82ð\8eg\97p\82·\82é\89Ó\8f\8a
- final File ffmpegFile = FFmpegOptionModel.getSelectedFile();
- if (ffmpegFile != null) {
- return FfmpegOption.load(ffmpegFile);
- }
-
- final String extOption = ExtOptionField.getText();
- final String mainOption = MainOptionField.getText();
- final String inOption = CommandLineInOptionField.getText();
- final String outOption = CommandLineOutOptionField.getText();
-
- return new FfmpegOption(extOption, mainOption, inOption, outOption);
- }
-
/**
* [\83t\83@\83C\83\8b|\8fI\97¹] \83A\83N\83V\83\87\83\93\82ª\8eÀ\8ds\82³\82ê\82Ü\82µ\82½\81B
*
public void DoButton_actionPerformed(ActionEvent e) {
if (Converter == null || Converter.isConverted()) {
- String url;
-
- // NicoBrowser\83t\83@\83C\83\8b\82ð\97\98\97p\82·\82é\8fê\8d\87\82Í\81A\83t\83@\83C\83\8b\96¼\82©\82ç\83r\83f\83IID\82ð\93Á\92è.
- if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
- try {
- String fileName = videoSaveInfoPanel.getNibrFileField().getText();
- NicoDBFinder finder = NicoDBFinder.getInstance();
- NicoContent info = finder.findNicoContent(fileName);
- if (info != null) {
- url = info.getNicoId();
- } else {
- url = "";
- }
- } catch (Exception ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage(), "\83G\83\89\81[", JOptionPane.ERROR_MESSAGE);
- return;
+ try {
+ executeConvert();
+ } catch (Exception ex) {
+ String text = ex.getMessage();
+ if (StringUtils.isEmpty(text)) {
+ text = "\97\\8aú\82µ\82È\82¢\83G\83\89\81[\82Ì\82½\82ß\92\86\92f\82µ\82Ü\82µ\82½\81B";
}
- } else {
- url = VideoID_TextField.getText();
+ statusBar.setText(text);
}
-
- TextProgressListener sl = new TextProgressListener() {
-
- public void setText(final String text) {
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- statusBar.setText(text);
- }
- });
- }
- };
-
- ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
-
- public void changeState(final State s) {
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- switch (s) {
- case PROCESSING:
- DoButton.setText(DoButtonStopString);
- break;
- case STOPPING:
- DoButton.setText(DoButtonWaitString);
- break;
- case FINISHED:
- DoButton.setText(DoButtonDefString);
- }
- }
- });
- }
- };
-
- Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
- new ConvertStopFlag(scl));
-// new ConvertStopFlag(this.DoButton, DoButtonStopString,
-// DoButtonWaitString, DoButtonDefString));
- Converter.start();
} else { /* \8aJ\8en\82µ\82Ä\82¢\82é\82Ì\82Å\81A\83X\83g\83b\83v\82·\82é\81B */
final ConvertStopFlag flag = Converter.getStopFlag();
if (!flag.needStop()) { /* \82Ü\82¾\83X\83g\83b\83v\82µ\82Ä\82¢\82È\82¢\81B */
}
}
+ private void executeConvert() throws IOException {
+ String url;
+
+ // NicoBrowser\83t\83@\83C\83\8b\82ð\97\98\97p\82·\82é\8fê\8d\87\82Í\81A\83t\83@\83C\83\8b\96¼\82©\82ç\83r\83f\83IID\82ð\93Á\92è.
+ if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
+ try {
+ String fileName = videoSaveInfoPanel.getNibrFileField().getText();
+ NicoDBFinder finder = NicoDBFinder.getInstance();
+ NicoContent info = finder.findNicoContent(fileName);
+ if (info != null) {
+ url = info.getNicoId();
+ } else {
+ url = "";
+ }
+ } catch (Exception ex) {
+ JOptionPane.showMessageDialog(this, ex.getMessage(), "\83G\83\89\81[", JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ } else {
+ url = VideoID_TextField.getText();
+ }
+
+ TextProgressListener sl = new TextProgressListener() {
+
+ public void setText(final String text) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ public void run() {
+ statusBar.setText(text);
+ }
+ });
+ }
+ };
+
+ ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
+
+ public void changeState(final State s) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ public void run() {
+ switch (s) {
+ case STOPPING:
+ DoButton.setText(DoButtonWaitString);
+ break;
+ case FINISHED:
+ DoButton.setText(DoButtonDefString);
+ }
+ }
+ });
+ }
+ };
+
+ Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
+ new ConvertStopFlag(scl));
+ DoButton.setText(DoButtonStopString);
+ new Thread(Converter).start();
+
+ }
+
/* FFmpeg\82Ö\82Ì\83p\83X */
public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
showSaveDialog("FFmpeg\82Ö\82Ì\83p\83X", FFmpegPathField, false, false);
String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
+ String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
- return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete);
+ return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
}
private InputCommentSetting getInputCommentSetting() {
File optionFile = FFmpegOptionModel.getSelectedFile();
FfmpegOption opt = new FfmpegOption(ext, main, in, out);
- return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, null);
+ return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
}
private ConvertSetting getConvertSetting() {
boolean showConv = ShowConvVideoCheckBox.isSelected();
boolean adjustFont = FixFontSizeCheckBox.isSelected();
boolean commentOpaque = OpaqueCommentCheckBox.isSelected();
- ConvertSetting.NgSetting ngSetting =
- new ConvertSetting.NgSetting(NGWordTextField.getText(), NGIDTextField.getText());
+ NgSetting ngSetting = new NgSetting(NGWordTextField.getText(), NGIDTextField.getText());
return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
commentOpaque, ngSetting);