Back when I was working for a living, I was something of a PowerShell-aholic. Whenever I want to do some ad-hoc data manipulation, it tends to be my tool of choice. It's more than a "task automation tool". It's a tool for manipulating objects and streams/collections of objects. It's also a good way to play around with .Net.
This will define a function that can be used to fetch the guide data:
function Get-CdvrGuideData(
[parameter(position=0)][long]$Days=16,
[parameter(position=1)][datetime]$Start=[datetime]::Now.Date,
[parameter()][string]$Server='localhost',
[parameter()][string]$Provider='ANY'
)
{
$sw = [System.Diagnostics.Stopwatch]::StartNew()
$unixEpoch = [datetime]::SpecifyKind('1/1/1970', 'UTC')
$startTime = [long]($Start.ToUniversalTime() - $unixEpoch).TotalSeconds
$duration = $Days * 86400
$uri = 'http://{0}:8089/devices/{1}/guide?time={2}&duration={3}' -f $Server,$Provider,$startTime,$duration
(Invoke-RestMethod -Method Get -Uri $uri).Airings | % {
$_ | Add-Member NoteProperty ChannelNum ([decimal]$_.Channel)
$_ | Add-Member NoteProperty StartTime ($unixEpoch.AddSeconds($_.Time).ToLocalTime())
$_
} | sort Time,ChannelNum
$sw.Stop()
Write-Verbose ('Elapsed: ' + $sw.Elapsed.ToString())
}
Use the -Server option to specify the name or IP address of the DVR server if it is running on a different computer.
Use the -Start and/or -Days options if you don't want to fetch all of the guide data.
This command will fetch the guide data and store it in a variable named $guideData. It will take a couple of minutes to get all of the guide data.
$guideData = Get-CdvrGuideData
This command will filter the first-episodes and store the result in a variable named $firstEpisodes.
$firstEpisodes = $guideData | ? { $_.SeasonNumber -eq 1 -and $_.EpisodeNumber -eq 1 }
This command will display the results in a grid view. ("ogv" is an abbreviation for Output-GridView.) You can do additional filtering in the grid view.
$firstEpisodes | ogv