2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
5 package saccubus.converter.filegetter;
8 import java.io.IOException;
9 import saccubus.net.NicoClient;
10 import saccubus.net.TextProgressListener;
11 import saccubus.net.VideoInfo;
17 public class CommentFileWebGetter extends TcommFileWebGetter {
19 private final boolean autoCommentNum;
20 private final int backComment;
22 CommentFileWebGetter(NicoClient client, VideoInfo vi, boolean autoCommentNum, int backComment) {
24 this.autoCommentNum = autoCommentNum;
25 this.backComment = backComment;
29 public File get(File file, TextProgressListener listener) throws IOException {
30 String com = Integer.toString(backComment);
31 if (this.autoCommentNum) {
32 com = getBackCommentFromLength(getVideoInfo(), com);
35 File res = getClient().getComment(getVideoInfo(), file, listener, com);
37 throw new IOException("コメントファイルのダウンロードに失敗しました。");
42 private String getBackCommentFromLength(VideoInfo vi, String def) {
43 final int videoLength = vi.getVideoLength();
44 if (videoLength < 0) {
46 } else if (videoLength >= 0 && videoLength < 60) {
48 } else if (videoLength >= 60 && videoLength < 300) {
50 } else if (videoLength >= 300 && videoLength < 600) {