|
|
@ -282,10 +282,12 @@ class AudioPlayService : BaseService(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun loadContent(chapter: BookChapter) = AudioPlay.apply { |
|
|
|
private fun loadContent(chapter: BookChapter) { |
|
|
|
book?.let { book -> |
|
|
|
val book = AudioPlay.book |
|
|
|
webBook?.getContent(book, chapter, scope = this@AudioPlayService) |
|
|
|
val webBook = AudioPlay.webBook |
|
|
|
?.onSuccess { content -> |
|
|
|
if (book != null && webBook != null) { |
|
|
|
|
|
|
|
webBook.getContent(book, chapter, scope = this@AudioPlayService) |
|
|
|
|
|
|
|
.onSuccess { content -> |
|
|
|
removeLoading(chapter.index) |
|
|
|
removeLoading(chapter.index) |
|
|
|
if (content.isEmpty()) { |
|
|
|
if (content.isEmpty()) { |
|
|
|
withContext(Main) { |
|
|
|
withContext(Main) { |
|
|
@ -294,10 +296,12 @@ class AudioPlayService : BaseService(), |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
contentLoadFinish(chapter, content) |
|
|
|
contentLoadFinish(chapter, content) |
|
|
|
} |
|
|
|
} |
|
|
|
}?.onError { |
|
|
|
}.onError { |
|
|
|
contentLoadFinish(chapter, it.localizedMessage ?: toString()) |
|
|
|
contentLoadFinish(chapter, it.localizedMessage ?: toString()) |
|
|
|
removeLoading(chapter.index) |
|
|
|
removeLoading(chapter.index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
toast("book or source is null") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|