mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 14:59:18 +01:00
Handle empty directory. Fix travis
This commit is contained in:
parent
f9c5379400
commit
20041701cd
@ -5,7 +5,7 @@ android:
|
|||||||
- tools
|
- tools
|
||||||
|
|
||||||
# The BuildTools version used by your project
|
# The BuildTools version used by your project
|
||||||
- build-tools-25.0.0
|
- build-tools-25.0.1
|
||||||
- android-25
|
- android-25
|
||||||
- extra-android-m2repository
|
- extra-android-m2repository
|
||||||
- extra-google-m2repository
|
- extra-google-m2repository
|
||||||
|
@ -96,16 +96,17 @@ class DownloadManager(context: Context) {
|
|||||||
*/
|
*/
|
||||||
private fun buildPageList(chapterDir: UniFile?): Observable<List<Page>> {
|
private fun buildPageList(chapterDir: UniFile?): Observable<List<Page>> {
|
||||||
return Observable.fromCallable {
|
return Observable.fromCallable {
|
||||||
val pages = mutableListOf<Page>()
|
val files = chapterDir?.listFiles().orEmpty()
|
||||||
chapterDir?.listFiles()
|
.filter { "image" in it.type.orEmpty() }
|
||||||
?.filter { it.type?.startsWith("image") ?: false }
|
|
||||||
?.sortedBy { it.name }
|
if (files.isEmpty()) {
|
||||||
?.forEach { file ->
|
throw Exception("Page list is empty")
|
||||||
val page = Page(pages.size, uri = file.uri)
|
}
|
||||||
pages.add(page)
|
|
||||||
page.status = Page.READY
|
files.sortedBy { it.name }
|
||||||
|
.mapIndexed { i, file ->
|
||||||
|
Page(i, uri = file.uri).apply { status = Page.READY }
|
||||||
}
|
}
|
||||||
pages
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user