2.8 KiB
Events
Shairport Sync can run programs when certain "events" occur. The events are:
- When Shairport Sync become
activeorinactive. Shairport Sync is normally in theinactivestate when no audio is being played. When audio is sent to Shairport Sync, it will transition frominactivetoactive. When the audio stops, Shairport Sync will start a timer. If audio restarts before the timer reaches the value of theactive_state_timeoutconfiguration setting (10 seconds by default), Shairport Sync will stayactive. However, if no more audio is received before the timer reaches theactive_state_timeoutvalue, Shairport Sync will transition toinactive. The overall effect of this is that Shairport Sync will goactivewhen a track is played and will stay active in the interval between tracks, so long as the interval is less than theactive_state_timeout.- Set the
run_this_before_entering_active_statesetting to the full path name to the program to run before Shairport Sync goesactive. - Set the
run_this_after_exiting_active_statesetting to the full path name to the program to run after Shairport Sync goesinactive. - Set the
active_state_timeoutsetting to the maximum amount of time to wait for play to resume before goinginactive.
- Set the
- When audio starts and stops playing.
- Set the
run_this_before_play_beginssetting to the full path name to the program to run just before Shairport Sync starts playing. - Set the
run_this_after_play_endssetting to the full path name to the program to run after Shairport Sync stops playing.
- Set the
- When the volume is adjusted. Shairport Sync can run a program whenever the volume is set or changed. You specify the full path name to the program to run using the
generalgroup settingrun_this_when_volume_changes.
Set the wait_for_completion value to "yes" for Shairport Sync to wait until the respective commands have been completed before continuing.
Note that the full path to the programs must be specified, and script files will not be executed unless they are marked as executable
and have the appropriate shebang #!/bin/... as the first line. (This behaviour may be different from other Shairports.)
Shairport Sync can run a program whenever the volume is set or changed. You specify it using the general group setting run_this_when_volume_changes.
This is to facilitate situations where something has to be done when the volume changes, e.g. adjust an external mixer value. Set the wait_for_completion value to "yes" for Shairport Sync to wait until the command has been completed before continuing. Again, please note that the full path to the program must be specified, and script files will not be executed unless they are marked as executable and have the appropriate shebang #!/bin/... as the first line.