Skip to content

Commit

Permalink
fix(Stream Deck): update elgato-stream-deck library to resolve an iss…
Browse files Browse the repository at this point in the history
…ue with slow discovery of HID devices
  • Loading branch information
jstarpl committed Jan 21, 2025
1 parent 65e4e5b commit fbcb790
Show file tree
Hide file tree
Showing 9 changed files with 524 additions and 277 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"unitci": "yarn workspaces foreach --all run unitci",
"dev:manager": "cd packages/input-manager && run build:watch",
"dev:gateway": "nodemon --config nodemon.json",
"dev": "concurrently \"yarn dev:manager\" \"yarn dev:gateway\"",
"dev": "concurrently \"yarn dev:manager\" --handle-input \"yarn dev:gateway\"",
"release:set-version": "lerna version --exact --no-changelog --no-git-tag-version --no-push --yes",
"release:bump-release": "lerna version --exact --conventional-commits --conventional-graduate --tag-version-prefix='v' --no-push",
"release:bump-prerelease": "lerna version --exact --conventional-commits --conventional-prerelease --tag-version-prefix='v' --no-push",
Expand Down Expand Up @@ -57,13 +57,13 @@
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"type-fest": "^4.18.2",
"typescript": "~5.1.3",
"typescript": "5.6.3",
"zip-a-folder": "^3.1.6"
},
"prettier": "@sofie-automation/code-standard-preset/.prettierrc.json",
"packageManager": "[email protected]",
"dependencies": {
"@yao-pkg/pkg": "^5.11.5"
"@yao-pkg/pkg": "6.2.0"
},
"resolutions": {
"node-hid": "npm:@julusian/[email protected]"
Expand Down
16 changes: 8 additions & 8 deletions packages/input-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scripts": {
"start": "node dist/index.js",
"build": "run -T -B rimraf dist && run build:main",
"buildstart": "run build && run start -id localDevInp",
"buildstart": "run build && run start -id localDevInp -token localDevInp",
"build:main": "run -T -B tsc -p tsconfig.build.json",
"lint:raw": "run -T g:eslint --ext .ts --ext .js --ext .tsx --ext .jsx --ignore-pattern dist",
"lint": "run lint:raw .",
Expand Down Expand Up @@ -73,13 +73,13 @@
],
"dependencies": {
"@sofie-automation/input-manager": "0.3.0",
"@sofie-automation/server-core-integration": "1.51.0-nightly-release51-20240524-100952-fa306dc.0",
"@sofie-automation/shared-lib": "1.51.0-nightly-release51-20240524-100952-fa306dc.0",
"@sofie-automation/server-core-integration": "1.51.6",
"@sofie-automation/shared-lib": "1.51.6",
"debug": "^4.3.4",
"eventemitter3": "^4.0.7",
"p-all": "^3.0.0",
"p-queue": "^6.6.2",
"p-timeout": "^3.2.0",
"eventemitter3": "5.0.1",
"p-all": "5.0.0",
"p-queue": "8.0.1",
"p-timeout": "6.1.4",
"sprintf-js": "^1.1.3",
"tslib": "^2.6.2",
"underscore": "^1.13.6",
Expand All @@ -98,7 +98,7 @@
"./package.json"
],
"targets": [
"node18-win"
"node22-win"
],
"outputPath": "deploy"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/input-gateway/src/coreHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class CoreHandler {
this.logger.info('Loglevel: ' + this.logger.level)
}

this.logger.info('Changed PeripheralDevice: ' + JSON.stringify(device))
this.logger.info('Changed PeripheralDevice')
if (this._onChanged) this._onChanged()
}
}
Expand Down
8 changes: 3 additions & 5 deletions packages/input-gateway/src/inputManagerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import {
PeripheralDevicePubSubCollectionsNames,
} from '@sofie-automation/server-core-integration'
import { literal, sleep } from '@sofie-automation/shared-lib/dist/lib/lib'
// Eslint doesn't seee p-queue, because it's hoisted, but TypeScript does
// eslint-disable-next-line node/no-missing-import
import PQueue from 'p-queue'
import { InputGatewaySettings } from './generated/options'

Expand Down Expand Up @@ -140,8 +142,6 @@ export class InputManagerHandler {
async initInputManager(settings: DeviceSettings): Promise<void> {
this.#logger.info('Initializing Input Manager with the following settings:')

this.#logger.info(JSON.stringify(settings))

this.#deviceSettings = settings

this.#inputManager = await this.#createInputManager(settings)
Expand Down Expand Up @@ -650,9 +650,7 @@ export class InputManagerHandler {
contentLayerLongName = previewedAdlibs[0].sourceLayerName?.name
contentLayerShortName = previewedAdlibs[0].sourceLayerName?.abbreviation
contentLabel = previewedAdlibs.map((adlib) => InputManagerHandler.getStringLabel(adlib.label)).join(', ')
contentTypes = previewedAdlibs
.map((adlib) => adlib.sourceLayerType)
.filter((a) => a !== undefined) as SourceLayerType[]
contentTypes = previewedAdlibs.map((adlib) => adlib.sourceLayerType).filter((a) => a !== undefined)
styleClassNames = previewedAdlibs[0].styleClassNames
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/input-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@
"production"
],
"dependencies": {
"@elgato-stream-deck/node": "^6.2.0",
"@elgato-stream-deck/node": "7.1.2",
"@julusian/jpeg-turbo": "^2.1.0",
"easymidi": "^3.1.0",
"eventemitter3": "^4.0.7",
"eventemitter3": "5.0.1",
"fold-to-ascii": "^5.0.1",
"lru-cache": "^10.4.2",
"lru-cache": "11.0.2",
"osc": "^2.4.4",
"skia-canvas": "^1.0.2",
"skia-canvas": "2.0.1",
"xkeys": "^3.1.1"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/input-manager/src/generated/streamdeck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface StreamdeckStylePreset {
fontWeight?: 'normal' | 'bold'
fontWidth?: 'normal' | 'narrow'
fontStyle?: 'normal' | 'italic'
color?: boolean & string
color?: string
textStrokeColor?: string
textShadowColor?: string
textShadowOffset?: number
Expand All @@ -43,7 +43,7 @@ export interface StreamdeckStylePreset {
| 'left bottom'
| 'center bottom'
| 'right bottom'
textTransform?: 'capitalize' | 'uppercase' | 'lowercase'
textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase'
lineClamp?: number
inlineBackground?: string
inlineBackgroundPadding?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/input-manager/src/inputManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class InputManager extends EventEmitter<DeviceEvents> {
}

private refreshDevicesInterval = (): void => {
this.#logger.silly(`Refreshing devices... ${this.#refreshRunning}`)
this.#logger.silly(`Refreshing devices... Is already running: ${this.#refreshRunning}`)
if (this.#refreshRunning === true) return

this.#refreshRunning = true
Expand Down
Loading

0 comments on commit fbcb790

Please sign in to comment.