|
|
@ -15,7 +15,6 @@ import org.apache.commons.text.similarity.JaccardSimilarity |
|
|
|
import splitties.init.appCtx |
|
|
|
import splitties.init.appCtx |
|
|
|
import java.io.File |
|
|
|
import java.io.File |
|
|
|
import java.util.concurrent.CopyOnWriteArraySet |
|
|
|
import java.util.concurrent.CopyOnWriteArraySet |
|
|
|
import java.util.regex.Matcher |
|
|
|
|
|
|
|
import java.util.regex.Pattern |
|
|
|
import java.util.regex.Pattern |
|
|
|
import kotlin.math.abs |
|
|
|
import kotlin.math.abs |
|
|
|
import kotlin.math.max |
|
|
|
import kotlin.math.max |
|
|
@ -56,7 +55,7 @@ object BookHelp { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getEpubFile(book: Book,): File { |
|
|
|
fun getEpubFile(book: Book): File { |
|
|
|
val file = FileUtils.getFile( |
|
|
|
val file = FileUtils.getFile( |
|
|
|
downloadDir, |
|
|
|
downloadDir, |
|
|
|
cacheFolderName, |
|
|
|
cacheFolderName, |
|
|
@ -341,11 +340,11 @@ object BookHelp { |
|
|
|
|
|
|
|
|
|
|
|
private fun getChapterNum(chapterName: String?): Int { |
|
|
|
private fun getChapterNum(chapterName: String?): Int { |
|
|
|
chapterName ?: return -1 |
|
|
|
chapterName ?: return -1 |
|
|
|
chapterName = StringUtils.fullToHalf(chapterName).replace(regexA, "") |
|
|
|
val chapterName1 = StringUtils.fullToHalf(chapterName).replace(regexA, "") |
|
|
|
return StringUtils.stringToInt( |
|
|
|
return StringUtils.stringToInt( |
|
|
|
( |
|
|
|
( |
|
|
|
chapterNamePattern1.matcher(chapterName).takeIf{it.find()} |
|
|
|
chapterNamePattern1.matcher(chapterName1).takeIf { it.find() } |
|
|
|
?:chapterNamePattern2.matcher(chapterName).takeIf{it.find()} |
|
|
|
?: chapterNamePattern2.matcher(chapterName1).takeIf { it.find() } |
|
|
|
)?.group(1) |
|
|
|
)?.group(1) |
|
|
|
?:"-1" |
|
|
|
?:"-1" |
|
|
|
) |
|
|
|
) |
|
|
@ -354,6 +353,7 @@ object BookHelp { |
|
|
|
@Suppress("SpellCheckingInspection") |
|
|
|
@Suppress("SpellCheckingInspection") |
|
|
|
private val regexOther by lazy { |
|
|
|
private val regexOther by lazy { |
|
|
|
// 所有非字母数字中日韩文字 CJK区+扩展A-F区 |
|
|
|
// 所有非字母数字中日韩文字 CJK区+扩展A-F区 |
|
|
|
|
|
|
|
@Suppress("RegExpDuplicateCharacterInClass") |
|
|
|
return@lazy "[^\\w\\u4E00-\\u9FEF〇\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex() |
|
|
|
return@lazy "[^\\w\\u4E00-\\u9FEF〇\\u3400-\\u4DBF\\u20000-\\u2A6DF\\u2A700-\\u2EBEF]".toRegex() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|