+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-import saccubus.worker.classic.profile.User;
-
-/**
- * 基本設定.
- * @author yuki
- */
-public class BasicSetting {
-
- private static final String PROP_TEMP_DIR = "TempDir";
- private static final String PROP_MAILADDR = "MailAddress";
- private static final String PROP_PASSWORD = "Password";
- private static final String PROP_USE_PROXY = "UseProxy";
- private static final String PROP_PROXY = "Proxy";
- private static final String PROP_PROXY_PORT = "ProxyPort";
- private final File tempDir;
- private final User user;
- private final boolean proxyUse;
- private final String proxyHost;
- private final int proxyPort;
-
- public BasicSetting(File tempDir, String mail, String password, boolean proxyUse, String proxyHost, int proxyPort) {
- this.tempDir = tempDir;
- this.user = new User(mail, password);
- this.proxyUse = proxyUse;
- this.proxyHost = proxyHost;
- this.proxyPort = proxyPort;
- }
-
- public File getTempDir() {
- return tempDir;
- }
-
- public User getUser() {
- return user;
- }
-
- public String getProxyHost() {
- return proxyHost;
- }
-
- public int getProxyPort() {
- return proxyPort;
- }
-
- public boolean isProxyUse() {
- return proxyUse;
- }
-
- public void save(Properties prop) {
- prop.setProperty(PROP_TEMP_DIR, getTempDir().getPath());
- prop.setProperty(PROP_MAILADDR, getUser().getMail());
- prop.setProperty(PROP_PASSWORD, getUser().getPassword());
- prop.setProperty(PROP_USE_PROXY, Boolean.toString(isProxyUse()));
- prop.setProperty(PROP_PROXY, getProxyHost());
- prop.setProperty(PROP_PROXY_PORT, Integer.toString(getProxyPort()));
- }
-
- public static BasicSetting load(Properties prop, String user, String pass) {
- String tempDir = prop.getProperty(PROP_TEMP_DIR, ".");
- if (user == null) {
- user = prop.getProperty(PROP_MAILADDR, "");
- }
- if (pass == null) {
- pass = prop.getProperty(PROP_PASSWORD, "");
- }
- boolean proxyUse = Boolean.parseBoolean(prop.getProperty(PROP_USE_PROXY, "false"));
- String proxyHost = prop.getProperty(PROP_PROXY, "");
- int proxyPort = Integer.parseInt(prop.getProperty(PROP_PROXY_PORT, "-1"));
-
- return new BasicSetting(new File(tempDir), user, pass, proxyUse, proxyHost, proxyPort);
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-import saccubus.worker.classic.profile.NgSetting;
-
-/**
- * 変換設定.
- * @author yuki
- */
-public class ConvertSetting {
-
- private static final String PROP_DISABLE_VHOOK = "VhookDisabled";
- private static final String PROP_SHOW_COMMENT = "ShowCommentNum";
- private static final String PROP_FONT_PATH = "FontPath";
- private static final String PROP_FONT_INDEX = "FontIndex";
- private static final String PROP_SHADOW_INDEX = "ShadowIndex";
- private static final String PROP_SHOW_VIDEO = "ShowVideo";
- private static final String PROP_FIX_FONT_SIZE = "FixFontSize";
- private static final String PROP_OPAQUE_COMMENT = "OpaqueComment";
- private static final String PROP_NG_WORD = "NG_Word";
- private static final String PROP_NG_ID = "NG_ID";
- private final boolean vhookDisabled;
- private final int maxNumOfComment;
- private final File font;
- private final int fontIndex;
- private final int shadowIndex;
- private final boolean showConverting;
- private final boolean selfAdjustFontSize;
- private final boolean commentOpaque;
- private final NgSetting ngSetting;
-
- public ConvertSetting(boolean vhookDisabled, int maxNumOfComment, File font, int fontIndex, int shadowIndex,
- boolean showConverting, boolean selfAdjustFontSize, boolean commentOpaque, NgSetting ngSetting) {
- this.vhookDisabled = vhookDisabled;
- this.maxNumOfComment = maxNumOfComment;
- this.font = font;
- this.fontIndex = fontIndex;
- this.shadowIndex = shadowIndex;
- this.showConverting = showConverting;
- this.selfAdjustFontSize = selfAdjustFontSize;
- this.commentOpaque = commentOpaque;
- this.ngSetting = ngSetting;
- }
-
- public boolean isCommentOpaque() {
- return commentOpaque;
- }
-
- public File getFont() {
- return font;
- }
-
- public int getFontIndex() {
- return fontIndex;
- }
-
- public int getMaxNumOfComment() {
- return maxNumOfComment;
- }
-
- public boolean isSelfAdjustFontSize() {
- return selfAdjustFontSize;
- }
-
- public int getShadowIndex() {
- return shadowIndex;
- }
-
- public boolean isShowConverting() {
- return showConverting;
- }
-
- public boolean isVhookDisabled() {
- return vhookDisabled;
- }
-
- public NgSetting getNgSetting() {
- return ngSetting;
- }
-
- public void save(Properties prop) {
- prop.setProperty(PROP_SHOW_COMMENT, Integer.toString(getMaxNumOfComment()));
- prop.setProperty(PROP_FONT_PATH, getFont().getPath());
- prop.setProperty(PROP_FONT_INDEX, Integer.toString(getFontIndex()));
- prop.setProperty(PROP_SHOW_VIDEO, Boolean.toString(isShowConverting()));
- prop.setProperty(PROP_NG_WORD, getNgSetting().getWord());
- prop.setProperty(PROP_NG_ID, getNgSetting().getId());
- prop.setProperty(PROP_FIX_FONT_SIZE, Boolean.toString(isSelfAdjustFontSize()));
- prop.setProperty(PROP_OPAQUE_COMMENT, Boolean.toString(isCommentOpaque()));
- prop.setProperty(PROP_DISABLE_VHOOK, Boolean.toString(isVhookDisabled()));
- prop.setProperty(PROP_SHADOW_INDEX, Integer.toString(getShadowIndex()));
- }
-
- public static ConvertSetting load(Properties prop) {
- String defaultFont = "";
- String win_dir = System.getenv("windir");
- if (win_dir != null) {
- //windows の場合のデフォルトフォントパス
- defaultFont = new File(win_dir, "Fonts" + File.separator + "msgothic.ttc").getPath();
- }
-
-
- int maxComment = Integer.parseInt(prop.getProperty(PROP_SHOW_COMMENT, "30"));
- String font = prop.getProperty(PROP_FONT_PATH, defaultFont);
- int fontIndex = Integer.parseInt(prop.getProperty(PROP_FONT_INDEX, "1"));
- boolean showConv = Boolean.parseBoolean(prop.getProperty(PROP_SHOW_VIDEO, "true"));
- String ngWord = prop.getProperty(PROP_NG_WORD, "");
- String ngId = prop.getProperty(PROP_NG_ID, "");
- boolean adjustFont = Boolean.parseBoolean(prop.getProperty(PROP_FIX_FONT_SIZE, "true"));
- boolean opaque = Boolean.parseBoolean(prop.getProperty(PROP_OPAQUE_COMMENT, "false"));
- boolean vhookDisabled = Boolean.parseBoolean(prop.getProperty(PROP_DISABLE_VHOOK, "false"));
- int shadowIndex = Integer.parseInt(prop.getProperty(PROP_SHADOW_INDEX, "1"));
-
- return new ConvertSetting(vhookDisabled, maxComment, new File(font), fontIndex, shadowIndex, showConv,
- adjustFont, opaque, new NgSetting(ngWord, ngId));
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * 入力コメント設定.
- * @author yuki
- */
-public class InputCommentSetting extends InputFileSetting<Boolean> {
-
- /** コメントをダウンロードする. */
- private static final String PROP_SAVE_COMMENT = "SaveCommentFile";
- /** 変換後にコメントファイルを削除する. */
- private static final String PROP_DEL_COMMENT_AFTER_CONV = "DeleteCommentAfterConv";
- /** コメント取得数は自動で調整する. */
- private static final String PROP_FIX_COMMENT_NUM = "FixCommentSize";
- /** 取得コメント数. */
- private static final String PROP_BACK_COMMENT = "BackComment";
- /** フォルダ/ファイル保存選択ラジオボタン. */
- private static final String PROP_COMMENT_FIX_FILE_NAME = "CommentFixFileName";
- /** フォルダ名. */
- private static final String PROP_COMMENT_FOLDER = "CommentFixFileNameFolder";
- /** ファイル名. */
- private static final String PROP_COMMENT_FILE = "CommentFile";
- private final boolean selfAdjustNumOfComment;
- private final int numOfComment;
- private final boolean reduceComment;
- private final long backLogPoint;
-
- public InputCommentSetting(boolean download, boolean autoNaming, File folder, File file, boolean deleteAfterConvert,
- boolean adjust, int numOfCom, boolean reduceComment, long backLogPoint) {
- super(Boolean.valueOf(download), autoNaming, folder, file, deleteAfterConvert);
- this.selfAdjustNumOfComment = adjust;
- this.numOfComment = numOfCom;
- this.reduceComment = reduceComment;
- this.backLogPoint = backLogPoint;
- }
-
- @Override
- public void save(Properties prop) {
- prop.setProperty(PROP_SAVE_COMMENT, getProcessKind().toString());
- prop.setProperty(PROP_DEL_COMMENT_AFTER_CONV, Boolean.toString(isDeleteAfterConvert()));
- prop.setProperty(PROP_FIX_COMMENT_NUM, Boolean.toString(isSelfAdjustNumOfComment()));
- prop.setProperty(PROP_BACK_COMMENT, Integer.toString(getNumOfComment()));
- prop.setProperty(PROP_COMMENT_FIX_FILE_NAME, Boolean.toString(isAutoNaming()));
- prop.setProperty(PROP_COMMENT_FOLDER, getFolder().getPath());
- prop.setProperty(PROP_COMMENT_FILE, getFile().getPath());
-
- }
-
- public static InputCommentSetting load(Properties prop) {
- boolean download = Boolean.parseBoolean(prop.getProperty(PROP_SAVE_COMMENT, "true"));
- boolean delete = Boolean.parseBoolean(prop.getProperty(PROP_DEL_COMMENT_AFTER_CONV, "false"));
- boolean adjustNumOfComment = Boolean.parseBoolean(prop.getProperty(PROP_FIX_COMMENT_NUM, "true"));
- String numOfComment = prop.getProperty(PROP_BACK_COMMENT, "500");
- boolean autoNaming = Boolean.parseBoolean(prop.getProperty(PROP_COMMENT_FIX_FILE_NAME, "true"));
- String folder = prop.getProperty(PROP_COMMENT_FOLDER, "out/comment");
- String file = prop.getProperty(PROP_COMMENT_FILE, "comment.xml");
-
- return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete,
- adjustNumOfComment,
- Integer.parseInt(numOfComment), false, -1);
- }
-
- public final boolean isSelfAdjustNumOfComment() {
- return selfAdjustNumOfComment;
- }
-
- public final int getNumOfComment() {
- return numOfComment;
- }
-
- public boolean isReduceComment(){
- return reduceComment;
- }
-
- public long getBackLogPoint() {
- return backLogPoint;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-
-/**
- * 入力ファイル設定のためのスーパクラス.
- * @author yuki
- */
-public abstract class InputFileSetting<T> extends ProcessFileSetting<T> {
-
- private final boolean deleteAfterConvert;
-
- /**
- * 入力ファイル設定のためのスーパクラス.
- * @param processKind ダウンロードするのであればtrue, ローカルファイルを用いるのであればfalse.
- * @param autoNaming フォルダ名のみを指定してファイル名は自動命名/自動検索するのであればtrue,
- * ファイル名まで指定するのであればfalse.
- * @param folder 画面で入力したフォルダ名. autoNamingがtrueの場合に用いられる.
- * @param file 画面で入力したファイル名. autoNamingがfalseの場合に用いられる.
- * @param deleteAfterConvert 変換処理後にファイルを削除するのであればtrue.
- */
- public InputFileSetting(T processKind, boolean autoNaming, File folder,
- File file, boolean deleteAfterConvert) {
- super(processKind, autoNaming, folder, file);
- this.deleteAfterConvert = deleteAfterConvert;
- }
-
- public final boolean isDeleteAfterConvert() {
- return deleteAfterConvert;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * 投稿者コメントに関する設定.
- * @author yuki
- */
-public class InputTcommentSetting extends InputFileSetting<Boolean> {
-
- /**
- * 「入力投稿者コメント」パネルの設定.
- * @param download ダウンロードする必要があればtrue. ローカルにあるファイルを用いるのであればfalse.
- * @param inputDirectory ユーザが「保存するフォルダを指定し、ファイル名は自動で決定する」テキストフィールドに入力した値.
- * @param inputFile ユーザが「保存するファイル名を指定する」テキストフィールドに入力した値.
- * @param delete 処理終了後ファイルを削除するのであればtrue. 残したままであればfalse.
- */
- public InputTcommentSetting(boolean download, boolean autoFileName, String inputDirectory, String inputFile,
- boolean delete) {
- super(Boolean.valueOf(download), autoFileName, new File(inputDirectory), new File(inputFile), delete);
- }
-
- public static InputTcommentSetting load(Properties prop) {
- String str;
- str = prop.getProperty(PROP_DOWNLOAD, Boolean.toString(true));
- boolean down = Boolean.valueOf(str);
- str = prop.getProperty(PROP_DELETE, Boolean.toString(false));
- boolean del = Boolean.valueOf(str);
- str = prop.getProperty(PROP_AUTOFILENAME, Boolean.toString(true));
- boolean naming = Boolean.valueOf(str);
- String dir = prop.getProperty(PROP_DIRECTORYNAME, "out/commentowner");
- String f = prop.getProperty(PROP_FILENAME, "tcomment.xml");
- return new InputTcommentSetting(down, naming, dir, f, del);
- }
-
- public void save(Properties prop) {
- prop.setProperty(PROP_DOWNLOAD, getProcessKind().toString());
- prop.setProperty(PROP_DELETE, Boolean.toString(isDeleteAfterConvert()));
- prop.setProperty(PROP_AUTOFILENAME, Boolean.toString(isAutoNaming()));
- prop.setProperty(PROP_DIRECTORYNAME, getFolder().toString());
- prop.setProperty(PROP_FILENAME, getFile().toString());
- }
- private static final String PROP_DOWNLOAD = "TCDownload";
- private static final String PROP_DELETE = "TCDelete";
- private static final String PROP_AUTOFILENAME = "TCAutoNaming";
- private static final String PROP_DIRECTORYNAME = "TCDirectory";
- private static final String PROP_FILENAME = "TCFileName";
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-import saccubus.VideoSaveKind;
-
-/**
- * 入力動画設定を保持するクラス.
- * @author yuki
- */
-public class InputVideoSetting extends InputFileSetting<VideoSaveKind> {
-
- private static final String PROP_SAVE_VIDEO = "SaveVideoFile";
- private static final String PROP_VIDEO_FIX_FILE_NAME = "VideoFixFileName";
- private static final String PROP_VIDEO_FIX_FILE_NAME_FOLDER = "VideoFixFileNameFolder";
- private static final String PROP_VIDEO_FILE = "VideoFile";
- private static final String PROP_DEL_VIDEO_AFTER_CONV = "DeleteVideoAfterConv";
- private static final String PROP_NICO_BROWSER_FILE_NAME = "NicoBrowserFileName";
- private final File nicoBrowserFile;
-
- public InputVideoSetting(VideoSaveKind download, boolean autoNaming, File folder,
- File file, boolean deleteAfterConvert, File nicoBrowserFile) {
- super(download, autoNaming, folder, file, deleteAfterConvert);
- this.nicoBrowserFile = nicoBrowserFile;
- }
-
- public void save(Properties prop) {
- prop.setProperty(PROP_SAVE_VIDEO, getProcessKind().toString());
- prop.setProperty(PROP_VIDEO_FILE, getFile().getPath());
- prop.setProperty(PROP_VIDEO_FIX_FILE_NAME, Boolean.toString(isAutoNaming()));
- prop.setProperty(PROP_VIDEO_FIX_FILE_NAME_FOLDER, getFolder().getPath());
- prop.setProperty(PROP_DEL_VIDEO_AFTER_CONV, Boolean.toString(isDeleteAfterConvert()));
- prop.setProperty(PROP_NICO_BROWSER_FILE_NAME, getNicoBrowserFile().getPath());
- }
-
- public static InputVideoSetting load(Properties prop) {
- final VideoSaveKind kind = convertVideoSaveKind(prop);
- boolean autoNaming = Boolean.parseBoolean(prop.getProperty(PROP_VIDEO_FIX_FILE_NAME, "true"));
- String folder = prop.getProperty(PROP_VIDEO_FIX_FILE_NAME_FOLDER, "out/movie");
- String file = prop.getProperty(PROP_VIDEO_FILE, "video.flv");
- boolean delete = Boolean.parseBoolean(prop.getProperty(PROP_DEL_VIDEO_AFTER_CONV, "false"));
- String nibrFile = prop.getProperty(PROP_NICO_BROWSER_FILE_NAME, "");
-
- return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
- }
-
- /** 本家さきゅばすで保存していた場合、PROP_SAVE_VIDEOはtrue/falseなので変換する. */
- private static VideoSaveKind convertVideoSaveKind(Properties prop) {
- VideoSaveKind kind;
- String saveVideo = prop.getProperty(PROP_SAVE_VIDEO);
- if (Boolean.toString(true).equals(saveVideo) || saveVideo == null) {
- kind = VideoSaveKind.SAVE;
- } else if (Boolean.toString(false).equals(saveVideo)) {
- kind = VideoSaveKind.NO_SAVE;
- } else {
- kind = VideoSaveKind.valueOf(saveVideo);
- }
- return kind;
- }
-
- public File getNicoBrowserFile() {
- return nicoBrowserFile;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-import saccubus.worker.classic.profile.FfmpegOption;
-
-/**
- * 動画設定.
- * @author yuki
- */
-public class MovieSetting {
-
- private static final String PROP_FFMPEG_PATH = "FFnpegPath";
- private static final String PROP_VHOOK_PATH = "VhookPath";
- private static final String PROP_OPTION_FILE = "OptionFile";
- private static final String PROP_CMDLINE_EXT = "CMD_EXT";
- private static final String PROP_CMDLINE_MAIN = "CMD_MAIN";
- private static final String PROP_CMDLINE_IN = "CMD_IN";
- private static final String PROP_CMDLINE_OUT = "CMD_OUT";
- private static final String PROP_CMDLINE_AVFILTER = "CMD_AVFILTER";
- private static final String PROP_RESIZE = "CMD_RESIZE";
- private static final String PROP_RESIZE_WIDTH = "CMD_RESIZE_WIDTH";
- private static final String PROP_RESIZE_HEIGHT = "CMD_RESIZE_HEIGHT";
- private static final String PROP_ADJUST_RATIO = "CMD_ADJUST_RATIO";
- private final File ffmpeg;
- private final File vhook;
- private final File optionFile;
- private final FfmpegOption ffmpegOption;
-
- public MovieSetting(File ffmpeg, File vhook, File optionFile, FfmpegOption ffmpegOption) {
- this.ffmpeg = ffmpeg;
- this.vhook = vhook;
- this.optionFile = optionFile;
- this.ffmpegOption = ffmpegOption;
- }
-
- public File getFfmpeg() {
- return ffmpeg;
- }
-
- public File getVhook() {
- return vhook;
- }
-
- public File getOptionFile() {
- return optionFile;
- }
-
- public FfmpegOption getFfmpegOption() {
- return ffmpegOption;
- }
-
- public void save(Properties prop) {
- prop.setProperty(PROP_FFMPEG_PATH, getFfmpeg().getPath());
- prop.setProperty(PROP_VHOOK_PATH, getVhook().getPath());
- prop.setProperty(PROP_CMDLINE_EXT, getFfmpegOption().getExtOption());
- prop.setProperty(PROP_CMDLINE_MAIN, getFfmpegOption().getMainOption());
- prop.setProperty(PROP_CMDLINE_IN, getFfmpegOption().getInOption());
- prop.setProperty(PROP_CMDLINE_OUT, getFfmpegOption().getOutOption());
- prop.setProperty(PROP_CMDLINE_AVFILTER, getFfmpegOption().getAvfilterOption());
- prop.setProperty(PROP_RESIZE, Boolean.toString(getFfmpegOption().isResize()));
- prop.setProperty(PROP_RESIZE_WIDTH, Integer.toString(getFfmpegOption().getResizeWidth()));
- prop.setProperty(PROP_RESIZE_HEIGHT, Integer.toString(getFfmpegOption().getResizeHeight()));
- prop.setProperty(PROP_ADJUST_RATIO, Boolean.toString(getFfmpegOption().isAdjustRatio()));
- if (getOptionFile() != null) {
- prop.setProperty(PROP_OPTION_FILE, getOptionFile().getPath());
- } else {
- prop.remove(PROP_OPTION_FILE);
- }
- }
-
- public static MovieSetting load(Properties prop) {
- String name = prop.getProperty(PROP_OPTION_FILE);
- File optionFile = null;
- if (name != null) {
- optionFile = new File(name);
- }
-
- String ffmpeg = prop.getProperty(PROP_FFMPEG_PATH, new File("bin", "ffmpeg.exe").getPath());
- String vhook = prop.getProperty(PROP_VHOOK_PATH, new File("bin", "nicovideo.dll").getPath());
- String ext = prop.getProperty(PROP_CMDLINE_EXT, ".m4v");
- String main = prop.getProperty(PROP_CMDLINE_MAIN, "");
- String in = prop.getProperty(PROP_CMDLINE_IN, "");
- String out = prop.getProperty(PROP_CMDLINE_OUT,
- "-f ipod -g 150 -qcomp 0.7 -qmin 20 -qmax 30 -qdiff 4 -subq 6 -me_range 16 -i_qfactor 0.714286");
- String avfilter = prop.getProperty(PROP_CMDLINE_AVFILTER, "");
- boolean resize = Boolean.getBoolean(prop.getProperty(PROP_RESIZE, "false"));
- String width = prop.getProperty(PROP_RESIZE_WIDTH, "512");
- String height = prop.getProperty(PROP_RESIZE_HEIGHT, "384");
- boolean adjust = Boolean.getBoolean(prop.getProperty(PROP_ADJUST_RATIO, "false"));
- FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust);
-
- return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * 出力コメント付き動画に関する設定.
- * @author yuki
- */
-public class OutputVideoSetting extends ProcessFileSetting<Boolean> {
-
- private static final String PROP_SAVE_CONVERTED = "SaveConvertedFile";
- private static final String PROP_ADD_COMMENT = "AddComment";
- private static final String PROP_ADD_TCOMMENT = "AddTcomment";
- private static final String PROP_CONVERTED_FILE = "ConvertedFile";
- private static final String PROP_NOT_ADD_VIDEOID_CONV = "NotAddVideoIDtoConverted";
- private static final String PROP_CONV_FIX_FILE_NAME = "ConvFixFileName";
- private static final String PROP_CONV_FIX_FILE_NAME_FOLDER = "ConvFixFileNameFolder";
- private final boolean cutIdName;
- private final boolean addComment;
- private final boolean addTcomment;
-
- /**
- *
- * @param processKind 変換処理を行うのであればtrue.
- * @param cutIdName 出力名に動画IDをつけないのであればtrue. autoNamingがtrueの場合に用いられる.
- * @param addComment 変換処理時, コメントを付加するのであればtrue.
- * @param addTcomment 変換処理時, 投稿者コメントを付加するのであればtrue.
- */
- public OutputVideoSetting(boolean processKind, boolean autoNaming, File folder, File file, boolean cutIdName,
- boolean addComment, boolean addTcomment) {
- super(processKind, autoNaming, folder, file);
- this.cutIdName = cutIdName;
- this.addComment = addComment;
- this.addTcomment = addTcomment;
- }
-
- @Override
- public void save(Properties prop) {
- prop.setProperty(PROP_SAVE_CONVERTED, Boolean.toString(getProcessKind()));
- prop.setProperty(PROP_ADD_COMMENT, Boolean.toString(isAddComment()));
- prop.setProperty(PROP_ADD_TCOMMENT, Boolean.toString(isAddTcomment()));
- prop.setProperty(PROP_CONVERTED_FILE, getFile().getPath());
- prop.setProperty(PROP_NOT_ADD_VIDEOID_CONV, Boolean.toString(isCutIdName()));
- prop.setProperty(PROP_CONV_FIX_FILE_NAME, (new Boolean(isAutoNaming())).toString());
- prop.setProperty(PROP_CONV_FIX_FILE_NAME_FOLDER, getFolder().getPath());
-
-
- }
-
- public static OutputVideoSetting load(Properties prop) {
- boolean process = Boolean.parseBoolean(prop.getProperty(PROP_SAVE_CONVERTED, "true"));
- boolean addComment = Boolean.valueOf(prop.getProperty(PROP_ADD_COMMENT, "true"));
- boolean addTcomment = Boolean.valueOf(prop.getProperty(PROP_ADD_TCOMMENT, "true"));
- String file = prop.getProperty(PROP_CONVERTED_FILE, "video.avi");
- boolean cutId = Boolean.parseBoolean(prop.getProperty(PROP_NOT_ADD_VIDEOID_CONV, "false"));
- boolean autoNaming = Boolean.parseBoolean(prop.getProperty(PROP_CONV_FIX_FILE_NAME, "true"));
- String folder = prop.getProperty(PROP_CONV_FIX_FILE_NAME_FOLDER, "out/_converted");
-
- return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
- addTcomment);
- }
-
- public final boolean isCutIdName() {
- return cutIdName;
- }
-
- public final boolean isAddComment() {
- return addComment;
- }
-
- public final boolean isAddTcomment() {
- return addTcomment;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.properties;
-
-import java.io.File;
-import java.util.Properties;
-
-/**
- * 処理対象ファイル設定のためのスーパクラス.
- * @author yuki
- */
-public abstract class ProcessFileSetting<T> {
-
- private final T processKind;
- private final boolean autoNaming;
- private final File folder;
- private final File file;
-
- /**
- * 処理対象ファイル設定のためのスーパクラス.
- * @param processKind 処理する種類を設定する.
- * 対象ファイルにより意味は異なるが, 入力ファイルではダウンロードするのであればtrue,
- * 出力ファイルであれば変換する(出力する)のであればtrue, というように用いる.
- * @param autoNaming フォルダ名のみを指定してファイル名は自動命名/自動検索するのであればtrue,
- * ファイル名まで指定するのであればfalse.
- * @param folder 画面で入力したフォルダ名. autoNamingがtrueの場合に用いられる.
- * @param file 画面で入力したファイル名. autoNamingがfalseの場合に用いられる.
- */
- public ProcessFileSetting(T processKind, boolean autoNaming, File folder, File file) {
- this.processKind = processKind;
- this.autoNaming = autoNaming;
- this.folder = folder;
- this.file = file;
- }
-
- public final T getProcessKind() {
- return processKind;
- }
-
- /**
- * @return 「保存するフォルダを指定し、ファイル名は自動で決定する」のであればtrue.
- * 「保存するファイル名を指定する」のであればfalse.
- */
- public final boolean isAutoNaming() {
- return autoNaming;
- }
-
- public final File getFolder() {
- return folder;
- }
-
- public final File getFile() {
- return file;
- }
-
-
- public abstract void save(Properties prop);
-}
+++ /dev/null
-package saccubus.worker.classic.profile;
-
-/**
- * コメント取得に関するプロファイルです.
- * @author yuki
- */
-public class CommentGetInfo {
-
- /** コメント取得数を自動調整するのであればtrue. */
- private final boolean selfAdjustCommentNum;
- /** コメント取得数を自動調整しない場合の取得数. */
- private final int backComment;
- /** 旧仕様(2010年末までバージョン)でコメントを取得する場合はtrue. */
- private final boolean reduceComment;
-
- public CommentGetInfo(boolean selfAdjustCommentNum, int backComment, boolean reduceComment) {
- this.selfAdjustCommentNum = selfAdjustCommentNum;
- this.backComment = backComment;
- this.reduceComment = reduceComment;
- }
-
- public boolean isSelfAdjustCommentNum() {
- return selfAdjustCommentNum;
- }
-
- public int getBackComment() {
- return backComment;
- }
-
- public boolean isReduceComment() {
- return reduceComment;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-import java.io.File;
-import saccubus.worker.profile.GeneralProfile;
-import saccubus.worker.profile.OutputProfile;
-
-/**
- *
- * @author yuki
- */
-public class Ffmpeg implements saccubus.worker.profile.ConvertProfile {
-
- private final File ffmpeg;
- private final File vhook;
- private final FfmpegOption ffmpegOption;
- private final boolean vhookDisabled;
- private final int maxNumOfComment;
- private final File font;
- private final int fontIndex;
- private final int shadowIndex;
- private final boolean showConverting;
- private final boolean selfAdjustFontSize;
- private final boolean commentOpaque;
- private final HideCondition ngSetting;
-
- public Ffmpeg(File ffmpegPath, File vhookPath, FfmpegOption ffmpegOption, boolean vhookDisabled,
- int videoShowNum, File fontPath, int fontIndex, int shadowIndex, boolean showConvertingVideo,
- boolean selfAdjustFontSize, boolean opaqueComment, HideCondition ngSetting) {
- this.ffmpeg = ffmpegPath;
- this.vhook = vhookPath;
- this.ffmpegOption = ffmpegOption;
- this.vhookDisabled = vhookDisabled;
- this.maxNumOfComment = videoShowNum;
- this.font = fontPath;
- this.fontIndex = fontIndex;
- this.shadowIndex = shadowIndex;
- this.showConverting = showConvertingVideo;
- this.selfAdjustFontSize = selfAdjustFontSize;
- this.commentOpaque = opaqueComment;
- this.ngSetting = ngSetting;
- }
-
- @Override
- public FfmpegOption getFfmpegOption() {
- return ffmpegOption;
- }
-
- public File getFfmpeg() {
- return ffmpeg;
- }
-
- public int getFontIndex() {
- return fontIndex;
- }
-
- public File getFont() {
- return font;
- }
-
- public boolean isCommentOpaque() {
- return commentOpaque;
- }
-
- @Override
- public boolean isDisableFontSizeArrange() {
- return !selfAdjustFontSize;
- }
-
- public int getShadowIndex() {
- return shadowIndex;
- }
-
- public boolean isShowConverting() {
- return showConverting;
- }
-
- public boolean isVhookDisabled() {
- return vhookDisabled;
- }
-
- public File getVhook() {
- return vhook;
- }
-
- public int getMaxNumOfComment() {
- return maxNumOfComment;
- }
-
- public HideCondition getNgSetting() {
- return ngSetting;
- }
-
- @Override
- public File getTempDir() {
- return new File(".");
- }
-
- @Override
- public OutputProfile getOutputProfile() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public GeneralProfile getGeneralProfile() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean isConvert() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean isCommentOverlay() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-import org.apache.commons.lang.StringUtils;
-import saccubus.worker.profile.GeneralProfile;
-
-/**
- *
- * @author yuki
- */
-public class FfmpegOption implements saccubus.worker.profile.FfmpegProfile {
-
- private final String extOption;
- private final String mainOption;
- private final String inOption;
- 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 static FfmpegOption load(File file) throws IOException {
- Properties prop = new Properties();
- prop.loadFromXML(new FileInputStream(file));
- String ext = prop.getProperty("EXT");
- String main = prop.getProperty("MAIN", "");
- String in = prop.getProperty("IN", "");
- String out = prop.getProperty("OUT", "");
- String avfilter = prop.getProperty("AVFILTER", "");
- boolean resize = Boolean.getBoolean(prop.getProperty("RESIZE", "false"));
- String width = prop.getProperty("WIDTH", "");
- String height = prop.getProperty("HEIGHT", "");
- boolean adjust = Boolean.getBoolean(prop.getProperty("ADJST_RATIO", "true"));
-
- if (StringUtils.isBlank(ext)) {
- throw new IOException("変換オプションファイル書式誤り ext: "
- + ext + ", main: " + main + ", in: " + in + ", out: " + out + ", avfilter: " + avfilter);
- }
- return new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust);
- }
-
- public FfmpegOption(String extOption, String mainOption, String inOption, String outOption, String avfilterOption,
- boolean resize, String width, String height, boolean adjust) {
- this.extOption = (extOption.startsWith(".")) ? extOption : "." + extOption;
- this.mainOption = mainOption;
- this.inOption = inOption;
- this.outOption = outOption;
- this.avfilterOption = avfilterOption;
- this.resize = resize;
- this.resizeWidth = (width.isEmpty()) ? 0 : Integer.parseInt(width);
- this.resizeHeight = (height.isEmpty()) ? 0 : Integer.parseInt(height);
- this.adjustRatio = adjust;
- }
-
-
- @Override
- public String getExtOption() {
- return extOption;
- }
-
- @Override
- public String getMainOption() {
- return mainOption;
- }
-
- @Override
- public String getInOption() {
- return inOption;
- }
-
- @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;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-import java.io.File;
-
-public class GeneralSetting implements saccubus.worker.profile.GeneralProfile {
-
- private final File tempDir;
-
- public GeneralSetting(File tempDir) {
- this.tempDir = tempDir;
- }
-
- @Override
- public String getReplaceFrom() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getReplaceTo() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-import java.io.File;
-import saccubus.worker.profile.CommentProfile;
-import saccubus.worker.profile.VideoProfile;
-
-/**
- *
- * @author yuki
- */
-public class InputFileSetting implements VideoProfile, CommentProfile {
-
- private final boolean download;
- private final boolean delete;
- private final CommentGetInfo commentGetInfo;
- private final long backLogPoint;
-
- /**
- * @param file 対象ファイル.
- * @param download ダウンロードする必要があればtrue, ローカルファイルを用いるのであればfalse.
- * @param delete 変換後にファイルを削除するのであればtrue, 残したままにするのであればfalse.
- */
- public InputFileSetting(boolean download, boolean delete, CommentGetInfo cominfo, long backLogPoint) {
- this.download = download;
- this.delete = delete;
- this.commentGetInfo = cominfo;
- this.backLogPoint = backLogPoint;
- }
-
- @Override
- public String getFileName() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean isDownload() {
- return download;
- }
-
- public boolean isDelete() {
- return delete;
- }
-
- private boolean isSelfAdjustCommentNum() {
- return commentGetInfo.isSelfAdjustCommentNum();
- }
-
- @Override
- public int getLengthRelatedCommentSize() {
- if (isSelfAdjustCommentNum()) {
- return commentGetInfo.getBackComment();
- }
- return -1;
- }
-
- @Override
- public boolean isDisablePerMinComment() {
- return commentGetInfo.isReduceComment();
- }
-
- @Override
- public long getBackLogPoint() {
- return backLogPoint;
- }
-
- @Override
- public File getDir() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public File getLocalFile() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public int getPerMinCommentSize() {
- return -1;
- }
-}
+++ /dev/null
-package saccubus.worker.classic.profile;
-
-import saccubus.worker.classic.profile.Proxy;
-
-/**
- *
- * @author yuki
- */
-public class LoginInfo implements saccubus.worker.profile.LoginProfile {
-
- private final String mail;
- private final String pass;
- private final Proxy proxy;
-
- public LoginInfo(String mail, String pass, Proxy proxy) {
- this.mail = mail;
- this.pass = pass;
- this.proxy = proxy;
- }
-
- public String getMail() {
- return mail;
- }
-
- public String getPassword() {
- return pass;
- }
-
- public Proxy getProxy() {
- return proxy;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-/**
- * NG設定.
- * @author yuki
- */
-public class NgSetting implements saccubus.worker.profile.ConvertProfile.HideCondition {
-
- private final String word;
- private final String id;
-
- public NgSetting(String word, String id) {
- this.word = word;
- this.id = id;
- }
-
- public String getWord() {
- return word;
- }
-
- public String getId() {
- return id;
- }
-}
+++ /dev/null
-package saccubus.worker.classic.profile;
-
-import java.io.File;
-
-/**
- *
- * @author yuki
- */
-public class OutputFileSetting implements saccubus.worker.profile.OutputProfile {
-
- private final boolean convert;
- private final boolean appendPrefixVideoId;
- private final boolean addComment;
- private final boolean addTcomment;
-
- public OutputFileSetting(boolean convert, boolean appendPrefixVideoId, boolean addComment,
- boolean addTcomment) {
- this.convert = convert;
- this.appendPrefixVideoId = appendPrefixVideoId;
- this.addComment = addComment;
- this.addTcomment = addTcomment;
- }
-
- public boolean isConvert() {
- return convert;
- }
-
- public boolean isAppendPrefixVideoId() {
- return appendPrefixVideoId;
- }
-
- public boolean isCommentOverlay() {
- return addComment;
- }
-
- public boolean isAddTcomment() {
- return addTcomment;
- }
-
- @Override
- public File getDir() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getFileName() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getVideoId() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getTitile() {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-import saccubus.worker.profile.CommentProfile;
-import saccubus.worker.profile.VideoProfile;
-
-/**
- * Converterに処理させるための設定.
- * @author yuki
- */
-public class Profile implements saccubus.worker.profile.DownloadProfile {
-
- private final GeneralSetting generalSetting;
- private final LoginInfo loginInfo;
- private final VideoProfile videoSetting;
- private final CommentProfile commentSetting;
- private final CommentGetInfo commentGetInfo;
- private final InputFileSetting tcommentSetting;
- private final OutputFileSetting outputFileSetting;
- private final Ffmpeg ffmpeg;
-
- public Profile(
- GeneralSetting generalSetting,
- LoginInfo loginInfo,
- VideoProfile videoSetting,
- CommentProfile commentSetting,
- CommentGetInfo commentGetInfo,
- InputFileSetting tcommentSetting,
- OutputFileSetting outputFileSetting,
- Ffmpeg ffmpeg) {
- this.generalSetting = generalSetting;
- this.loginInfo = loginInfo;
- this.videoSetting = videoSetting;
- this.commentSetting = commentSetting;
- this.commentGetInfo = commentGetInfo;
- this.tcommentSetting = tcommentSetting;
- this.outputFileSetting = outputFileSetting;
- this.ffmpeg = ffmpeg;
- }
-
- @Override
- public LoginInfo getLoginInfo() {
- return loginInfo;
- }
-
- @Override
- public Proxy getProxyProfile(){
- return loginInfo.getProxy();
- }
-
- @Override
- public VideoProfile getVideoProfile() {
- return videoSetting;
- }
-
- @Override
- public CommentProfile getCommentProfile() {
- return commentSetting;
- }
-
- public InputFileSetting getTcommentSetting() {
- return tcommentSetting;
- }
-
- public OutputFileSetting getOutputFileSetting() {
- return outputFileSetting;
- }
-
- public CommentGetInfo getCommentGetInfo() {
- return commentGetInfo;
- }
-
- public boolean needsConvert() {
- return getOutputFileSetting().isConvert();
- }
-
- @Override
- public GeneralSetting getGeneralProfile() {
- return generalSetting;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-import org.apache.commons.lang.StringUtils;
-
-/**
- *
- * @author yuki
- */
-public class Proxy implements saccubus.worker.profile.ProxyProfile {
-
- private String host;
- private int port;
- public static final Proxy NO_PROXY = new Proxy();
-
- private Proxy() {
- this.host = null;
- this.port = -1;
- }
-
- public Proxy(String host, int port) {
- if (StringUtils.isEmpty(host) || port < 0 || port > 65535) {
- throw new IllegalArgumentException("プロキシの設定が不適切です");
- }
- this.host = host;
- this.port = port;
- }
-
- public boolean use(){
- return this != NO_PROXY;
- }
-
- public String getHost() {
- return host;
- }
-
- public int getPort() {
- return port;
- }
-}
+++ /dev/null
-/* $Id$ */
-package saccubus.worker.classic.profile;
-
-/**
- * ニコニコ動画ユーザ設定.
- * @author yuki
- */
-public class User implements saccubus.worker.profile.LoginProfile {
-
- private final String mail;
- private final String password;
-
- public User(String mail, String password) {
- this.mail = mail;
- this.password = password;
- }
-
- @Override
- public String getMail() {
- return mail;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-}