Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #294

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e6ae5d0
fix: vMix connection - check if vMix channel is assigned to a fader
olzzon Oct 13, 2023
36604fb
fix: update ruby pgm from external update
mint-dewit Nov 1, 2023
5d8a651
fix: ruby amix subscription
mint-dewit Nov 21, 2023
8cb832f
chore: update variable name
mint-dewit Nov 22, 2023
3328800
fix: PFL follows ch-strip crash on midas, as PFL is not available on …
olzzon Nov 22, 2023
3a112b7
Merge pull request #288 from tv2/fix/ch-strip-follows-pfl-crash-on-midas
olzzon Dec 2, 2023
ae3e9d6
Merge pull request #286 from nrkno/fix/ruby-subscriptions
olzzon Dec 2, 2023
e89fefe
feat: Option to serve client on a different path
PeterC89 Jan 17, 2024
cd5f44b
fix: Use root path for socket.io server
PeterC89 Jan 18, 2024
e4e75f2
docs: Fix Readme formatting
PeterC89 Jan 18, 2024
f61c3be
Merge pull request #289 from bbc/feat/rootUrl
KvelaGorrrrnio Jan 18, 2024
dcb715b
chore(deps): bump postcss from 8.4.23 to 8.4.33
dependabot[bot] Jan 23, 2024
bc2c55f
chore(deps): bump semver from 5.7.1 to 5.7.2
dependabot[bot] Jan 23, 2024
0614e3a
Merge pull request #269 from tv2/dependabot/npm_and_yarn/semver-5.7.2
KvelaGorrrrnio Jan 23, 2024
651d0c9
Merge pull request #290 from tv2/dependabot/npm_and_yarn/postcss-8.4.33
KvelaGorrrrnio Jan 23, 2024
577a917
fix: consistent storage path
mint-dewit Jan 24, 2024
4ed7d48
fix(Lawo Ruby): use callback to dispatch input selector update
mint-dewit Jan 24, 2024
7ffe263
fix: robustness while updating channels
mint-dewit Jan 24, 2024
0f2c798
fix: fader.assignedChannels may be undefined in UI
mint-dewit Jan 24, 2024
ef4647e
fix: create all channels on first start
mint-dewit Jan 24, 2024
d681520
fix: route 1:1 when initialising faders
mint-dewit Jan 24, 2024
e361bf4
Merge pull request #295 from SuperFlyTV/fix/sisyfos-init-procedure
olzzon Jan 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ When running Sisyfos you can define the log level by setting the environment var
- debug (info level plus: data send and received from Audiomixer)
- trace (debug level plus: data send and received from Automation protocol)

### Serve client on a different path:

When running Sisyfos you can change the root path from the default of `/` to another value by setting the environment variable `ROOT_PATH`.


### Open GUI in browser:

```
Expand Down
7 changes: 6 additions & 1 deletion client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ const unsubscribe = window.storeRedux.subscribe(() => {
window.reduxState = window.storeRedux.getState()
})

window.socketIoClient = io()
const { pathname } = window.location
const socketServerPath =
pathname + (pathname.endsWith('/') ? '' : '/') + 'socket.io/'
window.socketIoClient = io({
path: socketServerPath,
})
window.socketIoClient.emit(SOCKET_GET_SNAPSHOT_LIST)
window.socketIoClient.emit(SOCKET_GET_CCG_LIST)
window.socketIoClient.emit(SOCKET_GET_MIXER_PRESET_LIST)
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ChannelRouteSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class ChannelRouteSettings extends React.PureComponent<

getAssignedToFaderIndex = (channel: IChannelReference): number => {
let assignedFaderIndex = -1
this.props.fader.forEach((fader: any, index: number) => {
this.props.fader.forEach((fader, index: number) => {

if (fader.assignedChannels.some((assignedChan: IChannelReference) => {
if (fader.assignedChannels?.some((assignedChan: IChannelReference) => {
return assignedChan.channelIndex === channel.channelIndex && assignedChan.mixerIndex === channel.mixerIndex
}))
assignedFaderIndex = index
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@tv2media/logger": "^2.0.1",
"atem-connection": "^3.2.0",
"casparcg-connection": "^5.1.0",
"emberplus-connection": "^0.1.2",
"emberplus-connection": "^0.2.1",
"express": "^4.18.2",
"node-emberplus": "^3.0.5",
"node-vmix": "^1.6.1",
Expand All @@ -36,4 +36,4 @@
"webmidi": "^2.5.1",
"shared": "file:../shared"
}
}
}
2 changes: 2 additions & 0 deletions server/src/MainThreadHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class MainThreadHandlers {
}

updatePartialStore(faderIndex: number) {
if (faderIndex >= state.settings[0].numberOfFaders) return

socketServer.emit(IO.SOCKET_SET_STORE_FADER, {
faderIndex: faderIndex,
state: state.faders[0].fader[faderIndex],
Expand Down
11 changes: 8 additions & 3 deletions server/src/expressHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ import express from 'express'
import path from 'path'
import { Server } from 'http'
import { Server as SocketServer } from 'socket.io'
const ROOT_PATH = process.env.ROOT_PATH ?? '/'
const SOCKET_SERVER_PATH =
ROOT_PATH + (ROOT_PATH.endsWith('/') ? '' : '/') + 'socket.io/'
const app = express()
const server = new Server(app)
const socketServer = new SocketServer(server)
const socketServer = new SocketServer(server, {
path: SOCKET_SERVER_PATH,
})
const SERVER_PORT = 1176
const staticPath = path.join(
path.dirname(require.resolve('client/package.json')),
'dist'
)
logger.data(staticPath).debug('Express static file path:')
app.use('/', express.static(staticPath))
app.use(ROOT_PATH, express.static(staticPath))
server.listen(SERVER_PORT)
logger.info(`Server started at http://localhost:${SERVER_PORT}`)
logger.info(`Server started at http://localhost:${SERVER_PORT}/${ROOT_PATH}`)

socketServer.on('connection', (socket: any) => {
logger.info(`Client connected: ${socket.client.id}`)
Expand Down
11 changes: 9 additions & 2 deletions server/src/utils/SettingsStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { defaultFadersReducerState } from '../../../shared/src/reducers/fadersRe
import {
IChannels,
InumberOfChannels,
defaultChannelsReducerState,
} from '../../../shared/src/reducers/channelsReducer'

import {
Expand Down Expand Up @@ -107,11 +108,17 @@ export const loadSnapshotState = (
if (fileName.includes('default.shot')) {
store.dispatch(
storeSetCompleteFaderState(
defaultFadersReducerState(numberOfFaders)[0],
defaultFadersReducerState(numberOfFaders, numberOfChannels)[0],
numberOfFaders
)
)
logger.data(error).error('Initializing empty faders')
store.dispatch(
storeSetCompleteChState(
defaultChannelsReducerState(numberOfChannels)[0],
numberOfChannels
)
)
logger.data(error).error('Initializing empty faders/channels')
} else {
logger.data(error).error('Error loading Snapshot')
}
Expand Down
46 changes: 23 additions & 23 deletions server/src/utils/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import path from 'path'

import { logger } from './logger'
import { ISettings } from '../../../shared/src/reducers/settingsReducer'
import { getSnapShotList, IShotStorage } from './SettingsStorage'
import { getSnapShotList, IShotStorage, STORAGE_FOLDER } from './SettingsStorage'

const version = process.env.npm_package_version
const settingsPath: string = path.resolve(process.cwd(), 'storage')

export const checkVersion = (currentSettings: ISettings): ISettings => {
if (
Expand Down Expand Up @@ -34,39 +33,40 @@ const migrate45to47 = (currentSettings: ISettings): ISettings => {
files.push('default.shot')

files.forEach((fileName: string) => {
let stateFromShot = JSON.parse(
fs.readFileSync(path.join(settingsPath, fileName), 'utf8')
)
// As this is the first implemented migration it also looks .shot files from ealier versions than 4.xx
if (stateFromShot.channelState.chConnection) {
// From Version 4.xx
stateFromShot.channelState.chMixerConnection =
stateFromShot.channelState?.chConnection
delete stateFromShot.channelState.chConnection
} else if (stateFromShot.channelState.channel) {
// Version lower than 4.0
stateFromShot.channelState.chMixerConnection = [
{ channel: stateFromShot.channelState.channel },
]
delete stateFromShot.channelState.channel
}
let migratedShot: IShotStorage = stateFromShot
try {
let stateFromShot = JSON.parse(
fs.readFileSync(path.join(STORAGE_FOLDER, fileName), 'utf8')
)
// As this is the first implemented migration it also looks .shot files from ealier versions than 4.xx
if (stateFromShot.channelState.chConnection) {
// From Version 4.xx
stateFromShot.channelState.chMixerConnection =
stateFromShot.channelState?.chConnection
delete stateFromShot.channelState.chConnection
} else if (stateFromShot.channelState.channel) {
// Version lower than 4.0
stateFromShot.channelState.chMixerConnection = [
{ channel: stateFromShot.channelState.channel },
]
delete stateFromShot.channelState.channel
}
let migratedShot: IShotStorage = stateFromShot

fs.writeFileSync(
path.join(settingsPath, fileName),
path.join(STORAGE_FOLDER, fileName),
JSON.stringify(migratedShot),
'utf8'
)
logger.trace(`Snapshot ${fileName} Saved to storage folder`)
} catch (error: any) {
logger.data(error).error('Error saving Snapshot')
} catch (error) {
logger.data(error).error('Error migrating Snapshot')
}
})
currentSettings.sisyfosVersion = version
delete currentSettings.customPages
try {
fs.writeFileSync(
path.join(settingsPath, 'settings.json'),
path.join(STORAGE_FOLDER, 'settings.json'),
JSON.stringify(currentSettings),
'utf8'
)
Expand Down
4 changes: 2 additions & 2 deletions server/src/utils/mixerConnections/CasparCGConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { IFader } from '../../../../shared/src/reducers/fadersReducer'
import { sendVuLevel } from '../vuServer'
import { VuType } from '../../../../shared/src/utils/vu-server-types'
import { storeSetMixerOnline } from '../../../../shared/src/actions/settingsActions'
import { STORAGE_FOLDER } from '../SettingsStorage'

interface CommandChannelMap {
[key: string]: number
Expand Down Expand Up @@ -85,8 +86,7 @@ export class CasparCGConnection {

injectCasparCGSetting() {
const geometryFile = path.resolve(
process.cwd(),
'storage',
STORAGE_FOLDER,
'default-casparcg.ccg'
)

Expand Down
59 changes: 26 additions & 33 deletions server/src/utils/mixerConnections/EmberMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ import {
storeSetChLabel,
} from '../../../../shared/src/actions/channelActions'
import { storeSetMixerOnline } from '../../../../shared/src/actions/settingsActions'
import { IChannelReference, IFader } from '../../../../shared/src/reducers/fadersReducer'
import {
IChannelReference,
IFader,
} from '../../../../shared/src/reducers/fadersReducer'
import { EmberElement, NumberedTreeNode } from 'emberplus-connection/dist/model'
import { STORAGE_FOLDER } from '../SettingsStorage'

export class EmberMixerConnection {
mixerProtocol: IMixerProtocol
Expand All @@ -49,9 +54,12 @@ export class EmberMixerConnection {
}

private getAssignedFaderIndex(channelIndex: number) {
return state.faders[0].fader.findIndex(
(fader: IFader) => fader.assignedChannels?.some((assigned: IChannelReference) => {
return (assigned.mixerIndex === this.mixerIndex && assigned.channelIndex === channelIndex)
return state.faders[0].fader.findIndex((fader: IFader) =>
fader.assignedChannels?.some((assigned: IChannelReference) => {
return (
assigned.mixerIndex === this.mixerIndex &&
assigned.channelIndex === channelIndex
)
})
)
}
Expand Down Expand Up @@ -212,17 +220,13 @@ export class EmberMixerConnection {
channelTypeIndex
)
}
store.dispatch(
storeShowChannel(assignedFaderIndex, true)
)
store.dispatch(storeShowChannel(assignedFaderIndex, true))
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
} else {
logger.info(`Channel ${ch} offline`)
store.dispatch(
storeShowChannel(assignedFaderIndex, false)
)
store.dispatch(storeShowChannel(assignedFaderIndex, false))
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
Expand All @@ -249,7 +253,10 @@ export class EmberMixerConnection {
)
if (!node) return

await this.emberConnection.subscribe(node, cb)
await this.emberConnection.subscribe(
node as NumberedTreeNode<EmberElement>,
cb
)

cb(node)
} catch (e) {
Expand Down Expand Up @@ -285,9 +292,7 @@ export class EmberMixerConnection {
)

if (!channel.fadeActive && level >= 0 && level <= 1) {
store.dispatch(
storeFaderLevel(assignedFaderIndex, level)
)
store.dispatch(storeFaderLevel(assignedFaderIndex, level))
store.dispatch({
type: SET_OUTPUT_LEVEL,
channel: assignedFaderIndex,
Expand All @@ -297,9 +302,7 @@ export class EmberMixerConnection {

// toggle pgm based on level
logger.trace(`Set Channel ${ch} pgmOn ${level > 0}`)
store.dispatch(
storeSetPgm(assignedFaderIndex, level > 0)
)
store.dispatch(storeSetPgm(assignedFaderIndex, level > 0))

global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
Expand Down Expand Up @@ -357,9 +360,7 @@ export class EmberMixerConnection {
)
)
}
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
global.mainThreadHandler.updatePartialStore(assignedFaderIndex)
}
)
}
Expand Down Expand Up @@ -390,9 +391,7 @@ export class EmberMixerConnection {
(node.contents as Model.Parameter).value as boolean
)
)
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
global.mainThreadHandler.updatePartialStore(assignedFaderIndex)
}
)
}
Expand Down Expand Up @@ -429,9 +428,7 @@ export class EmberMixerConnection {
// assume it is in db now
level = this._faderLevelToFloat(Number(level), 0)
store.dispatch(storeInputGain(assignedFaderIndex, level))
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
global.mainThreadHandler.updatePartialStore(assignedFaderIndex)
}
)
}
Expand Down Expand Up @@ -510,9 +507,7 @@ export class EmberMixerConnection {
(node.contents as Model.Parameter).value as boolean
)
)
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
global.mainThreadHandler.updatePartialStore(assignedFaderIndex)
}
)
// subscribe to input selectors
Expand Down Expand Up @@ -623,9 +618,7 @@ export class EmberMixerConnection {
(node.contents as Model.Parameter).value as boolean
)
)
global.mainThreadHandler.updatePartialStore(
assignedFaderIndex
)
global.mainThreadHandler.updatePartialStore(assignedFaderIndex)
}
)
}
Expand Down Expand Up @@ -900,7 +893,7 @@ export class EmberMixerConnection {
let data = JSON.parse(
fs
.readFileSync(
path.resolve(process.cwd(), 'storage', presetName)
path.resolve(STORAGE_FOLDER, presetName)
)
.toString()
)
Expand Down
Loading
Loading