OSDN Git Service

6a9c430dfe99f363b9cedb0914457d9184f8e777
[coroid/inqubus.git] / frontend / src / saccubus / converter / profile / Profile.java
1 /* $Id$ */
2 package saccubus.converter.profile;
3
4 import org.apache.commons.lang.builder.ToStringBuilder;
5 import saccubus.converter.filegetter.LoginInfo;
6
7 /**
8  * Converterに処理させるための設定.
9  * @author yuki
10  */
11 public class Profile {
12
13     private final GeneralSetting generalSetting;
14     private final LoginInfo loginInfo;
15     private final InputFileSetting videoSetting;
16     private final InputFileSetting commentSetting;
17     private final CommentGetInfo commentGetInfo;
18     private final InputFileSetting tcommentSetting;
19     private final OutputFileSetting outputFileSetting;
20     private final Ffmpeg ffmpeg;
21
22     public Profile(
23             GeneralSetting generalSetting,
24             LoginInfo loginInfo,
25             InputFileSetting videoSetting,
26             InputFileSetting commentSetting,
27             CommentGetInfo commentGetInfo,
28             InputFileSetting tcommentSetting,
29             OutputFileSetting outputFileSetting,
30             Ffmpeg ffmpeg) {
31         this.generalSetting = generalSetting;
32         this.loginInfo = loginInfo;
33         this.videoSetting = videoSetting;
34         this.commentSetting = commentSetting;
35         this.commentGetInfo = commentGetInfo;
36         this.tcommentSetting = tcommentSetting;
37         this.outputFileSetting = outputFileSetting;
38         this.ffmpeg = ffmpeg;
39     }
40
41     public LoginInfo getLoginInfo() {
42         return loginInfo;
43     }
44
45     /** @return 何か実行すべき処理があればtrue. */
46     public boolean shouldRun() {
47         return getOutputFileSetting().isConvert() || needsDownload();
48     }
49
50     /** @return 何かダウンロードするものがあればtrue. */
51     public boolean needsDownload() {
52         return (videoSetting.isDownload() || commentSetting.isDownload() || tcommentSetting.isDownload());
53     }
54
55     public InputFileSetting getVideoSetting() {
56         return videoSetting;
57     }
58
59     public InputFileSetting getCommentSetting() {
60         return commentSetting;
61     }
62
63     public InputFileSetting getTcommentSetting() {
64         return tcommentSetting;
65     }
66
67     public OutputFileSetting getOutputFileSetting() {
68         return outputFileSetting;
69     }
70
71     public CommentGetInfo getCommentGetInfo() {
72         return commentGetInfo;
73     }
74
75     public boolean needsConvert() {
76         return getOutputFileSetting().isConvert();
77     }
78
79     public Ffmpeg getFfmpeg() {
80         return ffmpeg;
81     }
82
83     public GeneralSetting getGeneralSetting() {
84         return generalSetting;
85     }
86
87     @Override
88     public String toString(){
89         return ToStringBuilder.reflectionToString(this);
90     }
91 }