feat: bundle yt-dlp and ffmpeg Linux binaries in bin/
Adds precompiled Linux x86_64 binaries for yt-dlp and ffmpeg under bin/. The processor resolves yt-dlp from bin/ when present, falling back to PATH. ffmpeg is passed via --ffmpeg-location so yt-dlp uses the bundled binary on o2switch. BIN_DIR is configurable via env var. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-2
@@ -1,11 +1,16 @@
|
||||
import { spawn } from 'child_process'
|
||||
import { readdirSync, statSync } from 'fs'
|
||||
import { existsSync, readdirSync, statSync } from 'fs'
|
||||
import path from 'path'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { buildYtdlpArgs } from '@/lib/ytdlp'
|
||||
import { createToken } from '@/lib/token'
|
||||
import { config } from '../config/app.config'
|
||||
|
||||
function resolveYtdlpBin(): string {
|
||||
const local = path.join(config.BIN_DIR, 'yt-dlp')
|
||||
return existsSync(local) ? local : 'yt-dlp'
|
||||
}
|
||||
|
||||
export async function processDownload(downloadId: string): Promise<void> {
|
||||
const download = await prisma.download.findUnique({ where: { id: downloadId } })
|
||||
if (!download) return
|
||||
@@ -22,7 +27,7 @@ export async function processDownload(downloadId: string): Promise<void> {
|
||||
let stderr = ''
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
const proc = spawn('yt-dlp', args)
|
||||
const proc = spawn(resolveYtdlpBin(), args)
|
||||
proc.stderr.on('data', (chunk: Buffer) => { stderr += chunk.toString() })
|
||||
|
||||
proc.on('close', async (code) => {
|
||||
|
||||
Reference in New Issue
Block a user