pull/2026/head
kunfei 2 years ago
parent 124f8867ae
commit ccdcd7c2f3
  1. 35
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -684,27 +684,6 @@ class AnalyzeRule(
return s
}
/**
* 更新BookUrl,如果搜索结果有tocUrl也会更新,有些书源bookUrl定期更新,可以在js内调用更新
*/
fun refreshBookUrl() {
runBlocking {
val bookSource = source as? BookSource
val book = book as? Book
if (bookSource == null || book == null) return@runBlocking
val books = WebBook.searchBookAwait(this, bookSource, book.name)
books.forEach {
if (it.name == book.name && it.author == book.author) {
book.bookUrl = it.bookUrl
if (it.tocUrl.isNotBlank()) {
book.tocUrl = it.tocUrl
}
return@runBlocking
}
}
}
}
/**
* 重新获取book
*/
@ -726,6 +705,20 @@ class AnalyzeRule(
}
}
/**
* 刷新详情页
*/
fun refreshBook() {
val bookSource = source as? BookSource
val book = book as? Book
if (bookSource == null || book == null) return
runBlocking {
withTimeout(1800000) {
WebBook.getBookInfoAwait(this, bookSource, book)
}
}
}
/**
* 更新tocUrl,有些书源目录url定期更新,可以在js调用更新
*/

Loading…
Cancel
Save