@Override
public File get(File file, TextProgressListener listener) throws IOException {
- String com = Integer.toString(backComment);
+ int com;
if (this.autoCommentNum) {
- com = getBackCommentFromLength(getVideoInfo(), com);
+ com = getVideoInfo().getBackCommentFromLength();
+ } else {
+ com = backComment;
}
File res = getClient().getComment(getVideoInfo(), getCommentInfo(), file, listener, com);
return res;
}
- private String getBackCommentFromLength(VideoInfo vi, String def) {
- final int videoLength = vi.getVideoLength();
- if (videoLength < 0) {
- return def;
- } else if (videoLength >= 0 && videoLength < 60) {
- return "100";
- } else if (videoLength >= 60 && videoLength < 300) {
- return "250";
- } else if (videoLength >= 300 && videoLength < 600) {
- return "500";
- } else {
- return "1000";
- }
- }
-
private CommentInfo getCommentInfo() {
return commentInfo;
}
File getVideo(VideoInfo videoInfo, File file, TextProgressListener listener);
- File getComment(VideoInfo videoInfo, CommentInfo commentInfo, File file, TextProgressListener listener, String com);
+ File getComment(VideoInfo videoInfo, CommentInfo commentInfo, File file, TextProgressListener listener, int com);
File getTcomment(VideoInfo videoInfo, File file, TextProgressListener listener);
}
}
@Override
- public File getComment(VideoInfo vi, CommentInfo ci, final File file, final TextProgressListener status, String back_comment) {
+ public File getComment(VideoInfo vi, CommentInfo ci, final File file, final TextProgressListener status, int back_comment) {
return downloadComment(back_comment, file, vi, ci, status, false);
}
*/
@Override
public File getTcomment(VideoInfo vi, final File file, final TextProgressListener status) {
- return downloadComment("500", file, vi, status, true);
+ return downloadComment(1000, file, vi, status, true);
}
- private File downloadComment(String back_comment, final File file, VideoInfo vi, final TextProgressListener status,
+ private File downloadComment(int back_comment, final File file, VideoInfo vi, final TextProgressListener status,
boolean isTcomm) throws NumberFormatException {
return downloadComment(back_comment, file, vi, CommentInfo.DEFAULT, status, isTcomm);
}
- private File downloadComment(String back_comment, final File file, VideoInfo vi, CommentInfo ci, final TextProgressListener status,
+ private File downloadComment(int back_comment, final File file, VideoInfo vi, CommentInfo ci, final TextProgressListener status,
boolean isTcomm) throws NumberFormatException {
System.out.print("Downloading comment size:" + back_comment + "...");
try {