Modify Live TV Buffer Script

Post Reply
User avatar
jerky33

Posts: 31
Joined: Sat Aug 10, 2013 7:38 pm
Location:

HTPC Specs: Show details

Modify Live TV Buffer Script

#1

Post by jerky33 » Wed Jul 23, 2014 5:25 pm

Below is a Powershell script that simplifies changing the registry setting for adjusting MC's Live TV Buffer.

Copy the script code below into a text file and change the extension from .txt to .ps1, then right click the file and choose 'Run with Powershell'

Note: You may need to run the powershell command below to allow the script to work, you can run the optional command below after running the script to set the execution policy back to the default value. To run the two commands below your must open Powershell as an administrator, to do this right click Powershell in the start menu and choose 'Run as Administrator'.


I hope someone finds this useful.

-------------Powershell command--------------
Set-ExecutionPolicy unrestricted -force


-------------Optional Powershell command--------------
Set-ExecutionPolicy restricted -force


-----------------------------------------Script code below this line-----------------------------------------
$dvrReg = 'hklm:SOFTWARE\Microsoft\Windows\CurrentVersion\Media Center\Service\Video\Tuners\DVR'
$running=''

Function WriteBufferToScreen {
$Buffer1 = (Get-ItemProperty -Path $dvrReg).BackingStoreEachFileDurationSeconds
$Buffer2 = (Get-ItemProperty -Path $dvrReg).BackingStoreMaxNumBackingFiles
$BufferSec = ($Buffer1 * $Buffer2)
$BufferMin = ($BufferSec/60)
Write-Host Current buffer is $BufferSec seconds `($BufferMin min`).}

Function SetBuffer ($BTime){
Set-ItemProperty -path $dvrReg -name BackingStoreEachFileDurationSeconds -Value $BTime}

Function WriteUpdateMsg {
Write-Host TV Buffer Updated
Write-Host 'Note: For the changes to take effect you will have to restart Media Center'}

While (($running -ne 'q') -or ($running -ne 'Q')){
Clear-Host
Write-Host
Write-Host 'This script allows you to adjut your Media Center Live TV buffer.'
Write-Host
WriteBufferToScreen
Write-Host
Write-Host 'Select one of the following options then press Enter.'
Write-Host 'Or press Q then Enter to quit.'
Write-Host '1 - 40 minute buffer (default)'
Write-Host '2 - 60 minute (1hr) buffer'
Write-Host '3 - 90 minute (1.5hr) buffer'
Write-Host '4 - 120 minute (2hr) buffer'
Write-Host '5 - 150 minute (2.5hr) buffer'
Write-Host '6 - 180 minute (3hr) buffer'
$running = Read-Host
if (($running -ge 1) -and ($running -le 6)) {
if ($running -eq '1'){Clear-Host;SetBuffer 300;WriteUpdateMsg}
if ($running -eq '2'){Clear-Host;SetBuffer 450;WriteUpdateMsg}
if ($running -eq '3'){Clear-Host;SetBuffer 675;WriteUpdateMsg}
if ($running -eq '4'){Clear-Host;SetBuffer 900;WriteUpdateMsg}
if ($running -eq '5'){Clear-Host;SetBuffer 1125;WriteUpdateMsg}
if ($running -eq '6'){Clear-Host;SetBuffer 1350;WriteUpdateMsg}
WriteBufferToScreen
Write-Host 'Press any key then Enter to continue or Q then Enter to quit.'
$running = Read-Host
}
else {
if (($running -ne 'q') -or ($running -ne 'Q'))
{Write-Host Please select a valid option
Write-Host 'Press any key then Enter to continue or Q then Enter to quit.'
$running1 = Read-Host}
}
}

Post Reply