pull/1282/head
parent
7c08da40ba
commit
ea3259be2e
@ -1,8 +0,0 @@ |
||||
package io.legado.app.model.webBook |
||||
|
||||
import io.legado.app.data.entities.BookChapter |
||||
|
||||
data class ChapterData<T>( |
||||
var chapterList: List<BookChapter>? = null, |
||||
var nextUrl: T |
||||
) |
@ -1,6 +0,0 @@ |
||||
package io.legado.app.model.webBook |
||||
|
||||
data class ContentData<T>( |
||||
var content: String = "", |
||||
var nextUrl: T |
||||
) |
@ -1,37 +0,0 @@ |
||||
package io.legado.app.model.webBook |
||||
|
||||
import io.legado.app.data.entities.Book |
||||
import io.legado.app.data.entities.BookSource |
||||
import kotlinx.coroutines.CoroutineScope |
||||
import kotlinx.coroutines.isActive |
||||
|
||||
/** |
||||
* 精准搜索 |
||||
*/ |
||||
object PreciseSearch { |
||||
|
||||
suspend fun searchFirstBook( |
||||
scope: CoroutineScope, |
||||
bookSources: List<BookSource>, |
||||
name: String, |
||||
author: String |
||||
): Book? { |
||||
bookSources.forEach { bookSource -> |
||||
kotlin.runCatching { |
||||
if (!scope.isActive) return null |
||||
WebBook.searchBookAwait(scope, bookSource, name).firstOrNull { |
||||
it.name == name && it.author == author |
||||
}?.let { |
||||
return if (it.tocUrl.isBlank()) { |
||||
if (!scope.isActive) return null |
||||
WebBook.getBookInfoAwait(scope, bookSource, it.toBook()) |
||||
} else { |
||||
it.toBook() |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return null |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue