Skip to content

Commit

Permalink
fix: templates retrieval
Browse files Browse the repository at this point in the history
uses new return types from casparcg-connection
  • Loading branch information
ianshade committed Oct 5, 2023
1 parent c70b530 commit 840c9d4
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions shared/packages/tsr-bridge/src/sideload/CasparCGTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,16 @@ export async function addTemplatesToResourcesFromCasparCG(
if (res.error) throw res.error
const response = await res.request

const templatesList = response.data as {
type: 'template'
name: string
size: number
changed: number
}[]
const templatesList = response.data
for (const template of templatesList) {
const resource: CasparCGTemplate = {
resourceType: ResourceType.CASPARCG_TEMPLATE,
deviceId: deviceId,
id: protectString(''), // set by getResourceIdFromResource() later
...template,
displayName: template.name,
name: template,
displayName: template,
size: 0,
changed: Date.now(),
}
resource.id = getResourceIdFromResource(resource)
resources.set(resource.id, resource)
Expand Down Expand Up @@ -77,10 +74,15 @@ export async function addTemplatesToResourcesFromDisk(
): Promise<boolean> {
// If CasparCG is running locally, we could try reading the template files manually.
if (casparCG.host === '127.0.0.1' || casparCG.host === 'localhost') {
const config = await casparCG.infoConfig()
const configData: Config.Intermediate.CasparCGConfig = config.response.data
const request = await casparCG.infoConfig()
if (request.error) throw request.error
const response = await request.request
const configData = response.data
if (configData) {
const templatePath = configData.paths.templatePath
const templatePath = configData.paths?.templates
if (templatePath == null) {
return false
}

let absoluteTemplatePath = ''

Expand Down

0 comments on commit 840c9d4

Please sign in to comment.