Skip to content

Commit 41978e3

Browse files
[audio-transcodes] Fix paths with spaces and ffmpeg stderr flood (#581)
1 parent 6e350ea commit 41978e3

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

plugins/audio-transcodes/audio-transcodes.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import json
55
from pathlib import Path
6-
import os
6+
import subprocess
77

88
settings = {"hash_type": "oshash", "transcodes_dir": "/generated/transcodes/"}
99

@@ -18,12 +18,18 @@ def run_ffmpeg(file, hash):
1818
dest,
1919
)
2020
)
21-
command = (
22-
"ffmpeg -f lavfi -i color=c=blue:s=1280x720 -i %s -shortest -fflags +shortest %s"
23-
% (file, dest)
24-
)
21+
command = [
22+
"ffmpeg",
23+
"-loglevel", "error",
24+
"-f", "lavfi",
25+
"-i", "color=c=blue:s=1280x720",
26+
"-i", file,
27+
"-shortest",
28+
"-fflags", "+shortest",
29+
dest,
30+
]
2531
log.debug("about to run command: %s " % (command,))
26-
os.system(command)
32+
subprocess.run(command)
2733
else:
2834
log.debug(
2935
"transcode already exists %s - %s"
@@ -59,7 +65,6 @@ def processAll():
5965
stash = StashInterface(FRAGMENT_SERVER)
6066
config = stash.get_configuration()
6167

62-
log.debug(config)
6368
settings["transcodes_dir"] = config["general"]["generatedPath"]
6469
settings["hash_type"] = config["general"]["videoFileNamingAlgorithm"].lower()
6570
log.debug(settings)

plugins/audio-transcodes/audio-transcodes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: audio-transcodes
22
description: Generate a transcode video from an audio file
3-
version: 0.1
3+
version: 0.2
44
url: https://github.com/stashapp/CommunityScripts/
55
exec:
66
- python

0 commit comments

Comments
 (0)