fix downloading to internal storage

This commit is contained in:
jmir1 2022-06-22 11:32:19 +02:00
parent 5ec79c79dc
commit b72a24f867
3 changed files with 3 additions and 3 deletions

View file

@ -235,7 +235,7 @@ class LocalAnimeSource(
val second = duration.toInt() / 2
val coverFilename = coverPath.toFFmpegString(context)
FFmpegKit.execute("-ss $second -i \"${episodeFilename()}\" -frames 1 -q:v 2 \"$coverFilename\"")
FFmpegKit.execute("-ss $second -i \"${episodeFilename()}\" -frames 1 -q:v 2 \"$coverFilename\" -y")
if (File(coverPath).exists()) {
anime.thumbnail_url = coverPath

View file

@ -503,7 +503,7 @@ class AnimeDownloader(
val videoFile = tmpDir.findFile("$filename.mp4")
?: tmpDir.createFile("$filename.mp4")!!
val ffmpegFilename = { videoFile.uri.toFFmpegString(context) }
val ffmpegOptions = FFmpegKitConfig.parseArguments(headerOptions + " -i '${video.videoUrl}' -c copy \"${ffmpegFilename()}\"")
val ffmpegOptions = FFmpegKitConfig.parseArguments(headerOptions + " -i '${video.videoUrl}' -c copy \"${ffmpegFilename()}\" -y")
val ffprobeCommand = { file: String, ffprobeHeaders: String? ->
FFmpegKitConfig.parseArguments("${ffprobeHeaders?.plus(" ") ?: ""}-v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 \"$file\"")
}

View file

@ -11,7 +11,7 @@ fun String.toFFmpegString(context: Context): String {
}
fun Uri.toFFmpegString(context: Context): String {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && this.scheme == "content") {
FFmpegKitConfig.getSafParameter(context, this, "rw")
} else {
this.path!!