import nicobrowser.GetFlvResult;
import nicobrowser.NicoHttpClient;
import nicobrowser.ProgressListener;
+import nicobrowser.WayBackInfo;
import saccubus.ConvertStopFlag;
import saccubus.net.CommentInfo;
import saccubus.net.NicoClient;
import saccubus.util.FileUtil;
/**
- *
+ * NicoBrowserのニコニコ動画サービスアクセス機能をいんきゅばすから使用するためのアダプタ.
* @author yuki
*/
public class NicoBrowserAdapter implements NicoClient {
public File getComment(VideoInfo videoInfo, CommentInfo commentInfo, File file, TextProgressListener listener,
String com) {
try {
- // TODO CommentInfo を使用するようにしなければ
- return client.getCommentFile(nicoBrowserVi, file.getPath());
+ WayBackInfo wbi = new WayBackInfo(commentInfo.getWayBackKey(), commentInfo.getWayBackTime());
+ return client.getCommentFile(nicoBrowserVi, file.getPath(), wbi);
} catch (Exception ex) {
logger.log(Level.SEVERE, "コメント取得失敗", ex);
}
- // TODO 失敗した場合何を返す?
return null;
}
} catch (Exception ex) {
logger.log(Level.SEVERE, "投稿者コメント取得失敗", ex);
}
- // TODO 失敗した場合何を返す?
return null;
}
@Override
public void progress(long fileSize, long downloadSize) {
final double p = ((double) downloadSize / fileSize) * 100.0;
- final String msg = "動画ダウンロード:" + p + "パーセント完了";
+ final String msg = String.format("動画ダウンロード:%.2fパーセント完了", p);
listener.setText(msg);
}
+
+ @Override
+ public boolean getCancel() {
+ return stopFlag.needStop();
+ }
});
return res.getFile();
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);
}
- // TODO 失敗した場合何を返す?
return null;
}