@@ -22,4 +22,4 @@
|
|||||||
* 置底所选
|
* 置底所选
|
||||||
* 导出所选
|
* 导出所选
|
||||||
* 校验所选
|
* 校验所选
|
||||||
* 校验失败的书源分组会加上"失效",选择"失效"分组即可批量操作
|
* "校验成功"是指所选的校验项目全部通过,"失败:发现为空"不视为"失效",校验结束后会自动筛选"失效"书源
|
||||||
@@ -18,4 +18,3 @@
|
|||||||
* 置顶所选
|
* 置顶所选
|
||||||
* 置底所选
|
* 置底所选
|
||||||
* 导出所选
|
* 导出所选
|
||||||
* 校验失败的书源分组会加上"失效",选择"失效"分组即可批量操作
|
|
||||||
@@ -11,6 +11,12 @@
|
|||||||
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
|
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
|
||||||
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
|
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
|
||||||
|
|
||||||
|
**2022/02/07**
|
||||||
|
|
||||||
|
* 校验失效分组具体到搜索发现目录正文
|
||||||
|
* txt文件初次解析目录不选择禁用的正则
|
||||||
|
* txt单章字数超102400均分txt
|
||||||
|
|
||||||
**2022/02/03**
|
**2022/02/03**
|
||||||
|
|
||||||
* 字符串大于1024时禁用代码高亮
|
* 字符串大于1024时禁用代码高亮
|
||||||
|
|||||||
@@ -81,6 +81,12 @@ data class BookChapter(
|
|||||||
): String {
|
): String {
|
||||||
var displayTitle = title.replace(AppPattern.rnRegex, "")
|
var displayTitle = title.replace(AppPattern.rnRegex, "")
|
||||||
val mDisplayTitle = displayTitle
|
val mDisplayTitle = displayTitle
|
||||||
|
if (chineseConvert) {
|
||||||
|
when (AppConfig.chineseConverterType) {
|
||||||
|
1 -> displayTitle = ChineseUtils.t2s(displayTitle)
|
||||||
|
2 -> displayTitle = ChineseUtils.s2t(displayTitle)
|
||||||
|
}
|
||||||
|
}
|
||||||
if (useReplace && replaceRules != null) {
|
if (useReplace && replaceRules != null) {
|
||||||
replaceRules.forEach { item ->
|
replaceRules.forEach { item ->
|
||||||
if (item.pattern.isNotEmpty()) {
|
if (item.pattern.isNotEmpty()) {
|
||||||
@@ -97,12 +103,6 @@ data class BookChapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (displayTitle.isBlank()) displayTitle = mDisplayTitle
|
if (displayTitle.isBlank()) displayTitle = mDisplayTitle
|
||||||
if (chineseConvert) {
|
|
||||||
when (AppConfig.chineseConverterType) {
|
|
||||||
1 -> displayTitle = ChineseUtils.t2s(displayTitle)
|
|
||||||
2 -> displayTitle = ChineseUtils.s2t(displayTitle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return when {
|
return when {
|
||||||
!isVip -> displayTitle
|
!isVip -> displayTitle
|
||||||
isPay -> appCtx.getString(R.string.payed_title, displayTitle)
|
isPay -> appCtx.getString(R.string.payed_title, displayTitle)
|
||||||
|
|||||||
@@ -77,10 +77,6 @@ class ContentProcessor private constructor(
|
|||||||
//重新分段
|
//重新分段
|
||||||
mContent = ContentHelp.reSegment(mContent, chapter.title)
|
mContent = ContentHelp.reSegment(mContent, chapter.title)
|
||||||
}
|
}
|
||||||
if (useReplace && book.getUseReplaceRule()) {
|
|
||||||
//替换
|
|
||||||
mContent = replaceContent(mContent)
|
|
||||||
}
|
|
||||||
if (chineseConvert) {
|
if (chineseConvert) {
|
||||||
//简繁转换
|
//简繁转换
|
||||||
try {
|
try {
|
||||||
@@ -92,6 +88,10 @@ class ContentProcessor private constructor(
|
|||||||
appCtx.toastOnUi("简繁转换出错")
|
appCtx.toastOnUi("简繁转换出错")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (useReplace && book.getUseReplaceRule()) {
|
||||||
|
//替换
|
||||||
|
mContent = replaceContent(mContent)
|
||||||
|
}
|
||||||
if (includeTitle) {
|
if (includeTitle) {
|
||||||
//重新添加标题
|
//重新添加标题
|
||||||
mContent = chapter.getDisplayTitle(getReplaceRules()) + "\n" + mContent
|
mContent = chapter.getDisplayTitle(getReplaceRules()) + "\n" + mContent
|
||||||
|
|||||||
@@ -95,10 +95,9 @@ object Debug {
|
|||||||
fun updateFinalMessage(sourceUrl: String, state: String) {
|
fun updateFinalMessage(sourceUrl: String, state: String) {
|
||||||
if (debugTimeMap[sourceUrl] != null && debugMessageMap[sourceUrl] != null) {
|
if (debugTimeMap[sourceUrl] != null && debugMessageMap[sourceUrl] != null) {
|
||||||
val spendingTime = System.currentTimeMillis() - debugTimeMap[sourceUrl]!!
|
val spendingTime = System.currentTimeMillis() - debugTimeMap[sourceUrl]!!
|
||||||
debugTimeMap[sourceUrl] = if (state == "成功") spendingTime else 180000L
|
debugTimeMap[sourceUrl] = if (state == "校验成功") spendingTime else 180000L
|
||||||
val printTime = debugTimeFormat.format(Date(spendingTime))
|
val printTime = debugTimeFormat.format(Date(spendingTime))
|
||||||
val originalMessage = debugMessageMap[sourceUrl]!!.substringAfter("] ")
|
debugMessageMap[sourceUrl] = "$printTime $state"
|
||||||
debugMessageMap[sourceUrl] = "$printTime $originalMessage $state"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ class TextFile(private val book: Book) {
|
|||||||
|
|
||||||
//没有标题的时候,每个章节的最大长度
|
//没有标题的时候,每个章节的最大长度
|
||||||
private val maxLengthWithNoToc = 10 * 1024
|
private val maxLengthWithNoToc = 10 * 1024
|
||||||
|
//使用正则划分目录,每个章节的最大允许长度
|
||||||
|
private val maxLengthWithToc = 102400
|
||||||
|
|
||||||
private val tocRules = arrayListOf<Pattern>()
|
private val tocRules = arrayListOf<Pattern>()
|
||||||
private var charset: Charset = book.fileCharset()
|
private var charset: Charset = book.fileCharset()
|
||||||
@@ -126,7 +128,7 @@ class TextFile(private val book: Book) {
|
|||||||
val chapterContent = blockContent.substring(seekPos, chapterStart)
|
val chapterContent = blockContent.substring(seekPos, chapterStart)
|
||||||
val chapterLength = chapterContent.toByteArray(charset).size
|
val chapterLength = chapterContent.toByteArray(charset).size
|
||||||
val lastStart = toc.lastOrNull()?.start ?: curOffset
|
val lastStart = toc.lastOrNull()?.start ?: curOffset
|
||||||
if (curOffset + chapterLength - lastStart > 102400) {
|
if (curOffset + chapterLength - lastStart > maxLengthWithToc) {
|
||||||
bis.close()
|
bis.close()
|
||||||
return analyze()
|
return analyze()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import io.legado.app.help.coroutine.CompositeCoroutine
|
|||||||
import io.legado.app.model.CheckSource
|
import io.legado.app.model.CheckSource
|
||||||
import io.legado.app.model.Debug
|
import io.legado.app.model.Debug
|
||||||
import io.legado.app.model.NoStackTraceException
|
import io.legado.app.model.NoStackTraceException
|
||||||
|
import io.legado.app.model.ContentEmptyException
|
||||||
|
import io.legado.app.model.TocEmptyException
|
||||||
import io.legado.app.model.webBook.WebBook
|
import io.legado.app.model.webBook.WebBook
|
||||||
import io.legado.app.ui.book.source.manage.BookSourceActivity
|
import io.legado.app.ui.book.source.manage.BookSourceActivity
|
||||||
import io.legado.app.utils.activityPendingIntent
|
import io.legado.app.utils.activityPendingIntent
|
||||||
@@ -121,6 +123,11 @@ class CheckSourceService : BaseService() {
|
|||||||
searchWord = it
|
searchWord = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
source.bookSourceComment = source.bookSourceComment
|
||||||
|
?.split("\n\n")
|
||||||
|
?.filterNot {
|
||||||
|
it.startsWith("Error: ")
|
||||||
|
}?.joinToString("\n")
|
||||||
//校验搜索 用户设置校验搜索 并且 搜索链接不为空
|
//校验搜索 用户设置校验搜索 并且 搜索链接不为空
|
||||||
if (CheckSource.checkSearch && !source.searchUrl.isNullOrBlank()) {
|
if (CheckSource.checkSearch && !source.searchUrl.isNullOrBlank()) {
|
||||||
val searchBooks = WebBook.searchBookAwait(this, source, searchWord)
|
val searchBooks = WebBook.searchBookAwait(this, source, searchWord)
|
||||||
@@ -173,9 +180,10 @@ class CheckSourceService : BaseService() {
|
|||||||
if (CheckSource.checkCategory) {
|
if (CheckSource.checkCategory) {
|
||||||
val toc = WebBook.getChapterListAwait(this, source, book)
|
val toc = WebBook.getChapterListAwait(this, source, book)
|
||||||
val nextChapterUrl = toc.getOrNull(1)?.url ?: toc.first().url
|
val nextChapterUrl = toc.getOrNull(1)?.url ?: toc.first().url
|
||||||
|
source.removeGroup("目录失效")
|
||||||
//校验正文
|
//校验正文
|
||||||
if (CheckSource.checkContent) {
|
if (CheckSource.checkContent) {
|
||||||
val content = WebBook.getContentAwait(
|
WebBook.getContentAwait(
|
||||||
this,
|
this,
|
||||||
bookSource = source,
|
bookSource = source,
|
||||||
book = book,
|
book = book,
|
||||||
@@ -183,9 +191,7 @@ class CheckSourceService : BaseService() {
|
|||||||
nextChapterUrl = nextChapterUrl,
|
nextChapterUrl = nextChapterUrl,
|
||||||
needSave = false
|
needSave = false
|
||||||
)
|
)
|
||||||
if ( !toc.first().isVolume && content.isBlank()) {
|
source.removeGroup("正文失效")
|
||||||
throw NoStackTraceException("正文内容为空")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,20 +199,15 @@ class CheckSourceService : BaseService() {
|
|||||||
if (source.hasGroup("发现失效")) throw NoStackTraceException("发现失效")
|
if (source.hasGroup("发现失效")) throw NoStackTraceException("发现失效")
|
||||||
}.timeout(CheckSource.timeout)
|
}.timeout(CheckSource.timeout)
|
||||||
.onError(searchCoroutine) {
|
.onError(searchCoroutine) {
|
||||||
source.addGroup("失效")
|
when(it) {
|
||||||
if (source.bookSourceComment?.contains("Error: ") == false) {
|
is ContentEmptyException -> source.addGroup("正文失效")
|
||||||
|
is TocEmptyException -> source.addGroup("目录失效")
|
||||||
|
}
|
||||||
source.bookSourceComment =
|
source.bookSourceComment =
|
||||||
"Error: ${it.localizedMessage} \n\n" + "${source.bookSourceComment}"
|
"Error: ${it.localizedMessage} \n\n" + "${source.bookSourceComment}"
|
||||||
}
|
|
||||||
Debug.updateFinalMessage(source.bookSourceUrl, "失败:${it.localizedMessage}")
|
Debug.updateFinalMessage(source.bookSourceUrl, "失败:${it.localizedMessage}")
|
||||||
}.onSuccess(searchCoroutine) {
|
}.onSuccess(searchCoroutine) {
|
||||||
source.removeGroup("失效")
|
Debug.updateFinalMessage(source.bookSourceUrl, "校验成功")
|
||||||
source.bookSourceComment = source.bookSourceComment
|
|
||||||
?.split("\n\n")
|
|
||||||
?.filterNot {
|
|
||||||
it.startsWith("Error: ")
|
|
||||||
}?.joinToString("\n")
|
|
||||||
Debug.updateFinalMessage(source.bookSourceUrl, "成功")
|
|
||||||
}.onFinally(searchCoroutine) {
|
}.onFinally(searchCoroutine) {
|
||||||
source.respondTime = Debug.getRespondTime(source.bookSourceUrl)
|
source.respondTime = Debug.getRespondTime(source.bookSourceUrl)
|
||||||
appDb.bookSourceDao.update(source)
|
appDb.bookSourceDao.update(source)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) :
|
|||||||
var isFinalMessage =
|
var isFinalMessage =
|
||||||
ivDebugText.text.toString().contains(Regex("成功|失败"))
|
ivDebugText.text.toString().contains(Regex("成功|失败"))
|
||||||
if (!isEmpty && !Debug.isChecking && !isFinalMessage) {
|
if (!isEmpty && !Debug.isChecking && !isFinalMessage) {
|
||||||
Debug.updateFinalMessage(item.bookSourceUrl, "失败")
|
Debug.updateFinalMessage(item.bookSourceUrl, "校验失败")
|
||||||
ivDebugText.text = Debug.debugMessageMap[item.bookSourceUrl] ?: ""
|
ivDebugText.text = Debug.debugMessageMap[item.bookSourceUrl] ?: ""
|
||||||
isFinalMessage = true
|
isFinalMessage = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user