Skip to content

Commit

Permalink
Adding $obs
Browse files Browse the repository at this point in the history
Fixes #157, Fixes #158, Fixes #159
  • Loading branch information
James Brundage committed Sep 29, 2023
1 parent 017a4f5 commit f9c3ebc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
20 changes: 1 addition & 19 deletions Commands/Get-OBS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,5 @@ function Get-OBS
#>
param()

if (-not $script:OBSProcess) {
$script:OBSProcess = Get-Process obs* | Where-Object Name -in 'obs', 'obs64', 'obs32'
}

if (-not $script:OBSProcess) {
Write-Error "OBS is not running"
return
}

if (-not $script:ObsConnections) {
Write-Error "Not connected to OBS, use Connect-OBS"
return
}

[PSCustomObject][Ordered]@{
PSTypeName = 'OBS.PowerShell'
Process = $script:OBSProcess
Connections = $script:ObsConnections.Values
}
$script:OBS
}
1 change: 1 addition & 0 deletions Types/OBS.PowerShell/get_Connection.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
& $this { $script:OBSConnections }
4 changes: 4 additions & 0 deletions Types/OBS.PowerShell/get_Process.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Get-Process obs* |
Sort-Object { $_.Name -in 'obs', 'obs64', 'obs32' } |
Where-Object Name -in 'obs', 'obs64', 'obs32'

8 changes: 7 additions & 1 deletion obs-powershell.ps.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ foreach ($noun in 'Streaming','Recording') {

Connect-OBS

$MyInvocation.MyCommand.ScriptBlock.Module | Import-OBSEffect
$script:OBS = ${script:OBS-PowerShell} = $MyInvocation.MyCommand.ScriptBlock.Module

$script:OBS | Import-OBSEffect

$script:OBS.pstypenames.insert(0,'obs-powershell')

Export-ModuleMember -Function * -Variable obs,obs-powershell -Alias *

0 comments on commit f9c3ebc

Please sign in to comment.