|
|
|
@ -118,6 +118,14 @@ data class BookSource( |
|
|
|
|
|
|
|
|
|
fun getContentRule() = ruleContent ?: ContentRule() |
|
|
|
|
|
|
|
|
|
fun getDisPlayNameGroup(): String { |
|
|
|
|
return if (bookSourceGroup.isNullOrBlank()) { |
|
|
|
|
bookSourceName |
|
|
|
|
} else { |
|
|
|
|
String.format("%s (%s)", bookSourceName, bookSourceGroup) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun addGroup(groups: String): BookSource { |
|
|
|
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let { |
|
|
|
|
it.addAll(groups.splitNotBlank(AppPattern.splitGroupRegex)) |
|
|
|
@ -137,7 +145,7 @@ data class BookSource( |
|
|
|
|
|
|
|
|
|
fun hasGroup(group: String): Boolean { |
|
|
|
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let { |
|
|
|
|
return it.indexOf(group) != -1 |
|
|
|
|
return it.indexOf(group) != -1 |
|
|
|
|
} |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
@ -148,28 +156,28 @@ data class BookSource( |
|
|
|
|
|
|
|
|
|
fun getInvalidGroupNames(): String { |
|
|
|
|
return bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.filter { |
|
|
|
|
"失效" in it |
|
|
|
|
"失效" in it |
|
|
|
|
}?.joinToString() ?: "" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun equal(source: BookSource) = |
|
|
|
|
equal(bookSourceName, source.bookSourceName) |
|
|
|
|
&& equal(bookSourceUrl, source.bookSourceUrl) |
|
|
|
|
&& equal(bookSourceGroup, source.bookSourceGroup) |
|
|
|
|
&& bookSourceType == source.bookSourceType |
|
|
|
|
&& equal(bookUrlPattern, source.bookUrlPattern) |
|
|
|
|
&& equal(bookSourceComment, source.bookSourceComment) |
|
|
|
|
&& enabled == source.enabled |
|
|
|
|
&& enabledExplore == source.enabledExplore |
|
|
|
|
&& equal(header, source.header) |
|
|
|
|
&& loginUrl == source.loginUrl |
|
|
|
|
&& equal(exploreUrl, source.exploreUrl) |
|
|
|
|
&& equal(searchUrl, source.searchUrl) |
|
|
|
|
&& getSearchRule() == source.getSearchRule() |
|
|
|
|
&& getExploreRule() == source.getExploreRule() |
|
|
|
|
&& getBookInfoRule() == source.getBookInfoRule() |
|
|
|
|
&& getTocRule() == source.getTocRule() |
|
|
|
|
&& getContentRule() == source.getContentRule() |
|
|
|
|
&& equal(bookSourceUrl, source.bookSourceUrl) |
|
|
|
|
&& equal(bookSourceGroup, source.bookSourceGroup) |
|
|
|
|
&& bookSourceType == source.bookSourceType |
|
|
|
|
&& equal(bookUrlPattern, source.bookUrlPattern) |
|
|
|
|
&& equal(bookSourceComment, source.bookSourceComment) |
|
|
|
|
&& enabled == source.enabled |
|
|
|
|
&& enabledExplore == source.enabledExplore |
|
|
|
|
&& equal(header, source.header) |
|
|
|
|
&& loginUrl == source.loginUrl |
|
|
|
|
&& equal(exploreUrl, source.exploreUrl) |
|
|
|
|
&& equal(searchUrl, source.searchUrl) |
|
|
|
|
&& getSearchRule() == source.getSearchRule() |
|
|
|
|
&& getExploreRule() == source.getExploreRule() |
|
|
|
|
&& getBookInfoRule() == source.getBookInfoRule() |
|
|
|
|
&& getTocRule() == source.getTocRule() |
|
|
|
|
&& getContentRule() == source.getContentRule() |
|
|
|
|
|
|
|
|
|
private fun equal(a: String?, b: String?) = a == b || (a.isNullOrEmpty() && b.isNullOrEmpty()) |
|
|
|
|
|
|
|
|
|