OSDN Git Service

20091203_frontend_nicobrowser_extend のマージ
[coroid/inqubus.git] / frontend / src / saccubus / Converter.java
index 48163f0..f630148 100644 (file)
@@ -22,15 +22,15 @@ import yukihane.swf.Cws2Fws;
  * @version 1.0
  */
 public class Converter extends Thread {
-       private ConvertingSetting Setting;
+       private final ConvertingSetting Setting;
 
-       private String Tag;
+       private final String Tag;
 
-       private String VideoID;
+       private final String VideoID;
 
        private String VideoTitle;
 
-       private String Time;
+       private final String Time;
 
        private JLabel Status;
 
@@ -67,11 +67,12 @@ public class Converter extends Thread {
 
        private File CommentMiddleFile = null;
 
+    @Override
        public void run() {
                boolean converted = false;
                try {
                        if (!Setting.isSaveConverted() && !Setting.isSaveComment()
-                                       && !Setting.isSaveVideo()) {
+                    && (Setting.getVideoSaveKind() != VideoSaveKind.SAVE)) {
                                Status.setText("\89½\82à\82·\82é\82±\82Æ\82ª\82 \82è\82Ü\82¹\82ñ");
                                return;
                        }
@@ -110,7 +111,7 @@ public class Converter extends Thread {
                                }
                        }
                        NicoClient client = null;
-                       if (Setting.isSaveVideo() || Setting.isSaveComment()) {
+            if ((Setting.getVideoSaveKind() == VideoSaveKind.SAVE) || Setting.isSaveComment()) {
                                if (Setting.getMailAddress() == null
                                                || Setting.getPassword() == null
                                                || Setting.getMailAddress().equals("")
@@ -159,7 +160,7 @@ public class Converter extends Thread {
                                }
                                VideoTitle = client.getVideoTitle();
                        }
-                       if (Setting.isSaveVideo()) {
+            if (Setting.getVideoSaveKind() == VideoSaveKind.SAVE) {
                                if (Setting.isVideoFixFileName()) {
                                        Setting.getVideoFixFileNameFolder().mkdir();
                                        VideoFile = new File(Setting.getVideoFixFileNameFolder(),
@@ -178,26 +179,33 @@ public class Converter extends Thread {
                                }
                        } else {
                                if (Setting.isSaveConverted()) {
-                                       if (Setting.isVideoFixFileName()) {
-                                               if(!detectVideoTitle(Setting.getVideoFixFileNameFolder())){
-                                                       Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\91\8dÝ\82µ\82Ü\82¹\82ñ\81B");
-                                                       return;
-                                               }
-                                               VideoFile = new File(Setting
-                                                               .getVideoFixFileNameFolder(), VideoID
-                                                               + VideoTitle + ".flv");
-                                               if (!VideoFile.canRead()) {
-                                                       Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\93Ç\82Ý\8d\9e\82ß\82Ü\82¹\82ñ\81B");
-                                                       return;
-                                               }
-                                       } else {
-                                               VideoFile = Setting.getVideoFile();
-                                               if (!VideoFile.exists()) {
-                                                       Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\91\8dÝ\82µ\82Ü\82¹\82ñ\81B");
-                                                       return;
-                                               }
-                                       }
-                               }
+                    if (Setting.getVideoSaveKind() == VideoSaveKind.NO_SAVE) {
+                        if (Setting.isVideoFixFileName()) {
+                            if (!detectVideoTitle(Setting.getVideoFixFileNameFolder())) {
+                                Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\91\8dÝ\82µ\82Ü\82¹\82ñ\81B");
+                                return;
+                            }
+                            VideoFile = new File(Setting.getVideoFixFileNameFolder(), VideoID
+                                    + VideoTitle + ".flv");
+                            if (!VideoFile.canRead()) {
+                                Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\93Ç\82Ý\8d\9e\82ß\82Ü\82¹\82ñ\81B");
+                                return;
+                            }
+                        } else {
+                            VideoFile = Setting.getVideoFile();
+                            if (!VideoFile.exists()) {
+                                Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\91\8dÝ\82µ\82Ü\82¹\82ñ\81B");
+                                return;
+                            }
+                        }
+                    } else if (Setting.getVideoSaveKind() == VideoSaveKind.NICOBROWSER) {
+                        VideoFile = Setting.getVideoFile();
+                        if (!VideoFile.isFile()) {
+                            Status.setText("\93®\89æ\83t\83@\83C\83\8b\82ª\91\8dÝ\82µ\82Ü\82¹\82ñ\81B");
+                            return;
+                        }
+                    }
+                }
                        }
 
                        if (stopFlagReturn()) {