[audio-transcodes] Fix paths with spaces and ffmpeg stderr flood (#581)

This commit is contained in:
you-cant-see-me 2025-06-14 07:37:15 +01:00 committed by GitHub
parent 6e350eadbb
commit 41978e3378
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -3,7 +3,7 @@ from stashapi.stashapp import StashInterface
import sys
import json
from pathlib import Path
import os
import subprocess
settings = {"hash_type": "oshash", "transcodes_dir": "/generated/transcodes/"}
@ -18,12 +18,18 @@ def run_ffmpeg(file, hash):
dest,
)
)
command = (
"ffmpeg -f lavfi -i color=c=blue:s=1280x720 -i %s -shortest -fflags +shortest %s"
% (file, dest)
)
command = [
"ffmpeg",
"-loglevel", "error",
"-f", "lavfi",
"-i", "color=c=blue:s=1280x720",
"-i", file,
"-shortest",
"-fflags", "+shortest",
dest,
]
log.debug("about to run command: %s " % (command,))
os.system(command)
subprocess.run(command)
else:
log.debug(
"transcode already exists %s - %s"
@ -59,7 +65,6 @@ FRAGMENT_SERVER = json_input["server_connection"]
stash = StashInterface(FRAGMENT_SERVER)
config = stash.get_configuration()
log.debug(config)
settings["transcodes_dir"] = config["general"]["generatedPath"]
settings["hash_type"] = config["general"]["videoFileNamingAlgorithm"].lower()
log.debug(settings)

View File

@ -1,6 +1,6 @@
name: audio-transcodes
description: Generate a transcode video from an audio file
version: 0.1
version: 0.2
url: https://github.com/stashapp/CommunityScripts/
exec:
- python