From d01bc9b74e8fb50b3e0e0fb337d3eddc524043d1 Mon Sep 17 00:00:00 2001 From: Joseph Adams Date: Fri, 13 Sep 2024 13:30:56 -0400 Subject: [PATCH] fix tally issue --- UI/package.json | 2 +- UI/src/app/_services/socket.service.ts | 2 +- package.json | 2 +- src/sources/_Source.ts | 54 ++++++++++++++++++++++++-- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/UI/package.json b/UI/package.json index a327b65f..0b477f3f 100644 --- a/UI/package.json +++ b/UI/package.json @@ -1,6 +1,6 @@ { "name": "tallyarbiter-ui", - "version": "3.1.0", + "version": "3.1.1", "scripts": { "prestart": "node git.version.js && cd .. && npm run redundancyjs", "prebuild": "node git.version.js && cd .. && npm run redundancyjs", diff --git a/UI/src/app/_services/socket.service.ts b/UI/src/app/_services/socket.service.ts index 8cf11b46..332019bc 100644 --- a/UI/src/app/_services/socket.service.ts +++ b/UI/src/app/_services/socket.service.ts @@ -236,7 +236,7 @@ export class SocketService { this.outputTypes = outputTypes; this.outputTypeDataFields = outputTypesDataFields; this.busOptions = busOptions; - this.busOptionsVisible = busOptions.filter((b) => b.visible); + this.busOptionsVisible = busOptions.filter((b) => b.visible == true || b.visible == undefined); this.sources = this.prepareSources(sourcesData); this.devices = devicesData; this.deviceSources = deviceSources; diff --git a/package.json b/package.json index ce9a21ec..71950045 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tallyarbiter", - "version": "3.1.0", + "version": "3.1.1", "description": "The flexible and customizable tally system", "keywords": [ "util", diff --git a/src/sources/_Source.ts b/src/sources/_Source.ts index 0d2fa80e..2c471bb8 100644 --- a/src/sources/_Source.ts +++ b/src/sources/_Source.ts @@ -133,6 +133,17 @@ export class TallyInput extends EventEmitter { } protected addBusToAddress(address: string, bus: string) { + //replace bus with its real id if it is "preview" or "program" or "aux" + if (bus === "preview") { + bus = currentConfig.bus_options.find((b) => b.type === "preview").id; + } + else if (bus === "program") { + bus = currentConfig.bus_options.find((b) => b.type === "program").id; + } + else if (bus === "aux") { + bus = currentConfig.bus_options.find((b) => b.type === "aux").id; + } + if (!Array.isArray(this.tallyData[address])) { this.tallyData[address] = []; } @@ -142,6 +153,17 @@ export class TallyInput extends EventEmitter { } protected removeBusFromAddress(address: string, bus: string) { + //replace bus with its real id if it is "preview" or "program" or "aux" + if (bus === "preview") { + bus = currentConfig.bus_options.find((b) => b.type === "preview").id; + } + else if (bus === "program") { + bus = currentConfig.bus_options.find((b) => b.type === "program").id; + } + else if (bus === "aux") { + bus = currentConfig.bus_options.find((b) => b.type === "aux").id; + } + if (!Array.isArray(this.tallyData[address])) { this.tallyData[address] = []; } else { @@ -150,6 +172,17 @@ export class TallyInput extends EventEmitter { } protected removeBusFromAllAddresses(bus: string) { + //replace bus with its real id if it is "preview" or "program" or "aux" + if (bus === "preview") { + bus = currentConfig.bus_options.find((b) => b.type === "preview").id; + } + else if (bus === "program") { + bus = currentConfig.bus_options.find((b) => b.type === "program").id; + } + else if (bus === "aux") { + bus = currentConfig.bus_options.find((b) => b.type === "aux").id; + } + for (const address of Object.keys(this.tallyData)) { this.tallyData[address] = this.tallyData[address].filter((b) => b !== bus); } @@ -173,8 +206,6 @@ export class TallyInput extends EventEmitter { } } - //console.log("realBusses", realBusses); - this.tallyData[address] = realBusses || []; } @@ -191,8 +222,25 @@ export class TallyInput extends EventEmitter { } protected sendIndividualTallyData(address: string, busses: string[]) { + //if bus is "preview" or "program", find its real bus id and use that instead because many source types use those words instead of the actual busId + let realBusses = []; + for (let bus of busses) { + if (bus === "preview") { + realBusses.push(currentConfig.bus_options.find((b) => b.type === "preview").id); + } + else if (bus === "program") { + realBusses.push(currentConfig.bus_options.find((b) => b.type === "program").id); + } + else if (bus === "aux") { + realBusses.push(currentConfig.bus_options.find((b) => b.type === "aux").id); + } + else { + realBusses.push(bus); + } + } + let individualTallyData = {}; - individualTallyData[address] = busses; + individualTallyData[address] = realBusses || []; this.tally.next(individualTallyData); } } \ No newline at end of file