mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
Merge remote-tracking branch 'origin/master' into v1
This commit is contained in:
@@ -163,7 +163,6 @@ export const startServer = async (overrideConfig = null) => {
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
export const shutdown = async () => {
|
||||
console.log('Node service shutdown');
|
||||
// shutdown express server
|
||||
server.close();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Server } from 'node-osc';
|
||||
let oscServer = null;
|
||||
|
||||
/**
|
||||
* @description utilty function to shutdown osc server
|
||||
* @description utility function to shut down osc server
|
||||
*/
|
||||
export const shutdownOSCServer = () => {
|
||||
if (oscServer != null) oscServer.close();
|
||||
@@ -23,7 +23,7 @@ export const initiateOSC = (config) => {
|
||||
// message should look like /ontime/{path}/{args} where
|
||||
// ontime: fixed message for app
|
||||
// path: command to be called
|
||||
// args: extra data, only used on some of the API entries (delay, goto)
|
||||
// args: extra data, only used on some API entries (delay, goto)
|
||||
|
||||
// split message
|
||||
const [, address, path] = msg[0].split('/');
|
||||
@@ -145,6 +145,12 @@ export const initiateOSC = (config) => {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'get-playback': {
|
||||
const playback = global.timer.state;
|
||||
global.timer.sendOsc('playback', playback);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
global.timer.warning('RX', `OSC IN: unhandled message ${path}`);
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ontime-server",
|
||||
"type": "module",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.2",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.20.0",
|
||||
"dotenv": "^16.0.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import jest from 'jest-mock';
|
||||
import { dbModel } from '../../models/dataModel.js';
|
||||
import { isStringEmpty, parseExcel, parseJson, validateEvent } from '../parser.js';
|
||||
import { parseExcel, parseJson, validateEvent } from '../parser.js';
|
||||
import { makeString, validateDuration } from '../parserUtils.js';
|
||||
import { parseAliases, parseUserFields, parseViews } from '../parserFunctions.js';
|
||||
|
||||
@@ -886,24 +886,3 @@ describe('test validateDuration()', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('isStringEmpty() function', () => {
|
||||
describe('returns true with any non empty', () => {
|
||||
const notEmpty = ['test', 'thisalso', '123', '#'];
|
||||
for (const testValue of notEmpty) {
|
||||
it(testValue, () => {
|
||||
const isEmpty = isStringEmpty(testValue);
|
||||
expect(isEmpty).toBe(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
describe('returns true empty string or undefined', () => {
|
||||
const empty = ['', ' ', undefined, null];
|
||||
for (const testValue of empty) {
|
||||
it(`handles ${testValue}`, () => {
|
||||
const isEmpty = isStringEmpty(testValue);
|
||||
expect(isEmpty).toBe(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,19 +19,6 @@ import { generateId } from './generate_id.js';
|
||||
export const EXCEL_MIME = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
|
||||
export const JSON_MIME = 'application/json';
|
||||
|
||||
/**
|
||||
* @description Whether a string is considered empty
|
||||
* @param value
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isStringEmpty = (value) => {
|
||||
let v = value;
|
||||
if (typeof value === 'string') {
|
||||
v = value.replace(/\s+/g, '');
|
||||
}
|
||||
return v === '' || !v;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Excel array parser
|
||||
* @param {array} excelData - array with excel sheet
|
||||
@@ -102,9 +89,9 @@ export const parseExcel = async (excelData) => {
|
||||
} else if (j === subtitleIndex) {
|
||||
event.subtitle = column;
|
||||
} else if (j === isPublicIndex) {
|
||||
event.isPublic = isStringEmpty(column);
|
||||
event.isPublic = Boolean(column);
|
||||
} else if (j === skipIndex) {
|
||||
event.skip = isStringEmpty(column);
|
||||
event.skip = Boolean(column);
|
||||
} else if (j === notesIndex) {
|
||||
event.note = column;
|
||||
} else if (j === colourIndex) {
|
||||
|
||||
Reference in New Issue
Block a user