Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ PAB.command
**/.DS_Store
**/._.DS_Store
radata
node_modules/gun/stats.radata
node_modules/
11 changes: 9 additions & 2 deletions config_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"arena": {
"host": "localhost",
"port": 8090,
"pass": "not used"
"pass": "not used",
"clipA": { "layer": 4, "column": 4 },
"clipB": { "layer": 4, "column": 5 }
},
"propresenter": {
"enabled": true,
"enabled": false,
"host": "localhost",
"port": 1024,
"pass": "stage_default",
Expand All @@ -16,5 +18,10 @@
"peer": "https://gun.filiphanes.sk/gun",
"service": "bible",
"namespace": "default_namespace"
},
"lenverse": {
"enabled": true,
"host": "127.0.0.1",
"port": 5005
}
}
51 changes: 51 additions & 0 deletions lab.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import fs from 'fs';
import fetch from 'node-fetch';
import WebSocket from 'ws';


let config = JSON.parse(fs.readFileSync('./config.json'));
let clip;

async function lenverse_connect() {
if (config.lenverse.enabled !== true) {
console.warn("\n------\nLenVerse Module is disabled!\n------\n");
return;
}
const url = `ws://${config.lenverse.host}:${config.lenverse.port}/current/verse.txt`;
console.log("Connecting to LenVerse ", url);
const ws = new WebSocket(url);

ws.on('open', function open() {
console.log('/current/verse.txt connected')
});

ws.on('error', function (error) {
console.log("LenVerse:", error)
});

ws.on('close', function close() {
console.log('LenVerse: Connection closed, reconnecting ...');
setTimeout(lenverse_connect, 10000);
});

ws.on('message', function message(data) {
const text = data.toString()
// Switch clips
clip = (clip === config.arena.clipA) ? config.arena.clipB : config.arena.clipA;
console.log(text);
fetchArena('PUT', `/api/v1/composition/layers/${clip.layer}/clips/${clip.column}`,
JSON.stringify({ "video": { "sourceparams": { "Text": text } } }))
fetchArena('POST', `/api/v1/composition/layers/${clip.layer}/clips/${clip.column}/connect`, '')
});
}

async function fetchArena(method, path, body) {
await fetch(`http://${config.arena.host}:${config.arena.port}${path}`, {
method: method,
body: body,
headers: { 'Content-Type': 'application/json' },
});
}

console.log('config', config);
lenverse_connect()
235 changes: 0 additions & 235 deletions node_modules/.package-lock.json

This file was deleted.

21 changes: 0 additions & 21 deletions node_modules/@peculiar/asn1-schema/LICENSE

This file was deleted.

Loading