This commit is contained in:
kunfei 2022-09-20 23:44:05 +08:00
parent 294f23ee70
commit ccc376bd5e
2 changed files with 11 additions and 11 deletions

View File

@ -139,7 +139,6 @@ object AppWebDav {
authorization?.let {
val webDav = WebDav(rootWebDavUrl + name, it)
webDav.downloadTo(zipFilePath, true)
@Suppress("BlockingMethodInNonBlockingContext")
ZipUtils.unzipFile(zipFilePath, Backup.backupPath)
Restore.restoreDatabase()
Restore.restoreConfig()

View File

@ -138,12 +138,12 @@ object BookHelp {
try {
var bytes = analyzeUrl.getByteArrayAwait()
//某些图片被加密,需要进一步解密
bookSource?.getContentRule()?.imageDecode?.let {
if (it.isBlank()) {
bookSource?.getContentRule()?.imageDecode?.let { imageDecode ->
if (imageDecode.isBlank()) {
return@let
}
kotlin.runCatching {
bookSource.evalJS(it) {
bookSource.evalJS(imageDecode) {
put("book", book)
put("result", bytes)
put("src", src)
@ -155,11 +155,11 @@ object BookHelp {
}
}
FileUtils.createFileIfNotExist(
downloadDir,
cacheFolderName,
book.getFolderName(),
cacheImageFolderName,
"${MD5Utils.md5Encode16(src)}.${getImageSuffix(src)}"
downloadDir,
cacheFolderName,
book.getFolderName(),
cacheImageFolderName,
"${MD5Utils.md5Encode16(src)}.${getImageSuffix(src)}"
).writeBytes(bytes)
} catch (e: Exception) {
AppLog.putDebug("${src}下载错误", e)
@ -323,7 +323,7 @@ object BookHelp {
newChapterList: List<BookChapter>,
oldChapterListSize: Int = 0
): Int {
if (oldDurChapterIndex == 0) return oldDurChapterIndex
if (oldDurChapterIndex == 0) return 0
if (newChapterList.isEmpty()) return oldDurChapterIndex
val oldChapterNum = getChapterNum(oldDurChapterName)
val oldName = getPureChapterName(oldDurChapterName)
@ -370,6 +370,7 @@ object BookHelp {
Pattern.compile(".*?第([\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)[章节篇回集话]")
}
@Suppress("RegExpSimplifiable")
private val chapterNamePattern2 by lazy {
Pattern.compile("^(?:[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+[,:、])*([\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)(?:[,:、]|\\.[^\\d])")
}
@ -397,7 +398,7 @@ object BookHelp {
return@lazy "[^\\w\\u4E00-\\u9FEF\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex()
}
@Suppress("RegExpUnnecessaryNonCapturingGroup")
@Suppress("RegExpUnnecessaryNonCapturingGroup", "RegExpSimplifiable")
private val regexB by lazy {
//章节序号,排除处于结尾的状况,避免将章节名替换为空字串
return@lazy "^.*?第(?:[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)[章节篇回集话](?!$)|^(?:[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+[,:、])*(?:[\\d零一二两三四五六七八九十百千万壹贰叁肆伍陆柒捌玖拾佰仟]+)(?:[,:、](?!$)|\\.(?=[^\\d]))".toRegex()