2 package saccubus.properties;
5 import java.util.Properties;
6 import saccubus.VideoSaveKind;
9 *
\93ü
\97Í
\93®
\89æ
\90Ý
\92è
\82ð
\95Û
\8e\9d\82·
\82é
\83N
\83\89\83X.
12 public class InputVideoSetting extends InputFileSetting<VideoSaveKind> {
14 private static final String PROP_SAVE_VIDEO = "SaveVideoFile";
15 private static final String PROP_VIDEO_FIX_FILE_NAME = "VideoFixFileName";
16 private static final String PROP_VIDEO_FIX_FILE_NAME_FOLDER = "VideoFixFileNameFolder";
17 private static final String PROP_VIDEO_FILE = "VideoFile";
18 private static final String PROP_DEL_VIDEO_AFTER_CONV = "DeleteVideoAfterConv";
19 private static final String PROP_NICO_BROWSER_FILE_NAME = "NicoBrowserFileName";
20 private final File nicoBrowserFile;
22 public InputVideoSetting(VideoSaveKind download, boolean autoNaming, File folder,
23 File file, boolean deleteAfterConvert, File nicoBrowserFile) {
24 super(download, autoNaming, folder, file, deleteAfterConvert);
25 this.nicoBrowserFile = nicoBrowserFile;
28 public void save(Properties prop) {
29 prop.setProperty(PROP_SAVE_VIDEO, getProcessKind().toString());
30 prop.setProperty(PROP_VIDEO_FILE, getFile().getPath());
31 prop.setProperty(PROP_VIDEO_FIX_FILE_NAME, Boolean.toString(isAutoNaming()));
32 prop.setProperty(PROP_VIDEO_FIX_FILE_NAME_FOLDER, getFolder().getPath());
33 prop.setProperty(PROP_DEL_VIDEO_AFTER_CONV, Boolean.toString(isDeleteAfterConvert()));
34 prop.setProperty(PROP_NICO_BROWSER_FILE_NAME, getNicoBrowserFile().getPath());
37 public static InputVideoSetting load(Properties prop) {
38 final VideoSaveKind kind = convertVideoSaveKind(prop);
39 boolean autoNaming = Boolean.parseBoolean(prop.getProperty(PROP_VIDEO_FIX_FILE_NAME, "true"));
40 String folder = prop.getProperty(PROP_VIDEO_FIX_FILE_NAME_FOLDER, ".\\[out]video\\");
41 String file = prop.getProperty(PROP_VIDEO_FILE, ".\\video.flv");
42 boolean delete = Boolean.parseBoolean(prop.getProperty(PROP_DEL_VIDEO_AFTER_CONV, "false"));
43 String nibrFile = prop.getProperty(PROP_NICO_BROWSER_FILE_NAME, "");
45 return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
48 /**
\96{
\89Æ
\82³
\82«
\82ã
\82Î
\82·
\82Å
\95Û
\91¶
\82µ
\82Ä
\82¢
\82½
\8fê
\8d\87\81APROP_SAVE_VIDEO
\82Ítrue/false
\82È
\82Ì
\82Å
\95Ï
\8a·
\82·
\82é. */
49 private static VideoSaveKind convertVideoSaveKind(Properties prop) {
51 String saveVideo = prop.getProperty(PROP_SAVE_VIDEO);
52 if (Boolean.toString(true).equals(saveVideo) || saveVideo == null) {
53 kind = VideoSaveKind.SAVE;
54 } else if (Boolean.toString(false).equals(saveVideo)) {
55 kind = VideoSaveKind.NO_SAVE;
57 kind = VideoSaveKind.valueOf(saveVideo);
62 public File getNicoBrowserFile() {
63 return nicoBrowserFile;