一些优化
This commit is contained in:
@@ -124,6 +124,16 @@ data class Book(
|
||||
var syncTime: Long = 0L
|
||||
) : Parcelable, BaseBook {
|
||||
|
||||
init {
|
||||
kind = kind?.take(1000)
|
||||
intro = intro?.take(5000)
|
||||
customTag = customTag?.take(1000)
|
||||
customIntro = customIntro?.take(5000)
|
||||
remark = remark?.take(1000)
|
||||
latestChapterTitle = latestChapterTitle?.take(200)
|
||||
durChapterTitle = durChapterTitle?.take(200)
|
||||
}
|
||||
|
||||
@delegate:Transient
|
||||
@delegate:Ignore
|
||||
@IgnoredOnParcel
|
||||
|
||||
@@ -54,6 +54,12 @@ data class SearchBook(
|
||||
var respondTime: Int = -1
|
||||
) : Parcelable, BaseBook, Comparable<SearchBook> {
|
||||
|
||||
init {
|
||||
kind = kind?.take(1000)
|
||||
intro = intro?.take(5000)
|
||||
latestChapterTitle = latestChapterTitle?.take(200)
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@IgnoredOnParcel
|
||||
override var infoHtml: String? = null
|
||||
|
||||
@@ -84,6 +84,7 @@ object BookInfo {
|
||||
try {
|
||||
analyzeRule.getStringList(infoRule.kind)
|
||||
?.joinToString(",")
|
||||
?.take(1000)
|
||||
?.let {
|
||||
if (it.isNotEmpty()) book.kind = it
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
@@ -120,7 +121,7 @@ object BookInfo {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "┌获取简介")
|
||||
try {
|
||||
HtmlFormatter.format(analyzeRule.getString(infoRule.intro)).let {
|
||||
HtmlFormatter.format(analyzeRule.getString(infoRule.intro)).take(5000).let {
|
||||
if (it.isNotEmpty()) book.intro = it
|
||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ object BookList {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "┌获取分类", log)
|
||||
try {
|
||||
searchBook.kind = analyzeRule.getStringList(ruleKind)?.joinToString(",")
|
||||
searchBook.kind = analyzeRule.getStringList(ruleKind)?.joinToString(",")?.take(1000)
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.kind ?: ""}", log)
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
@@ -257,7 +257,7 @@ object BookList {
|
||||
coroutineContext.ensureActive()
|
||||
Debug.log(bookSource.bookSourceUrl, "┌获取简介", log)
|
||||
try {
|
||||
searchBook.intro = HtmlFormatter.format(analyzeRule.getString(ruleIntro))
|
||||
searchBook.intro = HtmlFormatter.format(analyzeRule.getString(ruleIntro)).take(5000)
|
||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", log)
|
||||
} catch (e: Exception) {
|
||||
coroutineContext.ensureActive()
|
||||
|
||||
Reference in New Issue
Block a user