mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 00:13:53 +00:00
feat: osc goto
- renamed previous goto to gotoid
This commit is contained in:
@@ -461,18 +461,15 @@ class EventTimer extends Timer {
|
||||
|
||||
if (eventIndex === -1) return;
|
||||
this.pause();
|
||||
this.loadEvent(eventIndex);
|
||||
|
||||
this.broadcastState();
|
||||
this.loadEvent(eventIndex, true, true);
|
||||
}
|
||||
|
||||
// Loads a given event
|
||||
// load timers
|
||||
// load selectedEventIndex
|
||||
// load titles
|
||||
loadEvent(eventIndex, type = 'load') {
|
||||
loadEvent(eventIndex, type = 'load', broadcastChange = 'false') {
|
||||
const e = this._eventlist[eventIndex];
|
||||
|
||||
if (e == null) return;
|
||||
|
||||
const start = e.timeStart == null || e.timeStart === '' ? 0 : e.timeStart;
|
||||
@@ -503,6 +500,10 @@ class EventTimer extends Timer {
|
||||
|
||||
// look for event after
|
||||
this._loadTitlesNext();
|
||||
|
||||
if (broadcastChange)
|
||||
// broadcast current state
|
||||
this.broadcastState();
|
||||
}
|
||||
|
||||
_loadTitlesNow() {
|
||||
|
||||
@@ -20,7 +20,7 @@ const initiateOSC = (config) => {
|
||||
if (address !== 'ontime') return;
|
||||
|
||||
// get second part (command)
|
||||
switch (path) {
|
||||
switch (path.toLocaleLowerCase()) {
|
||||
case 'start':
|
||||
case 'play':
|
||||
console.log('calling play');
|
||||
@@ -60,6 +60,16 @@ const initiateOSC = (config) => {
|
||||
break;
|
||||
case 'goto':
|
||||
console.log('calling goto with', args);
|
||||
try {
|
||||
let eventIndex = parseInt(args);
|
||||
if (isNaN(eventIndex) || eventIndex <= 0) return;
|
||||
global.timer.loadEvent(eventIndex - 1, undefined, true);
|
||||
} catch (error) {
|
||||
console.log('error calling goto: ', error);
|
||||
}
|
||||
break;
|
||||
case 'gotoid':
|
||||
console.log('calling gotoid with', args);
|
||||
try {
|
||||
global.timer.loadEventById(args.toLowerCase());
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user