Created
October 19, 2014 20:43
-
-
Save kasperhartwich/91ca61c8d320a6bac59b to your computer and use it in GitHub Desktop.
Channelchanger (windows) for HDHomerun found somewhere on the internet..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Select Channel and Program | |
set /p _channel=Please enter channel: | |
set /p _pro=Please enter program: | |
REM Get your IP address | |
for /f "delims=[] tokens=2" %%a in ('ping -4 %computername% -n 1 ^| findstr "["') do (set thisip=%%a) | |
set "str1=udp://" | |
set "str2=:5000" | |
set "t=%str1%%thisip%%str2%" | |
REM Get your HDHomeRun ID | |
cd C:\Program Files\Silicondust\HDHomeRun | |
for /f "tokens=3" %%a in ('hdhomerun_config discover') do (set hdid=%%a) | |
REM Get status of tuner0 and tuner1 and set tuner number | |
cd C:\Program Files\Silicondust\HDHomeRun | |
for /f "tokens=7" %%a in ('hdhomerun_config %hdid% get /tuner0/status') do (set inuse0=%%a) | |
for /f "tokens=7" %%b in ('hdhomerun_config %hdid% get /tuner1/status') do (set inuse1=%%b) | |
set "str3=tuner" | |
if "%inuse0%" EQU "pps=0" if "%inuse1%" EQU "pps=0" set "_tuner=%str3%0" | |
if "%inuse0%" EQU "pps=0" if "%inuse1%" NEQ "pps=0" set "_tuner=%str3%0" | |
if "%inuse0%" NEQ "pps=0" if "%inuse1%" EQU "pps=0" set "_tuner=%str3%1" | |
if "%inuse0%" NEQ "pps=0" if "%inuse1%" NEQ "pps=0" echo NOTICE: tuner0 and tuner1 are in use. | |
REM Display info and then click to continue | |
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip% | |
pause | |
echo Launching VLC... | |
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000 | |
REM Sleep 2 seconds | |
ping 127.0.0.1 -n 2 >nul | |
cls | |
echo Tuning channel... | |
cd C:\Program Files\Silicondust\HDHomeRun | |
hdhomerun_config %hdid% set /%_tuner%/channel auto:%_channel% | |
hdhomerun_config %hdid% set /%_tuner%/program %_pro% | |
hdhomerun_config %hdid% set /%_tuner%/target %t% | |
REM Sleep 2 seconds | |
ping 127.0.0.1 -n 4 >nul | |
cls | |
echo Displaying Status... | |
echo. | |
HDHomerun_config %hdid% get /%_tuner%/streaminfo | |
HDHomerun_config %hdid% get /%_tuner%/debug | |
REM Sleep | |
ping 127.0.0.1 -n 15 >nul | |
CLS | |
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip% | |
echo Continue to shutdown... | |
echo. | |
pause | |
REM Turn off our tuner twice in case it doesn't work the first time. | |
taskkill /im vlc.exe /f | |
hdhomerun_config %hdid% set /%_tuner%/channel none | |
hdhomerun_config %hdid% set /%_tuner%/target none | |
hdhomerun_config %hdid% set /%_tuner%/channel none | |
hdhomerun_config %hdid% set /%_tuner%/target none |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment