fix: yt-dlp im temporären Verzeichnis ausführen (Streudatei „3“)
yt-dlp ruft zur Prüfung „ffmpeg -bsfs“ auf; das System-ffmpeg 6.1.1 (Ubuntu) legt dabei eine leere Datei „3“ im Arbeitsverzeichnis an. yt-dlp läuft jetzt in einem temporären Verzeichnis mit absolutem Zielpfad, die Datei verschwindet mit dem Verzeichnis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
60c7c10abb
commit
7e6ffa5899
1 changed files with 40 additions and 13 deletions
|
|
@ -12,13 +12,15 @@ def fake_yt_dlp():
|
|||
"""Factory for a subprocess.run stand-in.
|
||||
|
||||
It answers the info request with `info` and writes `vtt` where yt-dlp would
|
||||
write the subtitle file. `run.calls` records every command.
|
||||
write the subtitle file. `run.calls` records every command, `run.cwds` the
|
||||
working directories.
|
||||
"""
|
||||
def make(info, vtt="WEBVTT\n", write=True, fail_download=False):
|
||||
calls = []
|
||||
calls, cwds = [], []
|
||||
|
||||
def run(command, capture_output, text):
|
||||
def run(command, capture_output, text, cwd=None):
|
||||
calls.append(command)
|
||||
cwds.append(cwd)
|
||||
if "--dump-single-json" in command:
|
||||
return subprocess.CompletedProcess(command, 0, json.dumps(info), "")
|
||||
if fail_download:
|
||||
|
|
@ -32,6 +34,7 @@ def fake_yt_dlp():
|
|||
return subprocess.CompletedProcess(command, 0, "", "")
|
||||
|
||||
run.calls = calls
|
||||
run.cwds = cwds
|
||||
return run
|
||||
|
||||
return make
|
||||
|
|
|
|||
Loading…
Reference in a new issue