Merge pull request #2730 from pypeclub/bugfix/OP-2646_Webpublisher-ExtractReview-fails

WebPublisher: Fix for proper parsing of ffmpeg output arguments
This commit is contained in:
Petr Kalis 2022-02-17 08:21:06 +01:00 committed by GitHub
commit 51c28d497a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 4 deletions

View file

@ -694,13 +694,13 @@ class ExtractReview(pyblish.api.InstancePlugin):
audio_args_dentifiers = ["-af", "-filter:a"]
for arg in tuple(output_args):
for identifier in video_args_dentifiers:
if identifier in arg:
if arg.startswith("{} ".format(identifier)):
output_args.remove(arg)
arg = arg.replace(identifier, "").strip()
video_filters.append(arg)
for identifier in audio_args_dentifiers:
if identifier in arg:
if arg.startswith("{} ".format(identifier)):
output_args.remove(arg)
arg = arg.replace(identifier, "").strip()
audio_filters.append(arg)

View file

@ -12,8 +12,6 @@ Structure:
How to run:
----------
- single test class could be run by PyCharm and its pytest runner directly
- OR
- use Openpype command 'runtests' from command line (`.venv` in ${OPENPYPE_ROOT} must be activated to use configured Python!)
-- `${OPENPYPE_ROOT}/python start.py runtests`

View file

@ -0,0 +1,29 @@
from openpype.plugins.publish.extract_review import ExtractReview
def test_fix_ffmpeg_full_args_filters():
"""Tests because of wrong resolution of audio filters."""
plugin = ExtractReview()
output_arg = "c:/test-afbdc"
ret = plugin.ffmpeg_full_args([], [], [], [output_arg])
assert len(ret) == 2, "Parsed wrong"
assert ret[-1] == output_arg
ret = plugin.ffmpeg_full_args([], [], ["adeclick"], [output_arg])
assert len(ret) == 4, "Parsed wrong"
assert ret[-1] == output_arg
assert ret[-2] == '"adeclick"'
assert ret[-3] == "-filter:a"
ret = plugin.ffmpeg_full_args([], [], [], [output_arg, "-af adeclick"])
assert len(ret) == 4, "Parsed wrong"
assert ret[-1] == output_arg
assert ret[-2] == '"adeclick"'
assert ret[-3] == "-filter:a"
ret = plugin.ffmpeg_full_args([], [], ["adeclick"],
[output_arg, "-af adeclick"])
assert len(ret) == 4, "Parsed wrong"
assert ret[-1] == output_arg
assert ret[-2] == '"adeclick,adeclick"' # TODO fix this duplication
assert ret[-3] == "-filter:a"