新增日志输出类
修复直播检测不绿的情况
This commit is contained in:
parent
51a0a3d111
commit
44272a609f
16
.mvn/wrapper/MavenWrapperDownloader.java
vendored
16
.mvn/wrapper/MavenWrapperDownloader.java
vendored
@ -47,9 +47,9 @@ public class MavenWrapperDownloader {
|
|||||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("- Downloader started");
|
com.yutou.bilibili.Tools.Log.i("- Downloader started");
|
||||||
File baseDirectory = new File(args[0]);
|
File baseDirectory = new File(args[0]);
|
||||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
com.yutou.bilibili.Tools.Log.i("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||||
|
|
||||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||||
// wrapperUrl parameter.
|
// wrapperUrl parameter.
|
||||||
@ -63,7 +63,7 @@ public class MavenWrapperDownloader {
|
|||||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
com.yutou.bilibili.Tools.Log.i("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (mavenWrapperPropertyFileInputStream != null) {
|
if (mavenWrapperPropertyFileInputStream != null) {
|
||||||
@ -74,22 +74,22 @@ public class MavenWrapperDownloader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("- Downloading from: " + url);
|
com.yutou.bilibili.Tools.Log.i("- Downloading from: " + url);
|
||||||
|
|
||||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||||
if (!outputFile.getParentFile().exists()) {
|
if (!outputFile.getParentFile().exists()) {
|
||||||
if (!outputFile.getParentFile().mkdirs()) {
|
if (!outputFile.getParentFile().mkdirs()) {
|
||||||
System.out.println(
|
com.yutou.bilibili.Tools.Log.i(
|
||||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
com.yutou.bilibili.Tools.Log.i("- Downloading to: " + outputFile.getAbsolutePath());
|
||||||
try {
|
try {
|
||||||
downloadFileFromURL(url, outputFile);
|
downloadFileFromURL(url, outputFile);
|
||||||
System.out.println("Done");
|
com.yutou.bilibili.Tools.Log.i("Done");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
System.out.println("- Error downloading");
|
com.yutou.bilibili.Tools.Log.i("- Error downloading");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1,81 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta name="referrer" content="no-referrer" />
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>DD监视器</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="layui-header">
|
|
||||||
<ul class="layui-nav" lay-filter="" style="background-color: #1772B4;">
|
|
||||||
<li class="layui-nav-item">DD监视器</li>
|
|
||||||
<div id="admin" style="display: inline-block; font-size: 0px;">
|
|
||||||
<li class="layui-nav-item"><a href="/html/body/bilibili/upInfo.html">UP管理</a>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</div>
|
|
||||||
<li class="layui-nav-item">
|
|
||||||
<a href="/html/body/bilibili/realTimeData.html">实时数据</a>
|
|
||||||
</li>
|
|
||||||
<li class="layui-nav-item">
|
|
||||||
<a href="/html/body/bilibili/overview.html">数据统计</a>
|
|
||||||
</li>
|
|
||||||
<li class="layui-nav-item" id='icon'>
|
|
||||||
<a href="javascript:;" id="login"><img src="https://static.hdslb.com/images/akari.jpg" class="layui-nav-img" id="icon_img"><span
|
|
||||||
id='login_text'>登录</span></a>
|
|
||||||
<dl class="layui-nav-child">
|
|
||||||
<dd><a href="javascript:;" id="logout">退了</a></dd>
|
|
||||||
</dl>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<script src="/js/qrcode.min.js"></script>
|
|
||||||
<script>
|
|
||||||
let loginStatus = false;
|
|
||||||
$.post('/user/get/test.do',function (json) {
|
|
||||||
$('#login_text').text(json.data.uname);
|
|
||||||
$('#icon_img').attr("src",json.data.icon);
|
|
||||||
loginStatus=true;
|
|
||||||
|
|
||||||
})
|
|
||||||
$('#login').click(function () {
|
|
||||||
if (loginStatus) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.post('/login/login.do',function (json) {
|
|
||||||
console.log(json)
|
|
||||||
layer.open({
|
|
||||||
title: "BiliBili客户端扫描登陆",
|
|
||||||
content: "<div id=\"qrcode\"></div>",
|
|
||||||
success: function () {
|
|
||||||
new QRCode(document.getElementById("qrcode"), json.url);
|
|
||||||
},
|
|
||||||
yes: function (index) {
|
|
||||||
layer.close(index)
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
$(document).ready(function () {
|
|
||||||
let mobile = layui.device().mobile;
|
|
||||||
if (mobile) {
|
|
||||||
$('.layui-body').css('left', '0')
|
|
||||||
$('.layui-body').css('top', '150px')
|
|
||||||
$('.layui-body').css('height', '200%')
|
|
||||||
$('#icon').css('float', 'none')
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$('.layui-body').css('padding-right', '100px')
|
|
||||||
$('#icon').css('float', 'right')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
</html>
|
|
@ -202,6 +202,7 @@
|
|||||||
}
|
}
|
||||||
for (let i in json.data.live) {
|
for (let i in json.data.live) {
|
||||||
$('#' + json.data.live[i].roomid).css('color', '#8FE18F')
|
$('#' + json.data.live[i].roomid).css('color', '#8FE18F')
|
||||||
|
console.log('绿了:'+json.data.live[i].roomid)
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post('/user/get/test.do',function (json) {
|
$.post('/user/get/test.do',function (json) {
|
||||||
|
@ -110,7 +110,7 @@ public class BiliVideoController {
|
|||||||
File file = new File("ffmpeg_out" + File.separator + time + File.separator + fileName);
|
File file = new File("ffmpeg_out" + File.separator + time + File.separator + fileName);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
file = new File("live" + File.separator + time + File.separator + fileName);
|
file = new File("live" + File.separator + time + File.separator + fileName);
|
||||||
System.out.println(file.getAbsolutePath());
|
com.yutou.bilibili.Tools.Log.i(file.getAbsolutePath());
|
||||||
return AppTools.getFile(file);
|
return AppTools.getFile(file);
|
||||||
}
|
}
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
@ -40,7 +40,7 @@ public class OverviewController {
|
|||||||
, LiveData.GUARD_BUY}));
|
, LiveData.GUARD_BUY}));
|
||||||
data.put("price", manager.queryPriceSize(upData.getRoomid(), startTime, endTime));
|
data.put("price", manager.queryPriceSize(upData.getRoomid(), startTime, endTime));
|
||||||
long h = (endTime.getTime() - startTime.getTime()) % (1000 * 24 * 60 * 60) / (1000 * 60 * 60);
|
long h = (endTime.getTime() - startTime.getTime()) % (1000 * 24 * 60 * 60) / (1000 * 60 * 60);
|
||||||
System.out.println("相差:" + h + "小时");
|
com.yutou.bilibili.Tools.Log.i("相差:" + h + "小时");
|
||||||
try {
|
try {
|
||||||
data.put("hprice", data.getInteger("price") / h);
|
data.put("hprice", data.getInteger("price") / h);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -52,7 +52,7 @@ public class OverviewController {
|
|||||||
List<BilibiliLiveInfo> infos=manager.queryLiveInfo(upData,startTime,endTime);
|
List<BilibiliLiveInfo> infos=manager.queryLiveInfo(upData,startTime,endTime);
|
||||||
int maxUser=0;
|
int maxUser=0;
|
||||||
for (BilibiliLiveInfo info : infos) {
|
for (BilibiliLiveInfo info : infos) {
|
||||||
System.out.println(info);
|
com.yutou.bilibili.Tools.Log.i(info);
|
||||||
maxUser+=info.getUserindex()+info.getVipuserindex();
|
maxUser+=info.getUserindex()+info.getVipuserindex();
|
||||||
JSONObject item=new JSONObject();
|
JSONObject item=new JSONObject();
|
||||||
String nowTime = new SimpleDateFormat("HH").format(info.getSubtime());
|
String nowTime = new SimpleDateFormat("HH").format(info.getSubtime());
|
||||||
|
@ -10,6 +10,7 @@ import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
|||||||
import com.yutou.bilibili.BiliBili.Tools.BiliTools;
|
import com.yutou.bilibili.BiliBili.Tools.BiliTools;
|
||||||
import com.yutou.bilibili.Services.IUserService;
|
import com.yutou.bilibili.Services.IUserService;
|
||||||
import com.yutou.bilibili.Tools.AppTools;
|
import com.yutou.bilibili.Tools.AppTools;
|
||||||
|
import com.yutou.bilibili.Tools.Log;
|
||||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||||
import com.yutou.bilibili.mybatis.model.UUser;
|
import com.yutou.bilibili.mybatis.model.UUser;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -41,7 +42,7 @@ public class UpInfoController {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
List<BilibiliUpInfo> upDataList =service.getUpInfo(user.getId(),user.getPower());
|
List<BilibiliUpInfo> upDataList =service.getUpInfo(user.getId(),user.getPower());
|
||||||
System.out.println("UP用户数:" + upDataList.size());
|
com.yutou.bilibili.Tools.Log.i("UP用户数:" + upDataList.size());
|
||||||
json.put("code", 0);
|
json.put("code", 0);
|
||||||
json.put("data", JSONArray.toJSON(upDataList));
|
json.put("data", JSONArray.toJSON(upDataList));
|
||||||
return json;
|
return json;
|
||||||
@ -54,7 +55,7 @@ public class UpInfoController {
|
|||||||
if (BiliTools.checkout(upData) != null) {
|
if (BiliTools.checkout(upData) != null) {
|
||||||
upData.setEnable(0);
|
upData.setEnable(0);
|
||||||
upData = BiliTools.checkout(upData);
|
upData = BiliTools.checkout(upData);
|
||||||
System.out.println(upData);
|
com.yutou.bilibili.Tools.Log.i(upData);
|
||||||
boolean flag = service.addUpInfo(upData);
|
boolean flag = service.addUpInfo(upData);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
json.put("code", 0);
|
json.put("code", 0);
|
||||||
@ -74,7 +75,7 @@ public class UpInfoController {
|
|||||||
@RequestMapping("/upinfo/set/update.do")
|
@RequestMapping("/upinfo/set/update.do")
|
||||||
public JSONObject update(BilibiliUpInfo upData) {
|
public JSONObject update(BilibiliUpInfo upData) {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
System.out.println("old data ="+upData);
|
com.yutou.bilibili.Tools.Log.i("old data ="+upData);
|
||||||
BilibiliUpInfo old = service.queryUp(upData);
|
BilibiliUpInfo old = service.queryUp(upData);
|
||||||
if (!old.getUrl().equals(upData.getUrl())) {
|
if (!old.getUrl().equals(upData.getUrl())) {
|
||||||
upData = BiliTools.checkout(upData);
|
upData = BiliTools.checkout(upData);
|
||||||
@ -84,7 +85,7 @@ public class UpInfoController {
|
|||||||
upData.setOfflinelistening(0);
|
upData.setOfflinelistening(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("save data = "+upData);
|
com.yutou.bilibili.Tools.Log.i("save data = "+upData);
|
||||||
boolean flag = service.updateUpInfo(upData);
|
boolean flag = service.updateUpInfo(upData);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
LiveController.getInstance().updateUpInfo(upData);
|
LiveController.getInstance().updateUpInfo(upData);
|
||||||
@ -101,7 +102,7 @@ public class UpInfoController {
|
|||||||
@RequestMapping("/upinfo/set/delete.do")
|
@RequestMapping("/upinfo/set/delete.do")
|
||||||
public JSONObject delete(BilibiliUpInfo upData) {
|
public JSONObject delete(BilibiliUpInfo upData) {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
System.out.println(upData);
|
com.yutou.bilibili.Tools.Log.i(upData);
|
||||||
boolean flag = service.deleteUp(upData);
|
boolean flag = service.deleteUp(upData);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
json.put("code", 0);
|
json.put("code", 0);
|
||||||
@ -124,7 +125,6 @@ public class UpInfoController {
|
|||||||
@RequestMapping("/upinfo/get/liveInfo.do")
|
@RequestMapping("/upinfo/get/liveInfo.do")
|
||||||
public JSONObject liveInfo() {
|
public JSONObject liveInfo() {
|
||||||
List<BilibiliUpInfo> list = service.getUpInfo();
|
List<BilibiliUpInfo> list = service.getUpInfo();
|
||||||
List<Live> lives=Live.lives;
|
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONArray info = new JSONArray();
|
JSONArray info = new JSONArray();
|
||||||
@ -141,7 +141,7 @@ public class UpInfoController {
|
|||||||
info.add(JSON.toJSON(up));
|
info.add(JSON.toJSON(up));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Live live : lives) {
|
for (Live live : Live.lives) {
|
||||||
if(live.geData().getLive()==1){
|
if(live.geData().getLive()==1){
|
||||||
liveArray.add(JSON.toJSON(live.geData()));
|
liveArray.add(JSON.toJSON(live.geData()));
|
||||||
}
|
}
|
||||||
|
@ -78,12 +78,13 @@ public class Live implements ApplicationContextAware {
|
|||||||
info.setUserindex(0);
|
info.setUserindex(0);
|
||||||
Live.lives.add(this);
|
Live.lives.add(this);
|
||||||
updateUpInfo();
|
updateUpInfo();
|
||||||
System.out.println("roomId = " + roomId + ", isLogin = " + isLogin);
|
com.yutou.bilibili.Tools.Log.i("roomId = " + roomId + ", isLogin = " + isLogin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateUpInfo() {
|
private void updateUpInfo() {
|
||||||
try {
|
try {
|
||||||
upData = service.queryUp(upData);
|
upData = service.queryUp(upData);
|
||||||
|
upData.setLive(1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -102,6 +103,10 @@ public class Live implements ApplicationContextAware {
|
|||||||
upData.setLive(1);
|
upData.setLive(1);
|
||||||
}
|
}
|
||||||
String url = LiveUtils.getLiveUrl(roomId);
|
String url = LiveUtils.getLiveUrl(roomId);
|
||||||
|
if(url==null){
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
HashMap<String, String> header = new HashMap<String, String>();
|
HashMap<String, String> header = new HashMap<String, String>();
|
||||||
header.put("Sec-WebSocket-Extensions", "permessage-deflate; client_max_window_bits");
|
header.put("Sec-WebSocket-Extensions", "permessage-deflate; client_max_window_bits");
|
||||||
header.put("Sec-WebSocket-Key", "tORCZd8AI6xIyvqvgvI1Vw==");
|
header.put("Sec-WebSocket-Key", "tORCZd8AI6xIyvqvgvI1Vw==");
|
||||||
@ -120,7 +125,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
@Override
|
@Override
|
||||||
public void onOpen(ServerHandshake serverHandshake) {
|
public void onOpen(ServerHandshake serverHandshake) {
|
||||||
time = System.currentTimeMillis();
|
time = System.currentTimeMillis();
|
||||||
System.out.println("ws: ok");
|
com.yutou.bilibili.Tools.Log.i("ws: ok");
|
||||||
try {
|
try {
|
||||||
likeLive();
|
likeLive();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -147,7 +152,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(int i, String s, boolean b) {
|
public void onClose(int i, String s, boolean b) {
|
||||||
System.out.println("连接时间:" + (System.currentTimeMillis() - time));
|
com.yutou.bilibili.Tools.Log.i("连接时间:" + (System.currentTimeMillis() - time));
|
||||||
if (upData.getOfflinelistening() == 1) {
|
if (upData.getOfflinelistening() == 1) {
|
||||||
System.err.println(roomId + " 断开连接,重连...");
|
System.err.println(roomId + " 断开连接,重连...");
|
||||||
try {
|
try {
|
||||||
@ -169,7 +174,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
@Override
|
@Override
|
||||||
public void onClosing(int code, String reason, boolean remote) {
|
public void onClosing(int code, String reason, boolean remote) {
|
||||||
super.onClosing(code, reason, remote);
|
super.onClosing(code, reason, remote);
|
||||||
System.out.println("code = " + code + ", reason = " + reason + ", remote = " + remote);
|
com.yutou.bilibili.Tools.Log.i("code = " + code + ", reason = " + reason + ", remote = " + remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -189,7 +194,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
SaveLive.getInstance().stop(roomId);
|
SaveLive.getInstance().stop(roomId);
|
||||||
}
|
}
|
||||||
Live.lives.remove(this);
|
Live.lives.remove(this);
|
||||||
System.out.printf("退出%d直播间%n", roomId);
|
com.yutou.bilibili.Tools.Log.i("退出"+roomId+"直播间");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -221,7 +226,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
json.put("clientver", "2.6.36");
|
json.put("clientver", "2.6.36");
|
||||||
json.put("type", 2);
|
json.put("type", 2);
|
||||||
json.put("key", http.getJSONObject("data").getString("token"));
|
json.put("key", http.getJSONObject("data").getString("token"));
|
||||||
System.out.println(json.toJSONString());
|
com.yutou.bilibili.Tools.Log.i(json.toJSONString());
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
outputStream.write(LiveUtils.toLH(json.toJSONString().length() + 16));
|
outputStream.write(LiveUtils.toLH(json.toJSONString().length() + 16));
|
||||||
outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1});
|
outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1});
|
||||||
@ -251,19 +256,18 @@ public class Live implements ApplicationContextAware {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
JSONObject json = JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
|
JSONObject json = JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
|
||||||
System.out.println(json);
|
com.yutou.bilibili.Tools.Log.i(json.toJSONString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
popular = LiveUtils.bytesToInt2(bytes, 0);
|
popular = LiveUtils.bytesToInt2(bytes, 0);
|
||||||
info.setPopular(popular);
|
info.setPopular(popular);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkLive();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("----------ERROR----------");
|
com.yutou.bilibili.Tools.Log.i("----------ERROR----------");
|
||||||
System.out.println(new String(data, StandardCharsets.UTF_8));
|
com.yutou.bilibili.Tools.Log.i(new String(data, StandardCharsets.UTF_8));
|
||||||
LiveUtils.printHex(LiveUtils.dec(data));
|
LiveUtils.printHex(LiveUtils.dec(data));
|
||||||
System.out.println(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date()));
|
com.yutou.bilibili.Tools.Log.i(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +297,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
|
|
||||||
switch (json.getString("cmd")) {
|
switch (json.getString("cmd")) {
|
||||||
case "INTERACT_WORD"://普通用户进直播间
|
case "INTERACT_WORD"://普通用户进直播间
|
||||||
// System.out.println(json.getJSONObject("data").getString("uname") + " 进入到直播间");
|
// com.yutou.bilibili.Tools.Log.i(json.getJSONObject("data").getString("uname") + " 进入到直播间");
|
||||||
danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间";
|
danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间";
|
||||||
liveData.setUid(json.getJSONObject("data").getInteger("uid"));
|
liveData.setUid(json.getJSONObject("data").getInteger("uid"));
|
||||||
liveData.setType(LiveData.INTERACT_WORD);
|
liveData.setType(LiveData.INTERACT_WORD);
|
||||||
@ -317,7 +321,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
}
|
}
|
||||||
danmuManager.addLiveData(liveData);*/
|
danmuManager.addLiveData(liveData);*/
|
||||||
}
|
}
|
||||||
System.out.println(json);
|
// com.yutou.bilibili.Tools.Log.i(json.toJSONString());
|
||||||
break;
|
break;
|
||||||
case "SEND_GIFT"://送礼
|
case "SEND_GIFT"://送礼
|
||||||
data = json.getJSONObject("data");
|
data = json.getJSONObject("data");
|
||||||
@ -376,7 +380,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
service.addLiveData(liveData);
|
service.addLiveData(liveData);
|
||||||
break;
|
break;
|
||||||
case "ENTRY_EFFECT"://舰长进直播间
|
case "ENTRY_EFFECT"://舰长进直播间
|
||||||
// System.out.println("[舰长]" + json.getJSONObject("data").getString("uid") + " 进入到直播间");
|
// com.yutou.bilibili.Tools.Log.i("[舰长]" + json.getJSONObject("data").getString("uid") + " 进入到直播间");
|
||||||
info.setVipuserindex(info.getVipuserindex() + 1);
|
info.setVipuserindex(info.getVipuserindex() + 1);
|
||||||
danmu = "[舰长]" + json.getJSONObject("data").getString("uid") + " 进入到直播间";
|
danmu = "[舰长]" + json.getJSONObject("data").getString("uid") + " 进入到直播间";
|
||||||
liveData.setUid(json.getJSONObject("data").getInteger("uid"));
|
liveData.setUid(json.getJSONObject("data").getInteger("uid"));
|
||||||
@ -439,10 +443,10 @@ public class Live implements ApplicationContextAware {
|
|||||||
case "PK_BATTLE_PRE":
|
case "PK_BATTLE_PRE":
|
||||||
|
|
||||||
|
|
||||||
//System.out.println(msg);
|
//com.yutou.bilibili.Tools.Log.i(msg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.out.println(msg);
|
com.yutou.bilibili.Tools.Log.i(msg);
|
||||||
liveData = new BilibiliLiveData();
|
liveData = new BilibiliLiveData();
|
||||||
liveData.setType(LiveData.UNKNOWN_MESSAGE);
|
liveData.setType(LiveData.UNKNOWN_MESSAGE);
|
||||||
liveData.setUid(-1);
|
liveData.setUid(-1);
|
||||||
@ -458,9 +462,8 @@ public class Live implements ApplicationContextAware {
|
|||||||
processData(new String(bytes, StandardCharsets.UTF_8), null);
|
processData(new String(bytes, StandardCharsets.UTF_8), null);
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
System.out.println(msg);
|
com.yutou.bilibili.Tools.Log.i(msg);
|
||||||
System.out.println("---------ERROR !!-----");
|
com.yutou.bilibili.Tools.Log.i("---------ERROR !!-----");
|
||||||
System.out.println();
|
|
||||||
LiveUtils.printHex(bytes);
|
LiveUtils.printHex(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +519,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// System.out.println("-------发送心跳--------");
|
// com.yutou.bilibili.Tools.Log.i("-------发送心跳--------");
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
outputStream.write(LiveUtils.toLH("[object Object]".length() + 16));
|
outputStream.write(LiveUtils.toLH("[object Object]".length() + 16));
|
||||||
outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1});
|
outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1});
|
||||||
@ -525,8 +528,8 @@ public class Live implements ApplicationContextAware {
|
|||||||
client.send(outputStream.toByteArray());
|
client.send(outputStream.toByteArray());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println(client.isClosed());
|
com.yutou.bilibili.Tools.Log.i(client.isClosed());
|
||||||
System.out.println(client.isOpen());
|
com.yutou.bilibili.Tools.Log.i(client.isOpen());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package com.yutou.bilibili.BiliBili;
|
package com.yutou.bilibili.BiliBili;
|
||||||
|
|
||||||
|
import com.yutou.bilibili.BiliBili.Datas.BiliBiliUpData;
|
||||||
import com.yutou.bilibili.BiliBili.Datas.GiftData;
|
import com.yutou.bilibili.BiliBili.Datas.GiftData;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||||
import com.yutou.bilibili.Tools.AppTools;
|
import com.yutou.bilibili.Tools.AppTools;
|
||||||
|
import com.yutou.bilibili.Tools.Log;
|
||||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
@ -20,7 +22,7 @@ import java.util.*;
|
|||||||
import java.util.zip.Inflater;
|
import java.util.zip.Inflater;
|
||||||
|
|
||||||
public class LiveUtils {
|
public class LiveUtils {
|
||||||
private static String cookie=null;
|
private static String cookie = null;
|
||||||
|
|
||||||
public LiveUtils() {
|
public LiveUtils() {
|
||||||
|
|
||||||
@ -29,19 +31,21 @@ public class LiveUtils {
|
|||||||
|
|
||||||
public static String getLiveUrl(int roomId) {
|
public static String getLiveUrl(int roomId) {
|
||||||
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id=" + roomId + "&type=0");
|
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id=" + roomId + "&type=0");
|
||||||
|
if (json != null)
|
||||||
return "wss://" + json.getJSONObject("data").getJSONArray("host_list").getJSONObject(0).getString("host") + "/sub";
|
return "wss://" + json.getJSONObject("data").getJSONArray("host_list").getJSONObject(0).getString("host") + "/sub";
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printHex(byte[] bytes) {
|
public static void printHex(byte[] bytes) {
|
||||||
String str = DatatypeConverter.printHexBinary(bytes);
|
String str = DatatypeConverter.printHexBinary(bytes);
|
||||||
for (int i = 0; i < str.length(); i = i + 4) {
|
for (int i = 0; i < str.length(); i = i + 4) {
|
||||||
if (i % 32 == 0 && i != 0) {
|
if (i % 32 == 0 && i != 0) {
|
||||||
System.out.println();
|
com.yutou.bilibili.Tools.Log.i("\n");
|
||||||
}
|
}
|
||||||
if (str.length() - i > 4) {
|
if (str.length() - i > 4) {
|
||||||
System.out.print(str.substring(i, i + 4));
|
System.out.print(str.substring(i, i + 4));
|
||||||
} else {
|
} else {
|
||||||
System.out.println(str.substring(i));
|
com.yutou.bilibili.Tools.Log.i(str.substring(i));
|
||||||
}
|
}
|
||||||
System.out.print(" ");
|
System.out.print(" ");
|
||||||
}
|
}
|
||||||
@ -100,7 +104,7 @@ public class LiveUtils {
|
|||||||
list.add(new String(datas.array(), StandardCharsets.UTF_8));
|
list.add(new String(datas.array(), StandardCharsets.UTF_8));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// System.out.println("datas size = " + size);
|
// com.yutou.bilibili.Tools.Log.i("datas size = " + size);
|
||||||
if (size > 1000000000) {
|
if (size > 1000000000) {
|
||||||
try {
|
try {
|
||||||
JSONObject.parseObject(new String(bytes));
|
JSONObject.parseObject(new String(bytes));
|
||||||
@ -201,7 +205,7 @@ public class LiveUtils {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return new JSONObject();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject http_post(String url, String body) {
|
public static JSONObject http_post(String url, String body) {
|
||||||
@ -307,7 +311,11 @@ public class LiveUtils {
|
|||||||
|
|
||||||
public static boolean isLivePlayer(int roomId) {
|
public static boolean isLivePlayer(int roomId) {
|
||||||
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + roomId);
|
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + roomId);
|
||||||
System.out.println("直播检测:" + roomId+" > "+(json.getJSONObject("data").getJSONObject("room_info").getInteger("live_status") == 1));
|
if (json == null)
|
||||||
|
return false;
|
||||||
|
BilibiliUpInfo upData = new BilibiliUpInfo();
|
||||||
|
upData.setRoomid(roomId);
|
||||||
|
Log.i("直播检测:" + roomId + " > " + (json.getJSONObject("data").getJSONObject("room_info").getInteger("live_status") == 1) + " 录播器:" + liveContains(upData));
|
||||||
return json.getJSONObject("data").getJSONObject("room_info").getInteger("live_status") == 1;
|
return json.getJSONObject("data").getJSONObject("room_info").getInteger("live_status") == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class BiliBiliLiveServiceImpl implements IBiliBiliLiveService {
|
|||||||
return upInfos;
|
return upInfos;
|
||||||
}
|
}
|
||||||
upInfos = upInfoDao.queryToRoomIds(ids);
|
upInfos = upInfoDao.queryToRoomIds(ids);
|
||||||
System.out.println("list = " + upInfos.size());
|
com.yutou.bilibili.Tools.Log.i("list = " + upInfos.size());
|
||||||
return upInfos;
|
return upInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,11 +28,11 @@ public class BiliTools {
|
|||||||
}
|
}
|
||||||
BilibiliUpInfo upData = new BilibiliUpInfo();
|
BilibiliUpInfo upData = new BilibiliUpInfo();
|
||||||
JSONObject json = LiveUtils.http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + url.replace("https://live.bilibili.com/", "").split("\\?")[0]);
|
JSONObject json = LiveUtils.http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + url.replace("https://live.bilibili.com/", "").split("\\?")[0]);
|
||||||
System.out.println(json);
|
com.yutou.bilibili.Tools.Log.i(json);
|
||||||
String roomId = json.getJSONObject("data").getJSONObject("room_info").getInteger("room_id") + "";
|
String roomId = json.getJSONObject("data").getJSONObject("room_info").getInteger("room_id") + "";
|
||||||
String name = json.getJSONObject("data").getJSONObject("anchor_info").getJSONObject("base_info").getString("uname");
|
String name = json.getJSONObject("data").getJSONObject("anchor_info").getJSONObject("base_info").getString("uname");
|
||||||
System.out.println(roomId);
|
com.yutou.bilibili.Tools.Log.i(roomId);
|
||||||
System.out.println(name);
|
com.yutou.bilibili.Tools.Log.i(name);
|
||||||
upData.setRoomid(Integer.parseInt(roomId));
|
upData.setRoomid(Integer.parseInt(roomId));
|
||||||
upData.setName(name);
|
upData.setName(name);
|
||||||
upData.setUrl(url);
|
upData.setUrl(url);
|
||||||
|
@ -26,11 +26,11 @@ public class LiveT implements ApplicationContextAware {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
System.out.println("初始化2");
|
com.yutou.bilibili.Tools.Log.i("初始化2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveT() {
|
public LiveT() {
|
||||||
System.out.println("初始化");
|
com.yutou.bilibili.Tools.Log.i("初始化");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(int a){
|
public void add(int a){
|
||||||
|
@ -54,7 +54,7 @@ public class SaveLive {
|
|||||||
private long timer = 0;
|
private long timer = 0;
|
||||||
|
|
||||||
public void stop(int roomId) {
|
public void stop(int roomId) {
|
||||||
System.out.println("t停止录播:" + roomId + " time=" + (System.currentTimeMillis() - timer));
|
com.yutou.bilibili.Tools.Log.i("t停止录播:" + roomId + " time=" + (System.currentTimeMillis() - timer));
|
||||||
saveList.remove(roomId + "");
|
saveList.remove(roomId + "");
|
||||||
|
|
||||||
if(downloads.containsKey(roomId)){
|
if(downloads.containsKey(roomId)){
|
||||||
@ -107,7 +107,7 @@ public class SaveLive {
|
|||||||
super.run();
|
super.run();
|
||||||
String url = getLiveUrl(roomId);
|
String url = getLiveUrl(roomId);
|
||||||
try {
|
try {
|
||||||
System.out.println("开始录制:" + roomId);
|
com.yutou.bilibili.Tools.Log.i("开始录制:" + roomId);
|
||||||
HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie());
|
HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie());
|
||||||
heartbeat = new Timer();
|
heartbeat = new Timer();
|
||||||
//Heartbeat beat = new Heartbeat();
|
//Heartbeat beat = new Heartbeat();
|
||||||
@ -134,7 +134,7 @@ public class SaveLive {
|
|||||||
}
|
}
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
System.out.println("录制完成:" + roomId + " save = " + isSave + " len = " + len);
|
com.yutou.bilibili.Tools.Log.i("录制完成:" + roomId + " save = " + isSave + " len = " + len);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
@ -151,16 +151,16 @@ public class SaveLive {
|
|||||||
JSONObject userHear = new JSONObject();
|
JSONObject userHear = new JSONObject();
|
||||||
JSONObject cookie = JSONObject.parseObject(LiveUtils.getFile("cookies.json"));
|
JSONObject cookie = JSONObject.parseObject(LiveUtils.getFile("cookies.json"));
|
||||||
hearBeat = LiveUtils.http_get("https://api.live.bilibili.com/relation/v1/Feed/heartBeat");
|
hearBeat = LiveUtils.http_get("https://api.live.bilibili.com/relation/v1/Feed/heartBeat");
|
||||||
System.out.printf(hearBeat+" \t");
|
com.yutou.bilibili.Tools.Log.i(hearBeat+" \t");
|
||||||
hearBeat = LiveUtils.http_get(String.format("https://live-trace.bilibili.com/xlive/rdata-interface/v1/heartbeat/webHeartBeat?hb=%s&pf=web", URLEncoder.encode(new String(Base64.getEncoder().encode(String.format("%d|%d|1|0",nextInterval, roomId).getBytes(StandardCharsets.UTF_8))), "UTF-8")));
|
hearBeat = LiveUtils.http_get(String.format("https://live-trace.bilibili.com/xlive/rdata-interface/v1/heartbeat/webHeartBeat?hb=%s&pf=web", URLEncoder.encode(new String(Base64.getEncoder().encode(String.format("%d|%d|1|0",nextInterval, roomId).getBytes(StandardCharsets.UTF_8))), "UTF-8")));
|
||||||
System.out.printf(hearBeat+"\t");
|
com.yutou.bilibili.Tools.Log.i(hearBeat+"\t");
|
||||||
nextInterval=hearBeat.getJSONObject("data").getInteger("next_interval");
|
nextInterval=hearBeat.getJSONObject("data").getInteger("next_interval");
|
||||||
System.out.println("next = "+nextInterval);
|
com.yutou.bilibili.Tools.Log.i("next = "+nextInterval);
|
||||||
userHear.put("csrf_token",cookie.getString("bili_jct"));
|
userHear.put("csrf_token",cookie.getString("bili_jct"));
|
||||||
userHear.put("csrf",cookie.getString("bili_jct"));
|
userHear.put("csrf",cookie.getString("bili_jct"));
|
||||||
userHear.put("visit_id","");
|
userHear.put("visit_id","");
|
||||||
hearBeat=LiveUtils.http_post("https://api.live.bilibili.com/User/userOnlineHeart", HttpTools.toUrlParams(userHear));
|
hearBeat=LiveUtils.http_post("https://api.live.bilibili.com/User/userOnlineHeart", HttpTools.toUrlParams(userHear));
|
||||||
System.out.println("["+AppTools.getToDayNowTimeToString()+"]"+hearBeat);
|
com.yutou.bilibili.Tools.Log.i("["+AppTools.getToDayNowTimeToString()+"]"+hearBeat);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class APIFilter implements Filter {
|
|||||||
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("无权限请求:"+tmp);
|
com.yutou.bilibili.Tools.Log.i("无权限请求:"+tmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONArray powers = JSONArray.parseArray(user.getPower());
|
JSONArray powers = JSONArray.parseArray(user.getPower());
|
||||||
|
@ -163,7 +163,7 @@ public class AppTools {
|
|||||||
public static String deleteCookie(HttpServletRequest request, HttpServletResponse response, String key) {
|
public static String deleteCookie(HttpServletRequest request, HttpServletResponse response, String key) {
|
||||||
for (Cookie cookie : request.getCookies()) {
|
for (Cookie cookie : request.getCookies()) {
|
||||||
if (cookie.getName().equals(key)) {
|
if (cookie.getName().equals(key)) {
|
||||||
System.out.println("删除key=" + key);
|
com.yutou.bilibili.Tools.Log.i("删除key=" + key);
|
||||||
cookie.setMaxAge(0);
|
cookie.setMaxAge(0);
|
||||||
cookie.setPath("/");
|
cookie.setPath("/");
|
||||||
cookie.setValue(null);
|
cookie.setValue(null);
|
||||||
@ -273,7 +273,7 @@ public class AppTools {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(srcFileName.equals("Activity.smali")){
|
if(srcFileName.equals("Activity.smali")){
|
||||||
System.out.println("文件夹已存在:"+destFileName);
|
com.yutou.bilibili.Tools.Log.i("文件夹已存在:"+destFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ public class ExcelUtils implements ApplicationContextAware {
|
|||||||
public static File getInstance(int roomId, Date startTime, Date endTime,String fileName) {
|
public static File getInstance(int roomId, Date startTime, Date endTime,String fileName) {
|
||||||
ExcelUtils utils = new ExcelUtils();
|
ExcelUtils utils = new ExcelUtils();
|
||||||
long timer=System.currentTimeMillis();
|
long timer=System.currentTimeMillis();
|
||||||
System.out.println("开始注入bean");
|
com.yutou.bilibili.Tools.Log.i("开始注入bean");
|
||||||
utils.dataDao = getBean(BilibiliLiveDataDao.class);
|
utils.dataDao = getBean(BilibiliLiveDataDao.class);
|
||||||
utils.infoDao = getBean(BilibiliLiveInfoDao.class);
|
utils.infoDao = getBean(BilibiliLiveInfoDao.class);
|
||||||
System.out.println("注入完毕:"+(System.currentTimeMillis()-timer));
|
com.yutou.bilibili.Tools.Log.i("注入完毕:"+(System.currentTimeMillis()-timer));
|
||||||
return utils.initTable(roomId, startTime, endTime,fileName);
|
return utils.initTable(roomId, startTime, endTime,fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ public class ExcelUtils implements ApplicationContextAware {
|
|||||||
|
|
||||||
private File initTable(int roomId, Date startTime, Date endTime,String fileName) {
|
private File initTable(int roomId, Date startTime, Date endTime,String fileName) {
|
||||||
long timer=System.currentTimeMillis();
|
long timer=System.currentTimeMillis();
|
||||||
System.out.println("进入统计:"+timer);
|
com.yutou.bilibili.Tools.Log.i("进入统计:"+timer);
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
Sheet liveData = workbook.createSheet("直播数据");
|
Sheet liveData = workbook.createSheet("直播数据");
|
||||||
Sheet liveInfo = workbook.createSheet("小时统计");
|
Sheet liveInfo = workbook.createSheet("小时统计");
|
||||||
@ -66,7 +66,7 @@ public class ExcelUtils implements ApplicationContextAware {
|
|||||||
createCell(infoRow.createCell(5), "送礼人数");
|
createCell(infoRow.createCell(5), "送礼人数");
|
||||||
createCell(infoRow.createCell(6), "记录时间");
|
createCell(infoRow.createCell(6), "记录时间");
|
||||||
|
|
||||||
System.out.println("表头插入完毕:"+(System.currentTimeMillis()-timer));
|
com.yutou.bilibili.Tools.Log.i("表头插入完毕:"+(System.currentTimeMillis()-timer));
|
||||||
List<BilibiliLiveData> dataList = dataDao.queryLiveData(roomId, startTime, endTime, new String[]{
|
List<BilibiliLiveData> dataList = dataDao.queryLiveData(roomId, startTime, endTime, new String[]{
|
||||||
INTERACT_WORD,
|
INTERACT_WORD,
|
||||||
ENTRY_EFFECT,
|
ENTRY_EFFECT,
|
||||||
@ -104,7 +104,7 @@ public class ExcelUtils implements ApplicationContextAware {
|
|||||||
createCell(infoRow.createCell(5), info.getGiftuser());
|
createCell(infoRow.createCell(5), info.getGiftuser());
|
||||||
createCell(infoRow.createCell(6), AppTools.getToDayTimeToString(info.getSubtime()));
|
createCell(infoRow.createCell(6), AppTools.getToDayTimeToString(info.getSubtime()));
|
||||||
}
|
}
|
||||||
System.out.println("数据填充完毕:"+(System.currentTimeMillis()-timer));
|
com.yutou.bilibili.Tools.Log.i("数据填充完毕:"+(System.currentTimeMillis()-timer));
|
||||||
try {
|
try {
|
||||||
if(!new File("excel").exists()){
|
if(!new File("excel").exists()){
|
||||||
new File("excel").mkdirs();
|
new File("excel").mkdirs();
|
||||||
@ -113,7 +113,7 @@ public class ExcelUtils implements ApplicationContextAware {
|
|||||||
FileOutputStream fileOutputStream = new FileOutputStream(file);
|
FileOutputStream fileOutputStream = new FileOutputStream(file);
|
||||||
workbook.write(fileOutputStream);
|
workbook.write(fileOutputStream);
|
||||||
workbook.close();
|
workbook.close();
|
||||||
System.out.println("文件写入完毕:"+(System.currentTimeMillis()-timer));
|
com.yutou.bilibili.Tools.Log.i("文件写入完毕:"+(System.currentTimeMillis()-timer));
|
||||||
file.renameTo(new File("excel"+File.separator+fileName));
|
file.renameTo(new File("excel"+File.separator+fileName));
|
||||||
return file;
|
return file;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -39,7 +39,7 @@ public class FFmpegUtils {
|
|||||||
ffmpeg,
|
ffmpeg,
|
||||||
file.getAbsolutePath(),
|
file.getAbsolutePath(),
|
||||||
out.getAbsolutePath() + File.separator + file.getName());
|
out.getAbsolutePath() + File.separator + file.getName());
|
||||||
System.out.println(exec);
|
com.yutou.bilibili.Tools.Log.i(exec);
|
||||||
Process process = Runtime.getRuntime().exec(new String[]{
|
Process process = Runtime.getRuntime().exec(new String[]{
|
||||||
"cmd",
|
"cmd",
|
||||||
"/c",
|
"/c",
|
||||||
@ -67,13 +67,13 @@ public class FFmpegUtils {
|
|||||||
int i = -1;
|
int i = -1;
|
||||||
while (i != 1) {
|
while (i != 1) {
|
||||||
i = add("D:\\ffmpeg-4.3.1-2020-11-19-full_build\\bin\\ffmpeg.exe", file.getAbsoluteFile(), new File("ffmpeg_out"));
|
i = add("D:\\ffmpeg-4.3.1-2020-11-19-full_build\\bin\\ffmpeg.exe", file.getAbsoluteFile(), new File("ffmpeg_out"));
|
||||||
System.out.println(i);
|
com.yutou.bilibili.Tools.Log.i(i);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("转码完成");
|
com.yutou.bilibili.Tools.Log.i("转码完成");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class HttpTools {
|
|||||||
str.append(tmp);
|
str.append(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println( "[" + url + "?" + new String(body,StandardCharsets.UTF_8) + "]body:" + str + " (" + connection.getResponseCode() + ")");
|
// com.yutou.bilibili.Tools.Log.i( "[" + url + "?" + new String(body,StandardCharsets.UTF_8) + "]body:" + str + " (" + connection.getResponseCode() + ")");
|
||||||
if (networkInterface != null) {
|
if (networkInterface != null) {
|
||||||
try {
|
try {
|
||||||
networkInterface.httpGetData(str.toString(), connection.getResponseCode());
|
networkInterface.httpGetData(str.toString(), connection.getResponseCode());
|
||||||
@ -130,7 +130,7 @@ public class HttpTools {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}*/
|
}*/
|
||||||
System.out.println(url);
|
com.yutou.bilibili.Tools.Log.i(url);
|
||||||
//String str=get(url);
|
//String str=get(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
src/main/java/com/yutou/bilibili/Tools/Log.java
Normal file
11
src/main/java/com/yutou/bilibili/Tools/Log.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.yutou.bilibili.Tools;
|
||||||
|
|
||||||
|
public class Log {
|
||||||
|
public static void i(Object log){
|
||||||
|
System.out.printf("[%s]%s%n",
|
||||||
|
AppTools.getToDayNowTimeToString(),
|
||||||
|
log
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -37,7 +37,7 @@ public class ServiceTools implements ApplicationContextAware {
|
|||||||
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("无权限请求:" + tmp);
|
com.yutou.bilibili.Tools.Log.i("无权限请求:" + tmp);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
JSONArray powers = JSONArray.parseArray(user.getPower());
|
JSONArray powers = JSONArray.parseArray(user.getPower());
|
||||||
|
@ -46,7 +46,7 @@ public class TestMain {
|
|||||||
}
|
}
|
||||||
String str = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);*/
|
String str = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);*/
|
||||||
|
|
||||||
System.out.println("["+AppTools.getToDayNowTimeToString()+"]"+hearBeat);
|
com.yutou.bilibili.Tools.Log.i("["+AppTools.getToDayNowTimeToString()+"]"+hearBeat);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ public class BiliBiliLiveDatabasesManager extends SQLiteManager {
|
|||||||
+ ", " + (upData.isEnable() ? 1 : 0)
|
+ ", " + (upData.isEnable() ? 1 : 0)
|
||||||
+ ", " + (upData.isSaveDanmu() ? 1 : 0) +
|
+ ", " + (upData.isSaveDanmu() ? 1 : 0) +
|
||||||
");";
|
");";
|
||||||
System.out.println(sql);
|
com.yutou.bilibili.Tools.Log.i(sql);
|
||||||
statement.execute(sql);
|
statement.execute(sql);
|
||||||
statement.closeOnCompletion();
|
statement.closeOnCompletion();
|
||||||
return true;
|
return true;
|
||||||
@ -257,7 +257,7 @@ public class BiliBiliLiveDatabasesManager extends SQLiteManager {
|
|||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println(sql);
|
com.yutou.bilibili.Tools.Log.i(sql);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class SQLiteManager {
|
|||||||
startBatch();
|
startBatch();
|
||||||
JSONArray array=json.getJSONArray("table");
|
JSONArray array=json.getJSONArray("table");
|
||||||
for (Object o : array) {
|
for (Object o : array) {
|
||||||
System.out.println("创建表:"+((JSONObject)o).getString("name"));
|
com.yutou.bilibili.Tools.Log.i("创建表:"+((JSONObject)o).getString("name"));
|
||||||
createSqlOfTable((JSONObject) o);
|
createSqlOfTable((JSONObject) o);
|
||||||
}
|
}
|
||||||
closeBatch();
|
closeBatch();
|
||||||
|
Loading…
Reference in New Issue
Block a user