From 27c110936fb8f1e81517ade3e80499fd596b70a2 Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Wed, 6 Dec 2023 20:44:21 +0000 Subject: [PATCH] fix: windows --- src/__tests__/ffmpeg.spec.ts | 1 + src/__tests__/ffmpegReleases.json | 2 +- tools/fetch_ffmpeg.mjs | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/__tests__/ffmpeg.spec.ts b/src/__tests__/ffmpeg.spec.ts index 1aa03a3..874749d 100644 --- a/src/__tests__/ffmpeg.spec.ts +++ b/src/__tests__/ffmpeg.spec.ts @@ -7,6 +7,7 @@ const targetVersions = require('./ffmpegReleases.json') const testMediaPath = path.join(__dirname, 'samples') function runForFFmpegRelease(ffprobePath: string, ffmpegPath: string) { + console.log('ff', ffprobePath, ffmpegPath) function createBareDoc(filename: string): PouchDBMediaDocument { return { _id: 'test', diff --git a/src/__tests__/ffmpegReleases.json b/src/__tests__/ffmpegReleases.json index d865ead..4bba723 100644 --- a/src/__tests__/ffmpegReleases.json +++ b/src/__tests__/ffmpegReleases.json @@ -21,7 +21,7 @@ "url": "https://github.com/CasparCG/dependencies/releases/download/ffmpeg-binaries/ffmpeg-6.1-amd64-static.tar.xz" } ], - "windows-x64": [ + "win32-x64": [ { "id": "4.1.4", "url": "https://github.com/CasparCG/dependencies/releases/download/ffmpeg-binaries/ffmpeg-4.1.4-win64-static.zip" diff --git a/tools/fetch_ffmpeg.mjs b/tools/fetch_ffmpeg.mjs index dbd9917..0264787 100644 --- a/tools/fetch_ffmpeg.mjs +++ b/tools/fetch_ffmpeg.mjs @@ -32,6 +32,7 @@ if (platformVersions) { const versionPath = path.join(ffmpegRootDir, version.id) const dirStat = await pathExists(versionPath) if (!dirStat) { + console.log(`Fetching ${version.url}`) // Download it const response = await fetch(version.url) @@ -39,11 +40,14 @@ if (platformVersions) { await streamPipeline(response.body, createWriteStream(tmpPath)) // Extract it - await fs.mkdir(versionPath).catch(() => null) if (versionPath.endsWith('.tar.xz')) { + await fs.mkdir(versionPath).catch(() => null) cp.execSync(`tar -xJf ${toPosix(tmpPath)} --strip-components=1 -C ${toPosix(versionPath)}`) } else if (version.url.endsWith('.zip')) { - cp.execSync(`unzip ${toPosix(tmpPath)} -d ${toPosix(versionPath)}`) + cp.execSync(`unzip ${toPosix(tmpPath)} -d ${toPosix(ffmpegRootDir)}`) + + const dirname = path.parse(version.url).name + await fs.rename(path.join(ffmpegRootDir, dirname), versionPath) } else { throw new Error(`Unhandled file extension: ${version.url}`) }