From 3f723c88d3e992442a23749e50f19b7a9bb6e05d Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Mon, 7 Feb 2022 22:05:02 +0800 Subject: [PATCH] =?UTF-8?q?LocalBook.kt:analyzeNameAuthor=20=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E9=98=85=E8=AF=BB=E9=BB=98=E8=AE=A4=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8D;=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/model/localBook/LocalBook.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index 87ef1950e..5b1027594 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -128,9 +128,9 @@ object LocalBook { val m1 = Pattern .compile("(.*?)《([^《》]+)》(.*)") .matcher(tempFileName) - //匹配 书名 by 作者名.txt + //匹配 书名 作者:作者名.txt val m2 = Pattern - .compile("(^)(.+) by (.+)$") + .compile("(^)(.+) 作者:(.+)$") .matcher(tempFileName) (m1.takeIf { m1.find() } ?: m2.takeIf { m2.find() }).run { @@ -152,13 +152,13 @@ object LocalBook { name = bookMess["name"] ?: tempFileName author = bookMess["author"]?.takeIf { it.length != tempFileName.length } ?: "" } catch (e: Exception) { - name = tempFileName.replace(AppPattern.nameRegex, "") - author = tempFileName.replace(AppPattern.authorRegex, "") + name = BookHelp.formatBookName(tempFileName) + author = BookHelp.formatBookAuthor(tempFileName.replace(name, "")) .takeIf { it.length != tempFileName.length } ?: "" } } else { - name = tempFileName.replace(AppPattern.nameRegex, "") - author = tempFileName.replace(AppPattern.authorRegex, "") + name = BookHelp.formatBookName(tempFileName) + author = BookHelp.formatBookAuthor(tempFileName.replace(name, "")) .takeIf { it.length != tempFileName.length } ?: "" }