1 package yukihane.inqubus.config;
4 import java.io.IOException;
5 import org.apache.commons.lang.StringUtils;
6 import org.apache.commons.lang.builder.ToStringBuilder;
7 import saccubus.worker.profile.ConvertProfile;
8 import saccubus.worker.profile.FfmpegProfile;
9 import saccubus.worker.profile.GeneralProfile;
12 * コンフィグに設定された値を基にしたConvertProfile実装.
15 public abstract class ConfigConvertProfile implements ConvertProfile {
17 private final GeneralProfile generalProfile;
18 private final FfmpegProfile ffmpegProfile;
19 private final boolean convert;
20 private final File ffmpeg;
21 private final boolean vhookDisabled;
22 private final boolean commentOverlay;
23 private final File vhook;
24 private final File tempDir;
25 private final File font;
26 private final int fontIndex;
27 private final boolean commentOpaque;
28 private final boolean disableFontSizeArrange;
29 private final int shadowIndex;
30 private final boolean showConverting;
31 private final int maxNumOfComment;
32 private final HideCondition ngSetting;
34 public ConfigConvertProfile() throws IOException {
35 final Config p = Config.INSTANCE;
36 this.generalProfile = new ConfigGeneralProfile();
37 this.ffmpegProfile = new ConfigFfmpegProfile();
38 this.convert = p.getOutputEnable();
39 this.ffmpeg = new File(p.getFfmpegPath());
40 this.vhookDisabled = p.getFfmpegDllDisabled();
41 this.commentOverlay = p.getOutputCommentOverlay();
42 this.vhook = new File(p.getFfmpegDllPath());
43 this.tempDir = new File(p.getSystemTempDir());
44 this.font = new File(p.getFontPath());
45 this.fontIndex = Integer.parseInt(p.getFontIndex());
46 this.commentOpaque = p.getCommentOpaque();
47 this.disableFontSizeArrange = p.getFontSizeArrangeDisable();
48 this.shadowIndex = p.getFontShadow();
49 this.showConverting = p.getFfmpegDisplayConverting();
50 this.maxNumOfComment = (p.getCommentDisplaySizeDefault()) ? -1 : Integer.parseInt(p.getCommentDisplaySizeManual());
51 this.ngSetting = new ConfigHideCondition();
56 public GeneralProfile getGeneralProfile() {
57 return generalProfile;
61 public FfmpegProfile getFfmpegOption() {
66 public boolean isConvert() {
71 public File getFfmpeg() {
76 public boolean isVhookDisabled() {
81 public boolean isCommentOverlay() {
82 return commentOverlay;
86 public File getVhook() {
91 public File getTempDir() {
96 public File getFont() {
101 public int getFontIndex() {
106 public boolean isCommentOpaque() {
107 return commentOpaque;
111 public boolean isDisableFontSizeArrange() {
112 return disableFontSizeArrange;
116 public int getShadowIndex() {
121 public boolean isShowConverting() {
122 return showConverting;
126 public int getMaxNumOfComment() {
127 return maxNumOfComment;
131 public HideCondition getNgSetting() {
136 public String toString() {
137 return ToStringBuilder.reflectionToString(this);
141 class ConfigHideCondition implements ConvertProfile.HideCondition {
143 private final String word;
144 private final String id;
146 ConfigHideCondition() {
147 final Config p = Config.INSTANCE;
148 this.word = StringUtils.join(p.getNgWords(), ' ');
149 this.id = StringUtils.join(p.getNgIds(), ' ');
153 public String getWord() {
158 public String getId() {
163 public String toString() {
164 return ToStringBuilder.reflectionToString(this);