diff --git a/openpype/plugins/publish/extract_review.py b/openpype/plugins/publish/extract_review.py index d223c31291..5f286a53e6 100644 --- a/openpype/plugins/publish/extract_review.py +++ b/openpype/plugins/publish/extract_review.py @@ -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) diff --git a/tests/README.md b/tests/README.md index d0578f8059..6fb86cd027 100644 --- a/tests/README.md +++ b/tests/README.md @@ -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` diff --git a/tests/unit/openpype/plugins/publish/test_extract_review.py b/tests/unit/openpype/plugins/publish/test_extract_review.py new file mode 100644 index 0000000000..48317f0eb9 --- /dev/null +++ b/tests/unit/openpype/plugins/publish/test_extract_review.py @@ -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"