mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +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.
|
* Regenerate stream url using available info format and quality.
|
||||||
*/
|
*/
|
||||||
private suspend fun regenerateLink(item: DownloadItem) {
|
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) {
|
val stream = when (item.type) {
|
||||||
FileType.AUDIO -> streams.audioStreams
|
FileType.AUDIO -> streams.audioStreams
|
||||||
FileType.VIDEO -> streams.videoStreams
|
FileType.VIDEO -> streams.videoStreams
|
||||||
|
@ -85,14 +85,17 @@ class DownloadDialog : DialogFragment() {
|
|||||||
StreamsExtractor.extractStreams(videoId)
|
StreamsExtractor.extractStreams(videoId)
|
||||||
}
|
}
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
println(e)
|
Log.e(TAG(), e.stackTraceToString())
|
||||||
Log.e(TAG(), "IOException, you might not have internet connection")
|
|
||||||
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.unknown_error, Toast.LENGTH_SHORT).show()
|
||||||
return@launch
|
return@launch
|
||||||
} catch (e: HttpException) {
|
} 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()
|
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
|
||||||
return@launch
|
return@launch
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG(), e.stackTraceToString())
|
||||||
|
Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
|
||||||
|
return@launch
|
||||||
}
|
}
|
||||||
initDownloadOptions(binding, response)
|
initDownloadOptions(binding, response)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user