If a video fails to download, move it to the end of the queue
This commit is contained in:
parent
45fb0d4d71
commit
767cd1aa67
1 changed files with 12 additions and 0 deletions
|
|
@ -108,24 +108,36 @@ class VideoDownloadingProcessorUseCase(
|
|||
|
||||
ProcessState.Processed(videoDownloaded)
|
||||
} catch (networkException: NetworkException) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
ProcessState.NetworkError
|
||||
} catch (parsingException: ParsingException) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
ProcessState.ParsingError
|
||||
} catch (videoDeletedException: VideoDeletedException) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
ProcessState.VideoDeletedError
|
||||
} catch (videoPrivateException: VideoPrivateException) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
ProcessState.VideoPrivateError
|
||||
} catch (storageException: StorageException) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
ProcessState.StorageError
|
||||
} catch (captchaRequiredException: CaptchaRequiredException) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
captchaTimeoutLocalSource.onCaptchaResponseReceived()
|
||||
ProcessState.CaptchaError
|
||||
} catch (throwable: Throwable) {
|
||||
moveAtTheEndOfList(videoInPending)
|
||||
ProcessState.UnknownError
|
||||
} finally {
|
||||
videoInProgressLocalSource.removeVideoAsInProgress(videoInPending)
|
||||
}
|
||||
|
||||
private fun moveAtTheEndOfList(videoInPending: VideoInPending) {
|
||||
videoInPendingLocalSource.removeVideoFromQueue(videoInPending)
|
||||
videoInPendingLocalSource.saveUrlIntoQueue(videoInPending)
|
||||
}
|
||||
|
||||
private enum class ProcessingState {
|
||||
RUNNING, ERROR
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue