feat: 优化代码

pull/120/head
kunfei 5 years ago
parent 310d89d23a
commit ea3db51478
  1. 9
      app/src/main/java/io/legado/app/model/WebBook.kt

@ -86,7 +86,8 @@ class WebBook(val bookSource: BookSource) {
): Coroutine<Book> { ): Coroutine<Book> {
book.type = bookSource.bookSourceType book.type = bookSource.bookSourceType
return Coroutine.async(scope, context) { return Coroutine.async(scope, context) {
val body = if (!book.infoHtml.isNullOrEmpty()) { val body =
if (!book.infoHtml.isNullOrEmpty()) {
book.infoHtml book.infoHtml
} else { } else {
val analyzeUrl = AnalyzeUrl( val analyzeUrl = AnalyzeUrl(
@ -112,7 +113,8 @@ class WebBook(val bookSource: BookSource) {
): Coroutine<List<BookChapter>> { ): Coroutine<List<BookChapter>> {
book.type = bookSource.bookSourceType book.type = bookSource.bookSourceType
return Coroutine.async(scope, context) { return Coroutine.async(scope, context) {
val body = if (book.bookUrl == book.tocUrl && !book.tocHtml.isNullOrEmpty()) { val body =
if (book.bookUrl == book.tocUrl && !book.tocHtml.isNullOrEmpty()) {
book.tocHtml book.tocHtml
} else { } else {
AnalyzeUrl( AnalyzeUrl(
@ -141,7 +143,8 @@ class WebBook(val bookSource: BookSource) {
Debug.log(sourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}") Debug.log(sourceUrl, "⇒正文规则为空,使用章节链接:${bookChapter.url}")
return@async bookChapter.url return@async bookChapter.url
} }
val body = if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) { val body =
if (bookChapter.url == book.bookUrl && !book.tocHtml.isNullOrEmpty()) {
book.tocHtml book.tocHtml
} else { } else {
val analyzeUrl = val analyzeUrl =

Loading…
Cancel
Save