fix: download job stops all together even if 1 entry is failed to create directory (#510)
Also, when some entry failed to create download folder, it shows a notification saying only "invalid location: /downloads" which is misleading. * more detail notification on invalid download location * fix: download job stops all together even if 1 entry is failed to create directory
This commit is contained in:
parent
a66dd25eed
commit
ec97db588a
2 changed files with 11 additions and 2 deletions
|
|
@ -45,7 +45,8 @@ class DownloadProvider(
|
|||
throw Exception(
|
||||
context.stringResource(
|
||||
MR.strings.invalid_location,
|
||||
downloadsDir?.displayablePath ?: "",
|
||||
(downloadsDir?.displayablePath ?: "") +
|
||||
"/${getSourceDirName(source)}/${getMangaDirName(mangaTitle)}",
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,15 @@ class Downloader(
|
|||
* @param download the chapter to be downloaded.
|
||||
*/
|
||||
private suspend fun downloadChapter(download: Download) {
|
||||
val mangaDir = provider.getMangaDir(/* SY --> */ download.manga.ogTitle /* SY <-- */, download.source)
|
||||
val mangaDir: UniFile
|
||||
try {
|
||||
mangaDir = provider.getMangaDir(/* SY --> */ download.manga.ogTitle /* SY <-- */, download.source)
|
||||
} catch (error: Exception) {
|
||||
logcat(LogPriority.ERROR, error)
|
||||
download.status = Download.State.ERROR
|
||||
notifier.onError(error.message, download.chapter.name, download.manga.title, download.manga.id)
|
||||
return
|
||||
}
|
||||
|
||||
val availSpace = DiskUtil.getAvailableStorageSpace(mangaDir)
|
||||
if (availSpace != -1L && availSpace < MIN_DISK_SPACE) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue