mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
ae1558c029
commit
a0bcec6a15
@ -17,10 +17,8 @@ import io.legado.app.model.analyzeRule.AnalyzeRule
|
|||||||
import io.legado.app.model.analyzeRule.AnalyzeUrl
|
import io.legado.app.model.analyzeRule.AnalyzeUrl
|
||||||
import io.legado.app.utils.isTrue
|
import io.legado.app.utils.isTrue
|
||||||
import io.legado.app.utils.mapAsync
|
import io.legado.app.utils.mapAsync
|
||||||
import kotlinx.coroutines.Dispatchers.IO
|
|
||||||
import kotlinx.coroutines.ensureActive
|
import kotlinx.coroutines.ensureActive
|
||||||
import kotlinx.coroutines.flow.flow
|
import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import kotlin.coroutines.coroutineContext
|
import kotlin.coroutines.coroutineContext
|
||||||
|
|
||||||
@ -88,7 +86,6 @@ object BookChapterList {
|
|||||||
bookSource.bookSourceUrl,
|
bookSource.bookSourceUrl,
|
||||||
"◇并发解析目录,总页数:${chapterData.second.size}"
|
"◇并发解析目录,总页数:${chapterData.second.size}"
|
||||||
)
|
)
|
||||||
withContext(IO) {
|
|
||||||
flow {
|
flow {
|
||||||
for (urlStr in chapterData.second) {
|
for (urlStr in chapterData.second) {
|
||||||
emit(urlStr)
|
emit(urlStr)
|
||||||
@ -109,7 +106,6 @@ object BookChapterList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (chapterList.isEmpty()) {
|
if (chapterList.isEmpty()) {
|
||||||
throw TocEmptyException(appCtx.getString(R.string.chapter_list_empty))
|
throw TocEmptyException(appCtx.getString(R.string.chapter_list_empty))
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,9 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
|
|||||||
import io.legado.app.utils.HtmlFormatter
|
import io.legado.app.utils.HtmlFormatter
|
||||||
import io.legado.app.utils.NetworkUtils
|
import io.legado.app.utils.NetworkUtils
|
||||||
import io.legado.app.utils.mapAsync
|
import io.legado.app.utils.mapAsync
|
||||||
import kotlinx.coroutines.Dispatchers.IO
|
|
||||||
import kotlinx.coroutines.currentCoroutineContext
|
import kotlinx.coroutines.currentCoroutineContext
|
||||||
import kotlinx.coroutines.ensureActive
|
import kotlinx.coroutines.ensureActive
|
||||||
import kotlinx.coroutines.flow.flow
|
import kotlinx.coroutines.flow.flow
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import org.apache.commons.text.StringEscapeUtils
|
import org.apache.commons.text.StringEscapeUtils
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import kotlin.coroutines.coroutineContext
|
import kotlin.coroutines.coroutineContext
|
||||||
@ -107,7 +105,6 @@ object BookContent {
|
|||||||
Debug.log(bookSource.bookSourceUrl, "◇本章总页数:${nextUrlList.size}")
|
Debug.log(bookSource.bookSourceUrl, "◇本章总页数:${nextUrlList.size}")
|
||||||
} else if (contentData.second.size > 1) {
|
} else if (contentData.second.size > 1) {
|
||||||
Debug.log(bookSource.bookSourceUrl, "◇并发解析正文,总页数:${contentData.second.size}")
|
Debug.log(bookSource.bookSourceUrl, "◇并发解析正文,总页数:${contentData.second.size}")
|
||||||
withContext(IO) {
|
|
||||||
flow {
|
flow {
|
||||||
for (urlStr in contentData.second) {
|
for (urlStr in contentData.second) {
|
||||||
emit(urlStr)
|
emit(urlStr)
|
||||||
@ -130,7 +127,6 @@ object BookContent {
|
|||||||
contentList.add(it)
|
contentList.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
var contentStr = contentList.joinToString("\n")
|
var contentStr = contentList.joinToString("\n")
|
||||||
//全文替换
|
//全文替换
|
||||||
val replaceRegex = contentRule.replaceRegex
|
val replaceRegex = contentRule.replaceRegex
|
||||||
|
Loading…
Reference in New Issue
Block a user