How to use hooks?
February 11th, 2010
Hooks are ways to customize your installation. They are scripts that you have to write, which will be called automatically when certain events occur.
The entry-point script HAS to be a “Windows DOS” script. But, within this first script you can call any software you like, may it be other scripts (Perl, PowerShell, etc.) or 3rd party software).
Notes:
- Sample hooks are supplied with the software. You can start from them to build your own customizations.
- Your customized hook files HAVE to be located in your \Data\<yoursource>\hooks\ folder to be found and lunched by the software.
- If the software finds a hook with the right name at the right location, it launches it automatically. No need to enable anything special (except for the change-channel.cmd hook).
- You can enable verbose logging of DVBLink for HDPVR to get additional hook debugging information in your output.log file.
Development Notes:
- It is highly recommended to test/dry-run and debug your customized hooks manually. Just open a Command window and change the directory to your hooks location and call them from the Command Prompt.
- To have a re-producible environment, your hooks should always start by changing the Current Directory to a known location. For instance, the supplied sample hooks set the Current Directory to the folder where the hook file is located (pushd %~dp0)
- It is important not to stall the DVBLink thread that calls the hook for too long. The software implements an internal timer and will kill your script if it stalls for too long. Your software and or script may then be left in an undetermined state.
The hooks:
- change-channel.cmd
- This hook is used to customize your channel changing technique at your will.
- The hook has to be enabled in the Source Properties, in the Blaster Configuration tab. If enable but not found, an error will be logged. If not enable, it will not be called.
- The hook has 5 seconds to complete, after which it will be terminated.
- The hook is called with the first parameter being the channel to switch to. The channel has no leading zeros, no enter key, no prefix key. The sub-channel separator digit is a dot (.). Examples:
- change-channel 55.1
- change-channel 700
- change-channel 2
- change-channel 1802
- on-idle.cmd
- This hook is called before entering idle mode and when exiting it.
- The hook is called automatically if found.
- The hook has 5 seconds to complete, after which it will be terminated.
- The hook is called with the first parameter being either 0 or 1. 1 when entering idle mode. 0 when exiting idle mode. Examples:
- on-idle 1
- on-idle 0
- on-standby.cmd
- This hook is called before the computer is put in standby/sleep and when the computer resumes from standby/sleep.
- The hook is called automatically if found.
- The hook has 5 seconds to complete, after which it will be terminated.
- The hook is called with the first parameter being either 0 or 1. 1 when entering standby. 0 when resuming. Examples:
- on-standby 1
- on-standby 0
- on-device-error-power-cycle.cmd
- This hook is called when the devices has crashed beyond recovery and needs to be power cycled. The hook triggering condition is VERY SPECIFIC; only a specific crash will fire this hook. You will not be able to reproduce the conditions manually to have it triggered, other than having the specific crash (issued ERRORABORT error messages in output.log)
- The hook is called automatically if found.
- The hook has 30 seconds to complete, after which it will be terminated.
- No parameters are passed-on to this hook.
