OSDN Git Service

ConfigからOutputProfileを生成するためのデフォルト実装クラス
authoryukihane <yukihane.feather@gmail.com>
Tue, 6 Sep 2011 01:02:55 +0000 (10:02 +0900)
committeryukihane <yukihane.feather@gmail.com>
Fri, 9 Sep 2011 11:42:40 +0000 (20:42 +0900)
frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java [new file with mode: 0644]
frontend/src/yukihane/inqubus/config/ConfigFfmpegProfile.java [new file with mode: 0644]
frontend/src/yukihane/inqubus/config/ConfigOutputProfile.java [new file with mode: 0644]

diff --git a/frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java b/frontend/src/yukihane/inqubus/config/ConfigConvertProfile.java
new file mode 100644 (file)
index 0000000..b646b2d
--- /dev/null
@@ -0,0 +1,156 @@
+package yukihane.inqubus.config;
+
+import java.io.File;
+import org.apache.commons.lang.StringUtils;
+import saccubus.worker.profile.ConvertProfile;
+import saccubus.worker.profile.FfmpegProfile;
+import saccubus.worker.profile.GeneralProfile;
+
+/**
+ *
+ * @author user
+ */
+public abstract class ConfigConvertProfile implements ConvertProfile {
+
+    private final GeneralProfile generalProfile;
+    private final FfmpegProfile ffmpegProfile;
+    private final boolean convert;
+    private final File ffmpeg;
+    private final boolean vhookDisabled;
+    private final boolean commentOverlay;
+    private final File vhook;
+    private final File tempDir;
+    private final File font;
+    private final int fontIndex;
+    private final boolean commentOpaque;
+    private final boolean disableFontSizeArrange;
+    private final int shadowIndex;
+    private final boolean showConverting;
+    private final int maxNumOfComment;
+    private final HideCondition ngSetting;
+
+    public ConfigConvertProfile() {
+        final Config p = Config.INSTANCE;
+        this.generalProfile = new ConfigGeneralProfile();
+        this.ffmpegProfile = new ConfigFfmpegProfile();
+        this.convert = p.getOutputEnable();
+        this.ffmpeg = new File(p.getFfmpegPath());
+        // TODO コンフィグに設定なし
+        this.vhookDisabled = false;
+        this.commentOverlay = p.getOutputCommentOverlay();
+        this.vhook = new File(p.getFfmpegDllPath());
+        this.tempDir = new File(p.getSystemTempDir());
+        this.font = new File(p.getFontPath());
+        this.fontIndex = Integer.parseInt(p.getFontIndex());
+        this.commentOpaque = p.getCommentOpaque();
+        this.disableFontSizeArrange = p.getFontSizeArrangeDisable();
+        this.shadowIndex = p.getFontShadow();
+        // TODO コンフィグに設定なし
+        this.showConverting = true;
+        this.maxNumOfComment = (p.getCommentDisplaySizeDefault()) ? -1 : Integer.parseInt(p.getCommentDisplaySizeManual());
+        this.ngSetting = new ConfigHideCondition();
+
+    }
+
+    @Override
+    public GeneralProfile getGeneralProfile() {
+        return generalProfile;
+    }
+
+    @Override
+    public FfmpegProfile getFfmpegOption() {
+        return ffmpegProfile;
+    }
+
+    @Override
+    public boolean isConvert() {
+        return convert;
+    }
+
+    @Override
+    public File getFfmpeg() {
+        return ffmpeg;
+    }
+
+    @Override
+    public boolean isVhookDisabled() {
+        return vhookDisabled;
+    }
+
+    @Override
+    public boolean isCommentOverlay() {
+        return commentOverlay;
+    }
+
+    @Override
+    public File getVhook() {
+        return vhook;
+    }
+
+    @Override
+    public File getTempDir() {
+        return tempDir;
+    }
+
+    @Override
+    public File getFont() {
+        return font;
+    }
+
+    @Override
+    public int getFontIndex() {
+        return fontIndex;
+    }
+
+    @Override
+    public boolean isCommentOpaque() {
+        return commentOpaque;
+    }
+
+    @Override
+    public boolean isDisableFontSizeArrange() {
+        return disableFontSizeArrange;
+    }
+
+    @Override
+    public int getShadowIndex() {
+        return shadowIndex;
+    }
+
+    @Override
+    public boolean isShowConverting() {
+        return showConverting;
+    }
+
+    @Override
+    public int getMaxNumOfComment() {
+        return maxNumOfComment;
+    }
+
+    @Override
+    public HideCondition getNgSetting() {
+        return ngSetting;
+    }
+}
+
+class ConfigHideCondition implements ConvertProfile.HideCondition {
+
+    private final String word;
+    private final String id;
+
+    ConfigHideCondition() {
+        final Config p = Config.INSTANCE;
+        this.word = StringUtils.join(p.getNgWords(), ' ');
+        this.id = StringUtils.join(p.getNgIds(), ' ');
+    }
+
+    @Override
+    public String getWord() {
+        return word;
+    }
+
+    @Override
+    public String getId() {
+        return id;
+    }
+}
diff --git a/frontend/src/yukihane/inqubus/config/ConfigFfmpegProfile.java b/frontend/src/yukihane/inqubus/config/ConfigFfmpegProfile.java
new file mode 100644 (file)
index 0000000..e1ef96b
--- /dev/null
@@ -0,0 +1,78 @@
+package yukihane.inqubus.config;
+
+import saccubus.worker.profile.FfmpegProfile;
+
+/**
+ *
+ * @author user
+ */
+public class ConfigFfmpegProfile implements FfmpegProfile {
+
+    private final String extOption;
+    private final String inOption;
+    private final String mainOption;
+    private final String outOption;
+    private final String avFilterOption;
+    private final boolean resize;
+    private final int resizeWidth;
+    private final int resizeHeight;
+    private final boolean adjustRatio;
+
+    public ConfigFfmpegProfile() {
+        final Config p = Config.INSTANCE;
+        this.extOption = p.getFfmpegExtension();
+        this.inOption = p.getFfmpegInOption();
+        this.mainOption = p.getFfmpegMainOption();
+        this.outOption = p.getFfmpegOutOption();
+        this.avFilterOption = p.getFfmpegAvOption();
+        this.resize = p.getFfmpegResizeEnable();
+        this.resizeWidth = Integer.parseInt(p.getFfmpegResizeWidth());
+        this.resizeHeight = Integer.parseInt(p.getFfmpegResizeHeight());
+        this.adjustRatio = p.getFfmpegKeepAspect();
+    }
+
+    @Override
+    public String getExtOption() {
+        return extOption;
+    }
+
+    @Override
+    public String getInOption() {
+        return inOption;
+    }
+
+    @Override
+    public String getMainOption() {
+        return mainOption;
+    }
+
+    @Override
+    public String getOutOption() {
+        return outOption;
+    }
+
+    @Override
+    public String getAvfilterOption() {
+        return avFilterOption;
+    }
+
+    @Override
+    public boolean isResize() {
+        return resize;
+    }
+
+    @Override
+    public int getResizeWidth() {
+        return resizeWidth;
+    }
+
+    @Override
+    public int getResizeHeight() {
+        return resizeHeight;
+    }
+
+    @Override
+    public boolean isAdjustRatio() {
+        return adjustRatio;
+    }
+}
diff --git a/frontend/src/yukihane/inqubus/config/ConfigOutputProfile.java b/frontend/src/yukihane/inqubus/config/ConfigOutputProfile.java
new file mode 100644 (file)
index 0000000..e7d8490
--- /dev/null
@@ -0,0 +1,29 @@
+package yukihane.inqubus.config;
+
+import java.io.File;
+import saccubus.worker.profile.OutputProfile;
+
+/**
+ *
+ * @author user
+ */
+public abstract class ConfigOutputProfile implements OutputProfile {
+    private final File dir;
+    private final String fileName;
+
+    public ConfigOutputProfile() {
+        final Config p = Config.INSTANCE;
+        this.dir = new File(p.getOutputDir());
+        this.fileName = p.getOutputFileNamePattern();
+    }
+
+    @Override
+    public File getDir() {
+        return dir;
+    }
+
+    @Override
+    public String getFileName() {
+        return fileName;
+    }
+}