mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-29 17:49:03 +03:00
fix hls download headers and weird characters
This commit is contained in:
parent
b53bc48e0c
commit
98b7e1dbeb
1 changed files with 3 additions and 2 deletions
|
@ -485,10 +485,11 @@ class AnimeDownloader(
|
||||||
|
|
||||||
private fun hlsObservable(video: Video, source: AnimeHttpSource, tmpDir: UniFile, filename: String): Observable<UniFile> {
|
private fun hlsObservable(video: Video, source: AnimeHttpSource, tmpDir: UniFile, filename: String): Observable<UniFile> {
|
||||||
isFFmpegRunning = true
|
isFFmpegRunning = true
|
||||||
|
val escapedFilename = "${tmpDir.filePath}/$filename.mp4".replace("\"", "\\\"")
|
||||||
val headers = video.headers ?: source.headers
|
val headers = video.headers ?: source.headers
|
||||||
val headerOptions = headers.joinToString("-headers ", "-headers ", " ") { "\"${it.first}: ${it.second}\"" }
|
val headerOptions = headers.joinToString("", "-headers '", "'") { "${it.first}: ${it.second}\r\n" }
|
||||||
// TODO: Support other file formats here as well (ffprobe or something, idk)
|
// TODO: Support other file formats here as well (ffprobe or something, idk)
|
||||||
val ffmpegOptions = FFmpegKitConfig.parseArguments(headerOptions + "-i \"${video.videoUrl}\" -c copy \"${tmpDir.filePath}/$filename.mp4\"")
|
val ffmpegOptions = FFmpegKitConfig.parseArguments(headerOptions + " -i '${video.videoUrl}' -c copy \"$escapedFilename\"")
|
||||||
val executeCallback = ExecuteCallback {
|
val executeCallback = ExecuteCallback {
|
||||||
if (it.state != SessionState.COMPLETED) tmpDir.findFile("$filename.mp4")?.delete()
|
if (it.state != SessionState.COMPLETED) tmpDir.findFile("$filename.mp4")?.delete()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue