Skip to content

Commit 4c6068f

Browse files
author
James Brundage
committed
OBS Source Commands - Fixing -NoResponse (Fixes #136)
Also fixing Add vs Set return behaviors
1 parent 9e9bfd9 commit 4c6068f

7 files changed

Lines changed: 19 additions & 6 deletions

Commands/Sources/Set-OBSAudioOutputSource.ps.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function Set-OBSAudioOutputSource
101101
inputName = $myParameters["Name"]
102102
inputKind = "wasapi_output_capture"
103103
inputSettings = $myParameterData
104+
NoResponse = $myParameters["NoResponse"]
104105
}
105106

106107
# If -SceneItemEnabled was passed,

Commands/Sources/Set-OBSBrowserSource.ps.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ function Set-OBSBrowserSource
159159
inputKind = "browser_source"
160160
inputSettings = $myParameterData
161161
inputName = $Name
162+
NoResponse = $myParameters["NoResponse"]
162163
}
163164
# If -SceneItemEnabled was passed,
164165
if ($myParameters.Contains('SceneItemEnabled')) {
@@ -214,7 +215,8 @@ function Set-OBSBrowserSource
214215
}
215216
}
216217
# Otherwise, if we had a result
217-
elseif ($outputAddedResult) {
218+
if ($outputAddedResult -and
219+
$outputAddedResult -isnot [Management.Automation.ErrorRecord]) {
218220
# get the input from the scene.
219221
Get-OBSSceneItem -sceneName $myParameters["Scene"] |
220222
Where-Object SourceName -eq $myParameters["Name"]

Commands/Sources/Set-OBSColorSource.ps.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function Set-OBSColorSource
103103
inputName = $myParameters["Name"]
104104
inputKind = "color_source_v3"
105105
inputSettings = $myParameterData
106+
NoResponse = $myParameters["NoResponse"]
106107
}
107108

108109
# If -SceneItemEnabled was passed,
@@ -159,7 +160,8 @@ function Set-OBSColorSource
159160
}
160161
}
161162
# Otherwise, if we had a result
162-
elseif ($outputAddedResult) {
163+
if ($outputAddedResult -and
164+
$outputAddedResult -isnot [Management.Automation.ErrorRecord]) {
163165
# get the input from the scene.
164166
Get-OBSSceneItem -sceneName $myParameters["Scene"] |
165167
Where-Object SourceName -eq $myParameters["Name"]

Commands/Sources/Set-OBSDisplaySource.ps.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function Set-OBSDisplaySource
9090
inputName = $myParameters["Name"]
9191
inputKind = "monitor_capture"
9292
inputSettings = $myParameterData
93+
NoResponse = $myParameters["NoResponse"]
9394
}
9495

9596
# If -SceneItemEnabled was passed,
@@ -135,7 +136,7 @@ function Set-OBSDisplaySource
135136
# update the input settings
136137
$sceneItem.Input.Settings = $addSplat.inputSettings
137138
$sceneItem # and return the scene item.
138-
$outputAddedResult = $null
139+
$outputAddedResult = $null
139140
}
140141
}
141142

@@ -146,7 +147,8 @@ function Set-OBSDisplaySource
146147
}
147148
}
148149
# Otherwise, if we had a result
149-
elseif ($outputAddedResult) {
150+
if ($outputAddedResult -and
151+
$outputAddedResult -isnot [Management.Automation.ErrorRecord]) {
150152
# get the input from the scene.
151153
Get-OBSSceneItem -sceneName $myParameters["Scene"] |
152154
Where-Object SourceName -eq $name

Commands/Sources/Set-OBSMediaSource.ps.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ function Set-OBSMediaSource
154154
inputKind = "ffmpeg_source"
155155
inputSettings = $myParameterData
156156
inputName = $Name
157+
NoResponse = $myParameters["NoResponse"]
157158
}
158159

159160
if ($myParameters.Contains('SceneItemEnabled')) {
@@ -207,8 +208,9 @@ function Set-OBSMediaSource
207208
$psCmdlet.WriteError($outputAddedResult)
208209
}
209210
}
211+
210212
# Otherwise, if we had a result
211-
elseif ($outputAddedResult) {
213+
if ($outputAddedResult -isnot [Management.Automation.ErrorRecord]) {
212214
# get the input from the scene and optionally fit it to the screen.
213215
Get-OBSSceneItem -sceneName $myParameters["Scene"] |
214216
Where-Object SourceName -eq $name |

Commands/Sources/Set-OBSVLCSource.ps.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ function Set-OBSVLCSource
159159
inputKind = "vlc_source"
160160
inputSettings = $myParameterData
161161
inputName = $Name
162+
NoResponse = $myParameters["NoResponse"]
162163
}
163164

164165
if ($myParameters.Contains('SceneItemEnabled')) {
@@ -212,8 +213,10 @@ function Set-OBSVLCSource
212213
$psCmdlet.WriteError($outputAddedResult)
213214
}
214215
}
216+
215217
# Otherwise, if we had a result
216-
elseif ($outputAddedResult) {
218+
if ($outputAddedResult -and
219+
$outputAddedResult -isnot [Management.Automation.ErrorRecord]) {
217220
# get the input from the scene and optionally fit it to the screen.
218221
Get-OBSSceneItem -sceneName $myParameters["Scene"] |
219222
Where-Object SourceName -eq $name |

Commands/Sources/Set-OBSWindowSource.ps.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ function Set-OBSWindowSource
140140
inputName = $myParameters["Name"]
141141
inputKind = "window_capture"
142142
inputSettings = $myParameterData
143+
NoResponse = $myParameters["NoResponse"]
143144
}
144145

145146
# If -SceneItemEnabled was passed,

0 commit comments

Comments
 (0)