Commit e3a292e
committed
feat: add "--camera-device" parameter with mutual exclusivity for video source selection
Added an optional command-line parameter "--camera-device"
(integer with default value of 0) to allow users to specify
which camera device index to use (default: 0). This parameter
is mutually exclusive with the existing "--play-video" parameter
(only one video source can be specified), enforced using mutually
exclusive group feature of "argparse" module.
Backward compatibility:
- No parameters provided → uses camera device 0 (existing behavior preserved).
- Single "--camera-device <idx>" → uses specified camera device index.
- Single "--play-video <path>" → uses video file (existing behavior preserved).
- Both parameters → error with clear message from "argparse" module.
Usage examples (valid):
-------------------------------------------------------------------
$ python app.py # camera device 0 (default)
$ python app.py --camera-device 1 # camera device 1
$ python app.py --play-video video.mp4 # video file playback
-------------------------------------------------------------------
Usage examples (invalid):
-------------------------------------------------------------------------------
$ python app.py --camera-device 0 --play-video file.mp4
usage: app.py [-h] [--camera-device idx | --play-video path]
app.py: error: argument --play-video: not allowed with argument --camera-device
-------------------------------------------------------------------------------
Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>1 parent 0f69760 commit e3a292e
2 files changed
+32
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | | - | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | | - | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
| 114 | + | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
133 | | - | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
137 | | - | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
219 | | - | |
| 220 | + | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
984 | 986 | | |
985 | 987 | | |
986 | 988 | | |
| 989 | + | |
987 | 990 | | |
988 | 991 | | |
989 | 992 | | |
| |||
1161 | 1164 | | |
1162 | 1165 | | |
1163 | 1166 | | |
1164 | | - | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
1165 | 1184 | | |
1166 | 1185 | | |
1167 | 1186 | | |
| |||
1173 | 1192 | | |
1174 | 1193 | | |
1175 | 1194 | | |
1176 | | - | |
| 1195 | + | |
1177 | 1196 | | |
1178 | 1197 | | |
1179 | 1198 | | |
| |||
0 commit comments