Skip to content
Snippets Groups Projects
Commit 478b8120 authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Fix subtitle download error when trying to download for a non-local file

Fixes #1396
parent 890bae8d
No related branches found
No related tags found
1 merge request!6533.3 fixes
......@@ -145,10 +145,14 @@ class SubtitlesModel(private val context: Context, private val mediaUri: Uri, va
val subs = if (byHash) {
withContext(coroutineContextProvider.IO) {
val videoFile = File(mediaUri.path)
val hash = FileUtils.computeHash(videoFile)
val fileLength = videoFile.length()
if (videoFile.exists()) {
val hash = FileUtils.computeHash(videoFile)
val fileLength = videoFile.length()
getSubtitleByHash(fileLength, hash, observableSearchLanguage.get())
} else {
getSubtitleByName(videoFile.name, null, null, observableSearchLanguage.get())
}
getSubtitleByHash(fileLength, hash, observableSearchLanguage.get())
}
} else {
observableSearchName.get()?.let {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment