OSDN Git Service

デフォルトコメントを削除
[coroid/inqubus.git] / frontend / src / saccubus / converter / filegetter / CommentFileWebGetter.java
1 package saccubus.converter.filegetter;
2
3 import java.io.File;
4 import java.io.IOException;
5 import saccubus.net.NicoClient;
6 import saccubus.net.TextProgressListener;
7 import saccubus.net.VideoInfo;
8
9 /**
10  *
11  * @author yuki
12  */
13 public class CommentFileWebGetter extends TcommFileWebGetter {
14
15     private final boolean autoCommentNum;
16     private final int backComment;
17
18     CommentFileWebGetter(NicoClient client, VideoInfo vi, boolean autoCommentNum, int backComment) {
19         super(client, vi);
20         this.autoCommentNum = autoCommentNum;
21         this.backComment = backComment;
22     }
23
24     @Override
25     public File get(File file, TextProgressListener listener) throws IOException {
26         String com = Integer.toString(backComment);
27         if (this.autoCommentNum) {
28             com = getClient().getBackCommentFromLength(getVideoInfo(), com);
29         }
30
31         File res = getClient().getComment(getVideoInfo(), file, listener, com);
32         if (res == null) {
33             throw new IOException("コメントファイルのダウンロードに失敗しました。");
34         }
35         return res;
36     }
37 }