139原画多线程优化
This commit is contained in:
parent
e29f61d9b6
commit
3662843f46
|
|
@ -301,13 +301,14 @@ public class YunDrive {
|
||||||
String contentId = split[0];
|
String contentId = split[0];
|
||||||
String linkID = split[1];
|
String linkID = split[1];
|
||||||
playUrl = YunDrive.get().get4kVideoInfo(contentId, linkID);
|
playUrl = YunDrive.get().get4kVideoInfo(contentId, linkID);
|
||||||
|
playUrl = ProxyVideo.buildCommonProxyUrl(playUrl, new HashMap<>());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String contentId = split[0];
|
String contentId = split[0];
|
||||||
String linkID = split[1];
|
String linkID = split[1];
|
||||||
playUrl = YunDrive.get().fetchPlayUrl(contentId, linkID);
|
playUrl = YunDrive.get().fetchPlayUrl(contentId, linkID);
|
||||||
}
|
}
|
||||||
return Result.get().url(ProxyVideo.buildCommonProxyUrl(playUrl, new HashMap<>())).octet().header(getHeader()).string();
|
return Result.get().url(playUrl).octet().header(getHeader()).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.github.catvod.utils;
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
import android.os.Debug;
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
|
@ -99,7 +98,7 @@ public class ProxyVideo {
|
||||||
|
|
||||||
public static Object[] proxyMultiThread(String url, Map<String, String> headers) {
|
public static Object[] proxyMultiThread(String url, Map<String, String> headers) {
|
||||||
ExecutorService service = Executors.newFixedThreadPool(THREAD_NUM);
|
ExecutorService service = Executors.newFixedThreadPool(THREAD_NUM);
|
||||||
SpiderDebug.log("--proxyMultiThread: THREAD_NUM "+THREAD_NUM);
|
SpiderDebug.log("--proxyMultiThread: THREAD_NUM " + THREAD_NUM);
|
||||||
|
|
||||||
SequenceInputStream in = null;
|
SequenceInputStream in = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -206,11 +205,14 @@ public class ProxyVideo {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<long[]> generatePart(Map<String, String> rangeObj, String total) {
|
private static List<long[]> generatePart(Map<String, String> rangeObj, String total) {
|
||||||
long start = Long.parseLong(rangeObj.get("start"));
|
|
||||||
long end = StringUtils.isAllBlank(rangeObj.get("end")) ? start + 1024 * 1024 * 8 : Long.parseLong(rangeObj.get("end"));
|
|
||||||
|
|
||||||
|
|
||||||
long totalSize = Long.parseLong(total);
|
long totalSize = Long.parseLong(total);
|
||||||
|
//超过10GB,分块是30Mb,不然是4MB
|
||||||
|
long partSize = totalSize > 8L * 1024L * 1024L * 1024L * 10L ? 1024 * 1024 * 8 * 30L : 1024 * 1024 * 8 * 4L;
|
||||||
|
|
||||||
|
long start = Long.parseLong(rangeObj.get("start"));
|
||||||
|
long end = StringUtils.isAllBlank(rangeObj.get("end")) ? start + partSize : Long.parseLong(rangeObj.get("end"));
|
||||||
|
|
||||||
|
|
||||||
end = Math.min(end, totalSize - 1);
|
end = Math.min(end, totalSize - 1);
|
||||||
long length = end - start + 1;
|
long length = end - start + 1;
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
167365a584618d820c96a12fac7909b5
|
eab498637837fc40d738fee62168b41a
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;167365a584618d820c96a12fac7909b5",
|
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;eab498637837fc40d738fee62168b41a",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "电视直播",
|
"name": "电视直播",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue