Skip to content

Commit

Permalink
fix: put clear-on-startup behind a flag in config
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Mar 25, 2020
1 parent 3db46fd commit 3f6a46a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export interface IConfig {

/** Which channels/layers to put on the grid by default */
defaultRegions?: DefaultRegion[]

/** If true, sends clear commands on startup */
clearOnStartup?: boolean
}
export interface ChannelSetup {
/** CasparCG channel number (starting on 1) */
Expand Down
14 changes: 8 additions & 6 deletions src/imageProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ export class ImageProvider {
}
}

// Reset casparCG channels on startup:
await Promise.all(
_.map(this.channelSetup, channel => {
return this.casparcg.clear(channel.channel)
})
)
if (config.clearOnStartup) {
// Reset casparCG channels on startup:
await Promise.all(
_.map(this.channelSetup, channel => {
return this.casparcg.clear(channel.channel)
})
)
}
await this.initStreamsFromConfig()
}
reset () {
Expand Down

0 comments on commit 3f6a46a

Please sign in to comment.