分片数优化

This commit is contained in:
lushunming 2025-07-15 14:57:41 +08:00
parent bbf477acb5
commit 976a5b441f
5 changed files with 7 additions and 6 deletions

View File

@ -18,7 +18,7 @@ import java.util.Vector
import kotlin.math.min import kotlin.math.min
object DownloadMT { object DownloadMT {
private val THREAD_NUM: Int = 64 private var THREAD_NUM: Int = Runtime.getRuntime().availableProcessors() * 2
private val infos = mutableMapOf<String, Array<Any>>(); private val infos = mutableMapOf<String, Array<Any>>();
@ -157,8 +157,9 @@ object DownloadMT {
val totalSize = total.toLong() val totalSize = total.toLong()
//超过10GB分块是80MB不然是16MB //超过10GB分块是80MB不然是16MB
val partSize = val partSize =
if (totalSize > 8L * 1024L * 1024L * 1024L * 10L) 1024 * 1024 * 8 * 10L else 1024 * 1024 * 8 * 2L if (totalSize > 1024L * 1024L * 1024L * 10L) 1024 * 1024 * 8 * 10L else 1024 * 1024 * 8 * 2L
THREAD_NUM=
if (totalSize > 1024L * 1024L * 1024L * 10L) 64 else THREAD_NUM
var start = rangeObj["start"]!!.toLong() var start = rangeObj["start"]!!.toLong()
var end = var end =
if (StringUtils.isAllBlank(rangeObj["end"])) start + partSize else rangeObj["end"]!!.toLong() if (StringUtils.isAllBlank(rangeObj["end"])) start + partSize else rangeObj["end"]!!.toLong()

Binary file not shown.

View File

@ -1 +1 @@
ee0cb4c956adb3087217062681ce67a0 1810f7f08ca50f55c2cffb49a2a1678d

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;ee0cb4c956adb3087217062681ce67a0", "spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;1810f7f08ca50f55c2cffb49a2a1678d",
"lives": [ "lives": [
{ {
"name": "电视直播", "name": "电视直播",

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;ee0cb4c956adb3087217062681ce67a0", "spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;1810f7f08ca50f55c2cffb49a2a1678d",
"lives": [ "lives": [
{ {
"name": "电视直播", "name": "电视直播",