This commit is contained in:
Horis 2024-01-31 18:32:43 +08:00
parent ae1558c029
commit a0bcec6a15
2 changed files with 35 additions and 43 deletions

View File

@ -17,10 +17,8 @@ import io.legado.app.model.analyzeRule.AnalyzeRule
import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.isTrue
import io.legado.app.utils.mapAsync
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.withContext
import splitties.init.appCtx
import kotlin.coroutines.coroutineContext
@ -88,7 +86,6 @@ object BookChapterList {
bookSource.bookSourceUrl,
"◇并发解析目录,总页数:${chapterData.second.size}"
)
withContext(IO) {
flow {
for (urlStr in chapterData.second) {
emit(urlStr)
@ -109,7 +106,6 @@ object BookChapterList {
}
}
}
}
if (chapterList.isEmpty()) {
throw TocEmptyException(appCtx.getString(R.string.chapter_list_empty))
}

View File

@ -16,11 +16,9 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.utils.HtmlFormatter
import io.legado.app.utils.NetworkUtils
import io.legado.app.utils.mapAsync
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.withContext
import org.apache.commons.text.StringEscapeUtils
import splitties.init.appCtx
import kotlin.coroutines.coroutineContext
@ -107,7 +105,6 @@ object BookContent {
Debug.log(bookSource.bookSourceUrl, "◇本章总页数:${nextUrlList.size}")
} else if (contentData.second.size > 1) {
Debug.log(bookSource.bookSourceUrl, "◇并发解析正文,总页数:${contentData.second.size}")
withContext(IO) {
flow {
for (urlStr in contentData.second) {
emit(urlStr)
@ -130,7 +127,6 @@ object BookContent {
contentList.add(it)
}
}
}
var contentStr = contentList.joinToString("\n")
//全文替换
val replaceRegex = contentRule.replaceRegex