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 mediaInfo;
25 private final File tempDir;
26 private final File font;
27 private final int fontIndex;
28 private final boolean commentOpaque;
29 private final boolean disableFontSizeArrange;
30 private final int shadowIndex;
31 private final boolean showConverting;
32 private final int maxNumOfComment;
33 private final HideCondition ngSetting;
35 public ConfigConvertProfile() throws IOException {
36 final Config p = Config.INSTANCE;
37 this.generalProfile = new ConfigGeneralProfile();
38 this.ffmpegProfile = new ConfigFfmpegProfile();
39 this.convert = p.getOutputEnable();
40 this.ffmpeg = new File(p.getFfmpegPath());
41 this.vhookDisabled = p.getFfmpegDllDisabled();
42 this.commentOverlay = p.getOutputCommentOverlay();
43 this.vhook = new File(p.getFfmpegDllPath());
44 this.mediaInfo = new File(p.getMediaInfoPath());
45 this.tempDir = new File(p.getSystemTempDir());
46 this.font = new File(p.getFontPath());
47 this.fontIndex = Integer.parseInt(p.getFontIndex());
48 this.commentOpaque = p.getCommentOpaque();
49 this.disableFontSizeArrange = p.getFontSizeArrangeDisable();
50 this.shadowIndex = p.getFontShadow();
51 this.showConverting = p.getFfmpegDisplayConverting();
52 this.maxNumOfComment = (p.getCommentDisplaySizeDefault()) ? -1 : Integer.parseInt(p.getCommentDisplaySizeManual());
53 this.ngSetting = new ConfigHideCondition();
58 public GeneralProfile getGeneralProfile() {
59 return generalProfile;
63 public FfmpegProfile getFfmpegOption() {
68 public boolean isConvert() {
73 public File getFfmpeg() {
78 public boolean isVhookDisabled() {
83 public boolean isCommentOverlay() {
84 return commentOverlay;
88 public File getVhook() {
93 public File getMediaInfo() {
98 public File getTempDir() {
103 public File getFont() {
108 public int getFontIndex() {
113 public boolean isCommentOpaque() {
114 return commentOpaque;
118 public boolean isDisableFontSizeArrange() {
119 return disableFontSizeArrange;
123 public int getShadowIndex() {
128 public boolean isShowConverting() {
129 return showConverting;
133 public int getMaxNumOfComment() {
134 return maxNumOfComment;
138 public HideCondition getNgSetting() {
143 public String toString() {
144 return ToStringBuilder.reflectionToString(this);
148 class ConfigHideCondition implements ConvertProfile.HideCondition {
150 private final String word;
151 private final String id;
153 ConfigHideCondition() {
154 final Config p = Config.INSTANCE;
155 this.word = StringUtils.join(p.getNgWords(), ' ');
156 this.id = StringUtils.join(p.getNgIds(), ' ');
160 public String getWord() {
165 public String getId() {
170 public String toString() {
171 return ToStringBuilder.reflectionToString(this);