mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
fix: uncaught local streams extractor exceptions
This commit is contained in:
parent
e6406440cf
commit
f1d93b6840
@ -387,7 +387,9 @@ class DownloadService : LifecycleService() {
|
||||
* Regenerate stream url using available info format and quality.
|
||||
*/
|
||||
private suspend fun regenerateLink(item: DownloadItem) {
|
||||
val streams = StreamsExtractor.extractStreams(item.videoId)
|
||||
val streams = runCatching {
|
||||
StreamsExtractor.extractStreams(item.videoId)
|
||||
}.getOrNull() ?: return
|
||||
val stream = when (item.type) {
|
||||
FileType.AUDIO -> streams.audioStreams
|
||||
FileType.VIDEO -> streams.videoStreams
|
||||
|
@ -85,14 +85,17 @@ class DownloadDialog : DialogFragment() {
|
||||
StreamsExtractor.extractStreams(videoId)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
println(e)
|
||||
Log.e(TAG(), "IOException, you might not have internet connection")
|
||||
Log.e(TAG(), e.stackTraceToString())
|
||||
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
||||
return@launch
|
||||
} catch (e: HttpException) {
|
||||
Log.e(TAG(), "HttpException, unexpected response")
|
||||
Log.e(TAG(), e.stackTraceToString())
|
||||
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
|
||||
return@launch
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG(), e.stackTraceToString())
|
||||
Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
|
||||
return@launch
|
||||
}
|
||||
initDownloadOptions(binding, response)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user