mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 10:53:51 +00:00
86b2132cdc
Surface {{groupNow.*}} template variables (title, note, colour, times,
custom fields) in the automation template autocomplete so events inside a
group can reference their group. The runtime store already carries
groupNow, so substitution and filters worked already; this makes it
discoverable.
Extend the message-secondary action with an optional text field so an
automation can set the secondary message content, not just its source.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZYPZVdZLWowU7DyzGkWyy
81 lines
2.3 KiB
TypeScript
81 lines
2.3 KiB
TypeScript
import { LogOrigin, OntimeAction } from 'ontime-types';
|
|
import { parseUserTime } from 'ontime-utils';
|
|
|
|
import { logger } from '../../../classes/Logger.js';
|
|
import { auxTimerService } from '../../../services/aux-timer-service/AuxTimerService.js';
|
|
import * as messageService from '../../../services/message-service/message.service.js';
|
|
import { runtimeService } from '../../../services/runtime-service/runtime.service.js';
|
|
|
|
export function toOntimeAction(action: OntimeAction) {
|
|
const actionType = action.action;
|
|
switch (actionType) {
|
|
// Aux timer actions
|
|
case 'aux1-start':
|
|
return auxTimerService.start(1);
|
|
case 'aux1-stop':
|
|
return auxTimerService.stop(1);
|
|
case 'aux1-pause':
|
|
return auxTimerService.pause(1);
|
|
case 'aux1-set': {
|
|
const time = parseUserTime(action.time);
|
|
return auxTimerService.setTime(time, 1);
|
|
}
|
|
case 'aux2-start':
|
|
return auxTimerService.start(2);
|
|
case 'aux2-stop':
|
|
return auxTimerService.stop(2);
|
|
case 'aux2-pause':
|
|
return auxTimerService.pause(2);
|
|
case 'aux2-set': {
|
|
const time = parseUserTime(action.time);
|
|
return auxTimerService.setTime(time, 2);
|
|
}
|
|
case 'aux3-start':
|
|
return auxTimerService.start(3);
|
|
case 'aux3-stop':
|
|
return auxTimerService.stop(3);
|
|
case 'aux3-pause':
|
|
return auxTimerService.pause(3);
|
|
case 'aux3-set': {
|
|
const time = parseUserTime(action.time);
|
|
return auxTimerService.setTime(time, 3);
|
|
}
|
|
|
|
// Playback actions
|
|
case 'playback-start':
|
|
return runtimeService.start();
|
|
case 'playback-stop':
|
|
return runtimeService.stop();
|
|
case 'playback-pause':
|
|
return runtimeService.pause();
|
|
case 'playback-roll':
|
|
return runtimeService.roll();
|
|
|
|
// Message actions
|
|
case 'message-set': {
|
|
messageService.patch({
|
|
timer: {
|
|
text: action.text,
|
|
visible: action.visible,
|
|
},
|
|
});
|
|
break;
|
|
}
|
|
case 'message-secondary': {
|
|
messageService.patch({
|
|
timer: {
|
|
secondarySource: action.secondarySource,
|
|
},
|
|
secondary: action.text,
|
|
});
|
|
break;
|
|
}
|
|
|
|
default: {
|
|
actionType satisfies never;
|
|
logger.warning(LogOrigin.Tx, `Unknown action type: ${actionType}`);
|
|
break;
|
|
}
|
|
}
|
|
}
|