OSDN Git Service

e6b38afa34aba2f2a0b6064937a3a0034a7e3848
[coroid/inqubus.git] / frontend / src / saccubus / net / VideoInfo.java
1 package saccubus.net;
2
3 /**
4  *
5  * @author yuki
6  */
7 public class VideoInfo {
8
9     private final String videoTitle;
10     private final String threadId;
11     private final String videoUrl;
12     private final String msgUrl;
13     private final String userId;
14     private final int videoLength;
15     private final OfficialOption officialOption;
16
17     /**
18      *
19      * @param videoTitle
20      * @param threadId
21      * @param videoUrl
22      * @param msgUrl
23      * @param userId
24      * @param videoLength
25      * @param officialOption nullも可.
26      */
27     public VideoInfo(String videoTitle, String threadId, String videoUrl, String msgUrl, String userId, int videoLength,
28             OfficialOption officialOption) {
29         if (videoTitle == null || threadId == null || videoUrl == null || msgUrl == null || userId == null) {
30             throw new IllegalArgumentException("video informationの情報が不正です。");
31         }
32         this.videoTitle = videoTitle;
33         this.threadId = threadId;
34         this.videoUrl = videoUrl;
35         this.msgUrl = msgUrl;
36         this.userId = userId;
37         this.videoLength = videoLength;
38         this.officialOption = officialOption;
39     }
40
41     public String getMsgUrl() {
42         return msgUrl;
43     }
44
45     public String getThreadId() {
46         return threadId;
47     }
48
49     public String getUserId() {
50         return userId;
51     }
52
53     public int getVideoLength() {
54         return videoLength;
55     }
56
57     public String getVideoTitle() {
58         return videoTitle;
59     }
60
61     public String getVideoUrl() {
62         return videoUrl;
63     }
64
65     public OfficialOption getOfficialOption() {
66         return officialOption;
67     }
68
69     public int getBackCommentFromLength() {
70         final int length = getVideoLength();
71
72         if (length < 60) {
73             return 100;
74         } else if (length < 300) {
75             return 250;
76         } else if (length < 600) {
77             return 500;
78         } else {
79             return 1000;
80         }
81     }
82
83     public static class OfficialOption {
84
85         private final String threadKey;
86         private final String force184;
87
88         public OfficialOption(String threadKey, String force184) {
89 //            if (threadKey == null || force184 == null) {
90 //                throw new IllegalArgumentException("公式動画用キーが不正です");
91 //            }
92             this.threadKey = threadKey;
93             this.force184 = force184;
94         }
95
96         public String getThreadKey() {
97             return threadKey;
98         }
99
100         public String getForce184() {
101             return force184;
102         }
103     }
104 }