PDA

View Full Version : Using Girder with DVBLink



ceeps
October 2nd, 2010, 08:25 AM
I use a program called DVBlink that I would like to use to change channels on my dishnet receiver via a usb-uirt cable.
DVBlink runs a .cmd file where I should be able to call up girder to send the ir commands through the uirt cable, but I am not too sure exactly how to do this. I was looking at the help file concerning event.exe and I am guessing that this is how I need to go about doing it, but I need a little help. Basically the .cmd file needs to send a string containing the channel number to girder so it can change channels. Here is the line of the .cmd file that is suppose to call up a program to change channels, right now it is set up to use HaupBlast.exe with a string containing the channel number to send:

:: TODO Forward the call to your tuning software
echo Changing channel to #%SHORT_CHANNEL_NUMBER% (%FULL_CHANNEL_NUMBER%) >> %~n0.log
call ..\HaupBlast.exe %SHORT_CHANNEL_NUMBER%

I would like to configure it to send the commands through girder to change channels with my usb-uirt device. Any help would be greatly appreciated.

Thanks

EDIT:

I've made some progress with my issue. Here is the .cmd file that runs when DVBLink attempts to change channels. I need help understanding the proper syntax, or method to link to GIRDER and have it send the IR commands that I had GIRDER learn for my IR Profile. Here is the complete code from the .cmd file I am using:

@echo off
:: ================================================== ==========================
:: This hook is called to change the channel when the IR Blasting options is
:: set to "Hook" in HDPVRBridge Properties.
:: ================================================== ==========================
:: To install this file as a hook, rename it to change-channel.cmd and
:: place it under %ProgramFiles%\Dvblogic\Dvblink\Data\<yoursource>\hooks\
::
:: Then choose "Hook" in the blasting method withing "HDPVRBridge Properties"
:: ================================================== ==========================
:: Arguments:
:: %0 : Fully qualified pathname of this batch file
:: %1 : Channel to tune. No leading zeros. Examples: 6, 76, 602
:: Return value:
:: Set ERRORLEVEL to 0 if everything is ok.
:: Set ERRORLEVEL different than 0 to indicate an error.
:: ================================================== ==========================
:: This file is an example of a hook that change the channel.
::
:: For the sake of this example, it forwards the channel change to HaupBlast
:: (using internal HDPVR IR Blaster).
::
:: Look for TODO tags to adapt it to your own tuning method.
:: ================================================== ==========================
:: Development/Debugging notes:
:: - First start by testing your CMD file without HDPVRBridge. Just open a
:: CMD.EXE window and call this CMD file manually with the proper arguments.
::
:: - HDPVRBridge will wait for a maximum of 5 seconds for this batch to
:: completes. If it doesn't, it terminates the spawned process (this CMD
:: file process). However, be aware that YOUR TUNING software launched by
:: this CMD file WILL NOT be terminated by HDPVRBridge. If your tuning
:: software hangs while keeping exclusive access to the tuning ressources
:: there might be no other way out of this state other than manually
:: killing the spawned tuning software.
:: You can try preventing this by downloading PSTOOLS from Windows Internals
:: and using PSKILL to kill any remaining tuning process before launching
:: it from inside this CMD file.
::
:: - Because of the 'exit' statements at the end of the batch, calling it
:: from a CMD window will close the window. To avoid this, you have two
:: choices:
:: a) From the prompt, use call statement:
:: ex: call change-channel.cmd 2
:: b) Change the exit statement for a exit /b statement. HOWEVER NO NOT
:: forget to remove the /b when using it with HDPVRBridge because
:: otherwise errors wont be received by HDPVRBridge.
:: - (b) option above is easier for debugging because you can actually see
:: the output of your batch file. If you use (a), you can add a PAUSE
:: statement at the end of the batch. However DO NOT forget to remove the
:: PAUSE statement before using it with HDPVRBridge.
:: - A third debugging tip with (a) option above is to just log more details
:: into the log file generated by this CMD file.
:: ================================================== ==========================

:: Change directory to the location of this CMD file.
pushd %~dp0

:: Print some debugging info in a log file named after this CMD file
FOR /f "tokens=*" %%G IN ('date /t') DO set CURDATE=%%G
FOR /f "tokens=*" %%G IN ('time /t') DO set CURTIME=%%G
echo [%CURDATE% %CURTIME%] %~n0 %* >> %~n0.log

:: Get the CMD file parameters
set SEPERATOR_NEEDED=.
set SHORT_CHANNEL_NUMBER=%1

:: Find if there is a Sub Channel involved and if it is the case, decorticate it into
:: its individual values: SUB_CHANNEL_NUMBER and CHANNEL_NUMBER and IS_SUB_CHANNEL
set IS_SUB_CHANNEL=0
for /f "usebackq" %%i in (`echo %SHORT_CHANNEL_NUMBER%` ^| find /c "."`) do set IS_SUB_CHANNEL=%%i
for /f "tokens=1 usebackq delims=." %%i in (`echo %SHORT_CHANNEL_NUMBER%`) do set CHANNEL_NUMBER=%%i
set SUB_CHANNEL_NUMBER=
if '%IS_SUB_CHANNEL%'=='1' set SUB_CHANNEL_NUMBER=%SHORT_CHANNEL_NUMBER:*.=%

:: Replace dot in 700.2 with the desired seperator
call set SHORT_CHANNEL_NUMBER=%%SHORT_CHANNEL_NUMBER:.=%SEP ERATOR_NEEDED%%%

:: Fill a 'full channel number' with leading zeros, up to a maximum of 4 digits
:: Some tuning software might need this "full number", other don't
set FULL_CHANNEL_NUMBER=0000%CHANNEL_NUMBER%
set FULL_CHANNEL_NUMBER=%FULL_CHANNEL_NUMBER:~-4%
if '%IS_SUB_CHANNEL%'=='1' set FULL_CHANNEL_NUMBER=%FULL_CHANNEL_NUMBER%%SEPERATO R_NEEDED%%SUB_CHANNEL_NUMBER%

:: If %1 is 10.2, and SEPERATOR_NEEDED is '-' then:
:: SHORT_CHANNEL_NUMBER=10-2
:: IS_SUB_CHANNEL=1
:: SUB_CHANNEL_NUMBER=2
:: CHANNEL_NUMBER=10
:: FULL_CHANNEL_NUMBER=010-2
echo SHORT_CHANNEL_NUMBER = %SHORT_CHANNEL_NUMBER%
echo FULL_CHANNEL_NUMBER = %FULL_CHANNEL_NUMBER%
echo CHANNEL_NUMBER = %CHANNEL_NUMBER%
echo IS_SUB_CHANNEL = %IS_SUB_CHANNEL%
echo SUB_CHANNEL_NUMBER = %SUB_CHANNEL_NUMBER%

:: Decompose the numbers

set FOURTH_CHANNEL_NUMBER=0
set FOURTH_CHANNEL_NUMBER=%SHORT_CHANNEL_NUMBER:~-1%
echo FOURTH_CHANNEL_NUMBER = %FOURTH_CHANNEL_NUMBER%

set THIRD_CHANNEL_NUMBER=0
set /a THIRD_CHANNEL_NUMBER=%FULL_CHANNEL_NUMBER:~-2%-%FOURTH_CHANNEL_NUMBER%
if %THIRD_CHANNEL_NUMBER% lss 0 set SECOND_CHANNEL_NUMBER=0
set /a THIRD_CHANNEL_NUMBER=%THIRD_CHANNEL_NUMBER%/10
echo THIRD_CHANNEL_NUMBER = %THIRD_CHANNEL_NUMBER%

set SECOND_CHANNEL_NUMBER=0
set /a SECOND_CHANNEL_NUMBER=%SHORT_CHANNEL_NUMBER:~-3%-%FOURTH_CHANNEL_NUMBER%-%THIRD_CHANNEL_NUMBER%
if %SECOND_CHANNEL_NUMBER% lss 0 set SECOND_CHANNEL_NUMBER=0
set /a SECOND_CHANNEL_NUMBER=%SECOND_CHANNEL_NUMBER%/100
echo SECOND_CHANNEL_NUMBER = %SECOND_CHANNEL_NUMBER%

set FIRST_CHANNEL_NUMBER=0
set /a FIRST_CHANNEL_NUMBER=%SHORT_CHANNEL_NUMBER:~-4%-%FOURTH_CHANNEL_NUMBER%-%THIRD_CHANNEL_NUMBER%-%SECOND_CHANNEL_NUMBER%
if %FIRST_CHANNEL_NUMBER% lss 0 set FIRST_CHANNEL_NUMBER=0
set /a FIRST_CHANNEL_NUMBER=%FIRST_CHANNEL_NUMBER%/1000
echo FIRST_CHANNEL_NUMBER = %FIRST_CHANNEL_NUMBER%

:: TODO Forward the call to your tuning software
echo Changing channel to #%SHORT_CHANNEL_NUMBER% (%SHORT_CHANNEL_NUMBER%) >> %~n0.log

::Check How Many Digits

if %FIRST_CHANNEL_NUMBER% GTR 0 goto :FOUR
if %SECOND_CHANNEL_NUMBER% GTR 0 goto :THREE
if %THIRD_CHANNEL_NUMBER% GTR 0 goto :TWO
goto :ONE

:FOUR

call "C:\udpsender.exe" 33333 1.%FIRST_CHANNEL_NUMBER%

:THREE

call "C:\udpsender.exe" 33333 1.%SECOND_CHANNEL_NUMBER%

:TWO

call "C:\udpsender.exe" 33333 1.%THIRD_CHANNEL_NUMBER%

:ONE

call "C:\udpsender.exe" 33333 1.%FOURTH_CHANNEL_NUMBER%

:: TODO Check ERRORLEVEL returned by the tuning software
if '%ERRORLEVEL%'=='0' goto :END
goto :ERROR


:: Jump here with a GOTO to report an error
:ERROR
echo Error changing channel, ERRORLEVEL=%ERRORLEVEL% >> %~n0.log
exit /b

:: Jump here with a GOTO for a success
:END
echo Channel changed successfully >> %~n0.log
exit
************************************************** ***********************

Right now the above file is set to work with eventghost using udpsender as and intermediary because for some reason eventghost can't be called directly from a .cmd file. Which is why I would like to use girder instead. So the above file will split full 4, 3, or 2 digits channel numbers into individual numbers so the commands can be sent individualy thus the channel number 5645 is split up into 5, 6, 4 and 5. For channel number 5465 the file will generate the values: 1.5, 1.4, 1.6 and 1.5. I added the "1." because I have another tuner that will have a leading "2." so the codes for the 2 different tuners can be distinguished.

All I need now is to figure out how to send the 1.5, 1.4, 1.6 and 1.5 etc. values to girder and have it send the corresponding IR codes to the usb-uirt. Thanks again for anyone willing to help.

-c