From 5a83e159be06106d623eba0383ded60902310ba5 Mon Sep 17 00:00:00 2001 From: Dan Owen Date: Mon, 13 Jan 2025 23:06:25 +1100 Subject: [PATCH] Some fixes and a new preset icon --- companion/HELP.md | 1 + companion/manifest.json | 2 +- package.json | 2 +- src/actions.ts | 3 +++ src/main.ts | 15 +++++++++++- src/presets.ts | 51 ++++++++++++++++++++++++++++++++++++++++- src/variables.ts | 4 ++++ 7 files changed, 74 insertions(+), 4 deletions(-) diff --git a/companion/HELP.md b/companion/HELP.md index dc21df7..79fc6aa 100644 --- a/companion/HELP.md +++ b/companion/HELP.md @@ -125,6 +125,7 @@ Can be used on button labels - can be used in many action inputs. Some variables are dynamically created so that there are variables for each thing - eg timers, stage display layouts. When looking at the Variable ID's you will notice that the uuid is sometimes included - which makes for a bit of a confusing/long ID, but this long ID is globally unique and allows these variables to always work even if the names have duplicates. Note that, the Variable description has a nice friendly name. +Note also that the variable "Active Presentation Index" seems to mostly return invalid indexes but I am keeping it available for the future, in case it becomes useful in a future version of ProPresenter For now, you probably want to use "Active Presentation PlaylistItem Index" instead. One special variable is Time Since Last Status Update - for debugging purposes. (You can even Trigger the module to automatically restart when the "Time Since Last Status Update" gets over some appropiate limit - Although hopefully you never need to!) ### Feedbacks: diff --git a/companion/manifest.json b/companion/manifest.json index deda342..2be2a08 100644 --- a/companion/manifest.json +++ b/companion/manifest.json @@ -3,7 +3,7 @@ "name": "Propresenter-API", "shortname": "Propresenter-API", "description": "ProPresenter API Module (Pro Versions 7.9 and higher)", - "version": "1.0.3", + "version": "1.0.4", "license": "MIT", "repository": "git+https://github.com/bitfocus/companion-module-renewedvision-propresenter-rest.git", "bugs": "https://github.com/bitfocus/companion-module-renewedvision-propresenter-rest/issues", diff --git a/package.json b/package.json index 254813b..3f707e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "renewedvision-propresenter-api", - "version": "1.0.3", + "version": "1.0.4", "main": "dist/main.js", "scripts": { "prepare": "husky install", diff --git a/src/actions.ts b/src/actions.ts index 08432ac..a6e3ff7 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -505,6 +505,9 @@ export function GetActions(instance: InstanceBaseExt): CompanionAc callback: async (actionEvent) => { const playlist_id: string = await instance.parseVariablesInString(actionEvent.options.playlist_id as string) switch (actionEvent.options.specific_playlist_operation) { + case 'focus': + instance.ProPresenter.playlistByPlaylistIdFocus(playlist_id) + break case 'trigger_next': instance.ProPresenter.playlistByPlaylistIdNextTrigger(playlist_id) break diff --git a/src/main.ts b/src/main.ts index dd2be22..fee1e4f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -175,6 +175,7 @@ class ModuleInstance extends InstanceBase { "announcement/slide_index":this.announcementSlideIndexUpdated, "playlist/active":this.activePlaylistUpdated, "presentation/focused":this.focusedPresentationUpdated, + "presentation/active":this.activePresentationUpdated, // The doco for /v1/status/updates mentions presentation/current as a permitted streaming endpoint - but it's a hyperlink that actually links to presentation/active (I tested and either works - but I'm using the one that is linked to). "look/current":this.activeLookUpdated, "looks":this.looksUpdated, "macros":this.macrosUpdated, @@ -369,7 +370,7 @@ class ModuleInstance extends InstanceBase { this.initFeedbacks() this.checkFeedbacks() - // Watchdog function - makes checks and updates every second. + // Watchdog function - checks each second to record total time since last status update in a variable. (Users can monitor this variable to know if the module is still connected to ProPresenter) setInterval(() => { SetVariableValues(this, {time_since_last_status_update: (Date.now()-this.timeOfLastStatusUpdate)/1000}) },1000) @@ -519,11 +520,14 @@ class ModuleInstance extends InstanceBase { if (statusJSONObject.data.presentation_index) { // ProPresenter can return a null presentation_index when no presentation is active SetVariableValues(this, { active_presentation_slide_index: statusJSONObject.data.presentation_index.index, + // This status update includes the name and uuid of the presentation - so we can update these variables too active_presentation_name: statusJSONObject.data.presentation_index.presentation_id.name, active_presentation_uuid: statusJSONObject.data.presentation_index.presentation_id.uuid, + active_presentation_index: statusJSONObject.data.presentation_index.presentation_id.index, // Note that this seems to return invalid indexes. Keeping it here for the future, in case it becomes useful in a future version of ProPresenter }) } else { SetVariableValues(this, { + // For the times when no presentation is active: active_presentation_slide_index: '', active_presentation_name: '', active_presentation_uuid: '' @@ -540,6 +544,15 @@ class ModuleInstance extends InstanceBase { }) } + activePresentationUpdated = (statusJSONObject: StatusUpdateJSON) => { + this.log('debug', 'activePresentationUpdated: ' + JSON.stringify(statusJSONObject)) + SetVariableValues(this, { + active_presentation_index: statusJSONObject.data.presentation.id.index, // Note that this seems to return invalid indexes. Keeping it here for the future, in case it becomes useful in a future version of ProPresenter + active_presentation_name: statusJSONObject.data.presentation.id.name, + active_presentation_uuid: statusJSONObject.data.presentation.id.uuid, + }) + } + activePlaylistUpdated = async (statusJSONObject: StatusUpdateJSON) => { this.log('debug', 'activePlaylistUpdated: ' + JSON.stringify(statusJSONObject)) if (statusJSONObject.data.presentation.playlist) { diff --git a/src/presets.ts b/src/presets.ts index 27d9646..9cce0ff 100644 --- a/src/presets.ts +++ b/src/presets.ts @@ -53,7 +53,56 @@ export function GetPresets(instance: InstanceBaseExt): CompanionPr size: 14, bgcolor: combineRgb(120, 0, 0), color: combineRgb(255, 192, 192), - // TODO: Add a png64 with the ProPresenter capture image + png64: 'iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw1AUhU9TpSoVBTuIOGSo\ + ThakijhqFYpQIdQKrTqYvPRHaNKQpLg4Cq4FB38Wqw4uzro6uAqC4A+Iu+Ck6CIl3pcUWsR44fE+zrvn8N59gFAvM83qGAc03TbT\ + yYSYza2IoVcEEEI3+hGXmWXMSlIKvvV1T91UdzGe5d/3Z/WqeYsBAZF4hhmmTbxOPLVpG5z3iSOsJKvE58RjJl2Q+JHrisdvnIsu\ + CzwzYmbSc8QRYrHYxkobs5KpEU8SR1VNp3wh67HKeYuzVq6y5j35C8N5fXmJ67SGkcQCFiFBhIIqNlCGjRjtOikW0nSe8PEPuX6J\ + XAq5NsDIMY8KNMiuH/wPfs/WKkzEvaR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AAAAAD///9A////aAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///2n///8/AAAAAAAAAAAAAAAAAAAAAAAAAAAA////I///\ + /+z///+eAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ + AAAA////oP///+v///8iAAAAAAAAAAAAAAAAAAAAAAD///+/////xv///wcAAAAAAAAAAP///wYAAAAAAAAAAAAAAAAAAAAAAAAA\ + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8GAAAAAAAAAAD///8H////yP///7wAAAAAAAAAAAAAAAAA////Sv////3/\ + //8xAAAAAAAAAAD///9E////1f///w0AAAAAAAAAAAAAAAAAAAAA////BP///wQAAAAAAAAAAAAAAAAAAAAA////Df///9X///9E\ + AAAAAAAAAAD///8z/////v///0gAAAAAAAAAAAD///+9////qAAAAAAAAAAA////Dv///+r///+aAAAAAAAAAAD///8B////X///\ + /83////9/////f///83///9dAAAAAAAAAAAAAAAA////mv///+n///8OAAAAAAAAAAD///+p////vAAAAAAA////Ev////v///9N\ + AAAAAAAAAAD///9/////6P///wwAAAAA////Af///5v///////////////////////////////////+YAAAAAAAAAAD///8M////\ + 6P///34AAAAAAAAAAP///07////6////EQD///9W////9v///wkAAAAAAAAAAP///9r///+BAAAAAAAAAAD///9f////////////\ + //////////////////////////////////9cAAAAAAAAAAD///+B////2AAAAAAAAAAA////Cf////b///9UAgAAACAAAADhAQEB\ + 9wAAAAD///8bAAAAJQAAALcAAAAAAAAAAAAAAG8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAA\ + ALgAAAAn////GQAAAAABAQH3AAAA4QAAACACAAAAGgAAAOUAAAAAAAAAAAAAABsAAAAAAAAA3gAAAAD///8FAAAALwAAAAAAAAAA\ + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMP///wQAAAAAAAAA3gAAAAAAAAAcAAAAAAAAAAAAAADmAAAAGgIAAAD/AAAAAQAA\ + AAAAAAAAAAAA/wAAAAAAAAACAAAAAAAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAAAA\ + AAABAAAAAAAAAP8AAAAAAAAAAAAAAAEAAAD/AgAAAOYAAAAaAAAAAAAAAAAAAADlAAAAAAAAACAAAAAAAQEB/AAAANIAAAAAAAAA\ + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM8BAQH9AAAAAAAAACEAAAAAAAAA5QAAAAAAAAAAAAAAGQAAAOcCAAAA4QAAAB//\ + //8JAAAAAAEBAeYAAADaAAAASgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAA\ + AAAASQAAANkBAQHnAAAAAP///woAAAAgAAAA4AD///8S////+////04AAAAAAAAAAP///37////o////DAAAAAAAAAAA////mv//\ + /////////////////////////////////5gAAAAAAAAAAP///w3////p////fQAAAAAAAAAA////Tv////r///8RAAAAAAD///+9\ + ////qQAAAAAAAAAA////Dv///+n///+bAAAAAAAAAAAAAAAA////Xf///83////9/////f///8z///9bAAAAAAAAAAAAAAAA////\ + m////+j///8NAAAAAAAAAAD///+p////uwAAAAAAAAAAAP///0n////9////MgAAAAAAAAAA////Q////9X///8NAAAAAAAAAAAA\ + AAAAAAAAAP///wT///8EAAAAAAAAAAAAAAAAAAAAAP///w3////V////QwAAAAAAAAAA////NP////7///9HAAAAAAAAAAAAAAAA\ + AP///77////H////BwAAAAAAAAAA////BgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//\ + /wYAAAAAAAAAAP///wf////J////uwAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwwFg9\ + yO8EogAAAABJRU5ErkJggg==', }, steps: [ { diff --git a/src/variables.ts b/src/variables.ts index 4755845..e3ce21f 100644 --- a/src/variables.ts +++ b/src/variables.ts @@ -43,6 +43,10 @@ export function GetVariableDefinitions(propresenterStateStore: ProPresenterState name: 'Active Presentation UUID', variableId: 'active_presentation_uuid', }) + variables.push({ + name: 'Active Presentation Index', + variableId: 'active_presentation_index', /// Note that this seems to be mostly invalid indexes. Keeping it here for the future, in case it becomes useful in a future version of ProPresenter + }) variables.push({ name: 'Active Announcement Slide Index', variableId: 'active_announcement_slide_index',