Public/Get-ShellPhishNextShow.ps1
|
function Get-ShellPhishNextShow { <# .SYNOPSIS Finds the next upcoming Phish show and runs show prep automatically. .PARAMETER RecentCount Number of recent shows to include in prep. Default 5. .PARAMETER DelayMs Delay in milliseconds between API calls. Default 500. .EXAMPLE PS C:\> Get-ShellPhishNextShow #> [CmdletBinding()] param ( [Parameter()] [int]$RecentCount = 5, [Parameter()] [int]$DelayMs = 500 ) Write-Verbose "Fetching all Phish shows sorted by date..." $today = (Get-Date).ToString('yyyy-MM-dd') $shows = (Get-ShellPhishShows -Artist phish -OrderBy showdate -Direction asc).data if (-not $shows) { Write-Warning "No shows found" return } $upcoming = $shows | Where-Object { $_.showdate -ge $today } | Sort-Object showdate | Select-Object -First 1 if (-not $upcoming) { Write-Warning "No upcoming shows found after $today" return } Write-Host "Next show: $($upcoming.showdate)" -ForegroundColor Green Get-ShellPhishShowPrep -Date $upcoming.showdate -RecentCount $RecentCount -DelayMs $DelayMs } |