This commit is contained in:
yutou 2021-04-20 18:36:23 +08:00
parent 7214751dd7
commit 680b7ff8b9

View File

@ -174,8 +174,6 @@ public class SaveLive {
} }
private void httpDownload(String url) throws Exception { private void httpDownload(String url) throws Exception {
com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId);
QQBotManager.getInstance().sendMessage(roomId + " 已启动录制");
HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie()); HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie());
connection.setReadTimeout(5000); connection.setReadTimeout(5000);
connection.setConnectTimeout(5000); connection.setConnectTimeout(5000);
@ -195,12 +193,18 @@ public class SaveLive {
liveFile.mkdirs(); liveFile.mkdirs();
liveFile.delete(); liveFile.delete();
} }
boolean isPrint=false;
FileOutputStream outputStream = new FileOutputStream(liveFile); FileOutputStream outputStream = new FileOutputStream(liveFile);
int len; int len;
byte[] bytes = new byte[1024]; byte[] bytes = new byte[1024];
while ((len = inputStream.read(bytes)) != -1 && isSave) { while ((len = inputStream.read(bytes)) != -1 && isSave) {
outputStream.write(bytes, 0, len); outputStream.write(bytes, 0, len);
outputStream.flush(); outputStream.flush();
if(!isPrint){
com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId);
QQBotManager.getInstance().sendMessage(roomId + " 已启动录制");
isPrint=true;
}
} }
outputStream.close(); outputStream.close();
inputStream.close(); inputStream.close();