|
@@ -290,12 +290,12 @@ class EpubFile(var book: Book) {
|
|
|
book.name = book.originName.replace(".epub", "")
|
|
book.name = book.originName.replace(".epub", "")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (metadata.authors.size > 0) {
|
|
|
|
|
|
|
+ if (metadata.authors.isNotEmpty()) {
|
|
|
val author =
|
|
val author =
|
|
|
metadata.authors[0].toString().replace("^, |, $".toRegex(), "")
|
|
metadata.authors[0].toString().replace("^, |, $".toRegex(), "")
|
|
|
book.author = author
|
|
book.author = author
|
|
|
}
|
|
}
|
|
|
- if (metadata.descriptions.size > 0) {
|
|
|
|
|
|
|
+ if (metadata.descriptions.isNotEmpty()) {
|
|
|
val desc = metadata.descriptions[0]
|
|
val desc = metadata.descriptions[0]
|
|
|
book.intro = if (desc.isXml()) {
|
|
book.intro = if (desc.isXml()) {
|
|
|
Jsoup.parse(metadata.descriptions[0]).text()
|
|
Jsoup.parse(metadata.descriptions[0]).text()
|
|
@@ -323,7 +323,7 @@ class EpubFile(var book: Book) {
|
|
|
val doc =
|
|
val doc =
|
|
|
Jsoup.parse(String(resource.data, mCharset))
|
|
Jsoup.parse(String(resource.data, mCharset))
|
|
|
val elements = doc.getElementsByTag("title")
|
|
val elements = doc.getElementsByTag("title")
|
|
|
- if (elements.size > 0) {
|
|
|
|
|
|
|
+ if (elements.isNotEmpty()) {
|
|
|
title = elements[0].text()
|
|
title = elements[0].text()
|
|
|
}
|
|
}
|
|
|
} catch (e: IOException) {
|
|
} catch (e: IOException) {
|
|
@@ -385,7 +385,7 @@ class EpubFile(var book: Book) {
|
|
|
String(epubBook!!.resources.getByHref(content.href).data, mCharset)
|
|
String(epubBook!!.resources.getByHref(content.href).data, mCharset)
|
|
|
).getElementsByTag("title")
|
|
).getElementsByTag("title")
|
|
|
title =
|
|
title =
|
|
|
- if (elements.size > 0 && elements[0].text().isNotBlank())
|
|
|
|
|
|
|
+ if (elements.isNotEmpty() && elements[0].text().isNotBlank())
|
|
|
elements[0].text()
|
|
elements[0].text()
|
|
|
else
|
|
else
|
|
|
"--卷首--"
|
|
"--卷首--"
|