| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 78fb6cf commit 2a7a2d7
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,8 @@ | |||
| 3 | 3 | from past.builtins import basestring | |
| 4 | 4 | import hashlib | |
| 5 | 5 | import sys | |
| 6 | + import collections | ||
| 7 | + | ||
| 6 | 8 | ||
| 7 | 9 | if sys.version_info.major == 2: | |
| 8 | 10 | # noinspection PyUnresolvedReferences,PyShadowingBuiltins | |
@@ -91,6 +93,12 @@ def convert_kwargs_to_cmd_line_args(kwargs): | |||
| 91 | 93 | args = [] | |
| 92 | 94 | for k in sorted(kwargs.keys()): | |
| 93 | 95 | v = kwargs[k] | |
| 96 | + if isinstance(v, collections.Iterable) and not isinstance(v, str): | ||
| 97 | + for value in v: | ||
| 98 | + args.append('-{}'.format(k)) | ||
| 99 | + if value is not None: | ||
| 100 | + args.append('{}'.format(value)) | ||
| 101 | + continue | ||
| 94 | 102 | args.append('-{}'.format(k)) | |
| 95 | 103 | if v is not None: | |
| 96 | 104 | args.append('{}'.format(v)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | import re | |
| 10 | 10 | import subprocess | |
| 11 | 11 | ||
| 12 | + | ||
| 12 | 13 | try: | |
| 13 | 14 | import mock # python 2 | |
| 14 | 15 | except ImportError: | |
@@ -114,6 +115,10 @@ def test_stream_repr(): | |||
| 114 | 115 | dummy_out.label, dummy_out.node.short_hash | |
| 115 | 116 | ) | |
| 116 | 117 | ||
| 118 | + def test_repeated_args(): | ||
| 119 | + out_file = ffmpeg.input('dummy.mp4').output('dummy2.mp4', streamid=['0:0x101', '1:0x102']) | ||
| 120 | + assert out_file.get_args() == ['-i', 'dummy.mp4', '-streamid', '0:0x101', '-streamid', '1:0x102', 'dummy2.mp4'] | ||
| 121 | + | ||
| 117 | 122 | ||
| 118 | 123 | def test__get_args__simple(): | |
| 119 | 124 | out_file = ffmpeg.input('dummy.mp4').output('dummy2.mp4') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments