moved from exec to execFile

This commit is contained in:
stratuma 2024-07-08 15:36:54 +02:00
parent ca41ed0727
commit cec66853c4
3 changed files with 15 additions and 7 deletions

View File

@ -23,7 +23,7 @@ import settings from 'electron-settings'
import { server } from '../../api'
import { createChapterFile } from '../../services/chapter'
import { app } from 'electron'
const exec = util.promisify(require('child_process').exec)
const execFile = util.promisify(require('child_process').execFile)
settings.configure({
dir: app.getPath('documents') + '/Crunchyroll Downloader/settings/'
@ -1354,9 +1354,13 @@ async function mergeParts(parts: { filename: string; url: string }[], downloadID
await updatePlaylistByID(downloadID, 'decrypting video')
console.log('Video Decryption started')
const command = `${shaka} input="${tmp}/temp-main.m4s",stream=video,output="${tmp}/main.m4s" --enable_raw_key_decryption --keys key_id=${drmkeys[1].kid}:key=${drmkeys[1].key}`
await execFile(shaka, [
`input=${tmp}/temp-main.m4s,stream=video,output=${tmp}/main.m4s`,
'--enable_raw_key_decryption',
'--keys',
`key_id=${drmkeys[1].kid}:key=${drmkeys[1].key}`
])
await exec(command)
console.log('Video Decryption finished')
concatenatedFile = `${tmp}/main.m4s`
}

View File

@ -9,7 +9,7 @@ const ffmpegP = getFFMPEGPath()
const shaka = getShakaPath()
import util from 'util'
import { server } from '../api'
const exec = util.promisify(require('child_process').exec)
const execFile = util.promisify(require('child_process').execFile)
import { finished } from 'stream/promises'
import { messageBox } from '../../electron/background'
@ -163,9 +163,13 @@ async function mergePartsAudio(
console.log(`Audio Decryption started`)
const command = `${shaka} input="${tmp}/temp-main.m4s",stream=audio,output="${tmp}/main.m4s" --enable_raw_key_decryption --keys key_id=${drmkeys[1].kid}:key=${drmkeys[1].key}`
await execFile(shaka, [
`input=${tmp}/temp-main.m4s,stream=audio,output=${tmp}/main.m4s`,
'--enable_raw_key_decryption',
'--keys',
`key_id=${drmkeys[1].kid}:key=${drmkeys[1].key}`
])
await exec(command)
concatenatedFile = `${tmp}/main.m4s`
console.log(`Audio Decryption finished`)
}

View File

@ -14,7 +14,7 @@ export function getShakaPath() {
return shaka
} else {
const shaka = `"${path.join(shakaFolderPath, 'shaka.exe')}"`
const shaka = path.join(shakaFolderPath, 'shaka.exe')
return shaka
}