|
|
@ -2,7 +2,6 @@ package io.legado.app.model.webBook |
|
|
|
|
|
|
|
|
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.constant.AppPattern |
|
|
|
|
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.BookHelp |
|
|
@ -19,7 +18,8 @@ object BookInfo { |
|
|
|
book: Book, |
|
|
|
book: Book, |
|
|
|
body: String?, |
|
|
|
body: String?, |
|
|
|
bookSource: BookSource, |
|
|
|
bookSource: BookSource, |
|
|
|
baseUrl: String |
|
|
|
baseUrl: String, |
|
|
|
|
|
|
|
canReName: Boolean, |
|
|
|
) { |
|
|
|
) { |
|
|
|
body ?: throw Exception( |
|
|
|
body ?: throw Exception( |
|
|
|
App.INSTANCE.getString(R.string.error_get_web_content, baseUrl) |
|
|
|
App.INSTANCE.getString(R.string.error_get_web_content, baseUrl) |
|
|
@ -35,13 +35,17 @@ object BookInfo { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取书名") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取书名") |
|
|
|
BookHelp.formatBookName(analyzeRule.getString(infoRule.name)).trim { it <= ' ' }.let { |
|
|
|
BookHelp.formatBookName(analyzeRule.getString(infoRule.name)).let { |
|
|
|
if (it.isNotEmpty()) book.name = it |
|
|
|
if (it.isNotEmpty() && canReName) { |
|
|
|
|
|
|
|
book.name = it |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${book.name}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${book.name}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取作者") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取作者") |
|
|
|
BookHelp.formatBookAuthor(analyzeRule.getString(infoRule.author)).let { |
|
|
|
BookHelp.formatBookAuthor(analyzeRule.getString(infoRule.author)).let { |
|
|
|
if (it.isNotEmpty()) book.author = it.replace(AppPattern.authorRegex, "") |
|
|
|
if (it.isNotEmpty() && canReName) { |
|
|
|
|
|
|
|
book.author = it |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${book.author}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "└${book.author}") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取分类") |
|
|
|
Debug.log(bookSource.bookSourceUrl, "┌获取分类") |
|
|
|