MythTV System Events are a new feature in MythTV 0.23. Historically MythEvents have been used to communicate between components of the system when blocking was not required for proper operation. Now it is possible for the end user to tap into a number of events as well as defining up to ten keypress events. These events are handled by running an external script with appropriate parameters. MythTV System Events are configured on a per box basis so each machine can have it's own system specific handlers.

MythTV System Events are a new feature in MythTV 0.23. Historically MythEvents have been used to communicate between components of the system when blocking was not required for proper operation. Now it is possible for the end user to tap into a number of events as well as defining up to ten keypress events. These events are handled by running an external script with appropriate parameters. MythTV System Events are configured on a per box basis so each machine can have it's own system specific handlers.

+

+

== Available Events ==

These are the currently defined events:

These are the currently defined events:

+

* Recording pending

* Recording pending

* Recording started

* Recording started

Revision as of 01:48, 11 April 2010

MythTV System Events are a new feature in MythTV 0.23. Historically MythEvents have been used to communicate between components of the system when blocking was not required for proper operation. Now it is possible for the end user to tap into a number of events as well as defining up to ten keypress events. These events are handled by running an external script with appropriate parameters. MythTV System Events are configured on a per box basis so each machine can have it's own system specific handlers.

These events are all sent automatically when the appropriate condition is met, but it is also possible to send events from the command line, for example:

mythbackend --systemevent USER_1

sends the first user event to whatever handler has been defined for that event.

Defining event handlers

Events handlers are edited in the System Events section in mythtv-setup. Select the event you would like to edit in the event list and then type in the script path and name followed by any parameters that you would like to pass to the script. For example to run a script whenever a recording is pending you could select the "Recording pending" event and type:

/opt/bin/RecordingPending.sh %STARTTIME%

That script could be a priming script to get a set top box out of it's sleep mode:

%RECSTATUS% -- Recording status as an integer for completeness, not currently useful.

%RECTYPE% -- This is the recording rule type as an integer, in the priming script example this could be used to do an extensive priming prior to some recordings and not others. These integers are listed in recordingtypes.h in the RecordingType enum.

%REACTIVATE% -- 1 if this recording was reactivated after failing to start on time, 0 otherwise.

With time parameters, the first listed is in locale time & format suitable for user display, the second is in locale time & ISO format suitable for some scripts, the third is in UTC time & ISO format suitable for some script and generally preferred for scripts to avoid daylight savings issues. Parameters that may be undefined should be quoted to avoid parameter aliasing bugs.