Minor changes

This commit is contained in:
len
2016-03-19 19:30:55 +01:00
parent 53fae2939a
commit 5132f4850f
5 changed files with 24 additions and 59 deletions
@@ -162,11 +162,7 @@ class DownloadManager(private val context: Context, private val sourceManager: S
// Download the entire chapter
private fun downloadChapter(download: Download): Observable<Download> {
try {
DiskUtils.createDirectory(download.directory)
} catch (e: IOException) {
return Observable.error<Download>(e)
}
DiskUtils.createDirectory(download.directory)
val pageListObservable = if (download.pages == null)
// Pull page list from network and add them to download object
@@ -236,13 +232,8 @@ class DownloadManager(private val context: Context, private val sourceManager: S
page.status = Page.DOWNLOAD_IMAGE
return source.getImageProgressResponse(page)
.flatMap({ resp ->
try {
DiskUtils.saveBufferedSourceToDirectory(resp.body().source(), directory, filename)
Observable.just(page)
} catch (e: Exception) {
Timber.e(e.cause, e.message)
Observable.error<Page>(e)
}
DiskUtils.saveBufferedSourceToDirectory(resp.body().source(), directory, filename)
Observable.just(page)
}).retry(2)
}