Przeglądaj źródła

Merge pull request #1515 from Xwite/master

fix:二级目录书源 正文不能通过书源检测
kunfei 4 lat temu
rodzic
commit
3b8ca9b0d3

+ 1 - 1
app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt

@@ -194,7 +194,7 @@ object BookChapterList {
                 if (bookChapter.url.isEmpty()) {
                 if (bookChapter.url.isEmpty()) {
                     if (bookChapter.isVolume) {
                     if (bookChapter.isVolume) {
                         bookChapter.url = bookChapter.title
                         bookChapter.url = bookChapter.title
-                        Debug.log(bookSource.bookSourceUrl, "目录${index}(Volume)未获取到url,使用章节标题替代")
+                        Debug.log(bookSource.bookSourceUrl, "一级目录${index}未获取到url,使用章节标题替代")
                     } else {
                     } else {
                         bookChapter.url = baseUrl
                         bookChapter.url = baseUrl
                         Debug.log(bookSource.bookSourceUrl, "目录${index}未获取到url,使用baseUrl替代")
                         Debug.log(bookSource.bookSourceUrl, "目录${index}未获取到url,使用baseUrl替代")

+ 5 - 2
app/src/main/java/io/legado/app/model/webBook/WebBook.kt

@@ -261,8 +261,11 @@ object WebBook {
             Debug.log(bookSource.bookSourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}")
             Debug.log(bookSource.bookSourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}")
             return bookChapter.url
             return bookChapter.url
         }
         }
-        //章节名为卷名时 且 章节url没获取到,返回空白
-        if(bookChapter.isVolume && bookChapter.url == bookChapter.title) return ""
+        if(bookChapter.isVolume && bookChapter.url == bookChapter.title) {
+            //不返回空值,是为了过书源检测
+            Debug.log(bookSource.bookSourceUrl, "⇒一级目录正文,使用章节标题:${bookChapter.title}")
+            return bookChapter.title
+        }
         return if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) {
         return if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) {
             BookContent.analyzeContent(
             BookContent.analyzeContent(
                 scope = scope,
                 scope = scope,

+ 2 - 2
app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt

@@ -332,7 +332,7 @@ object ChapterProvider {
                 }
                 }
                 lineIndex == layout.lineCount - 1 -> {
                 lineIndex == layout.lineCount - 1 -> {
                     //最后一行
                     //最后一行
-                    textLine.text = "$words\n"
+                    textLine.text = if(isVolumeTitle) "" else "$words\n"
                     isLastLine = true
                     isLastLine = true
                     //标题居中
                     //标题居中
                     val startX = if (isTitle && ReadBookConfig.titleMode == 1 || isVolumeTitle)
                     val startX = if (isTitle && ReadBookConfig.titleMode == 1 || isVolumeTitle)
@@ -349,7 +349,7 @@ object ChapterProvider {
                 }
                 }
                 else -> {
                 else -> {
                     //中间行
                     //中间行
-                    textLine.text = words
+                    textLine.text = if(isVolumeTitle) "" else words
                     addCharsToLineMiddle(
                     addCharsToLineMiddle(
                         absStartX,
                         absStartX,
                         textLine,
                         textLine,