Skip to content

feat: Add module variable for slide label#52

Open
rashmisinha07 wants to merge 10 commits into
bitfocus:mainfrom
rashmisinha07:feature/active-presentation-current-slide-label
Open

feat: Add module variable for slide label#52
rashmisinha07 wants to merge 10 commits into
bitfocus:mainfrom
rashmisinha07:feature/active-presentation-current-slide-label

Conversation

@rashmisinha07

Copy link
Copy Markdown
Contributor

Add Active Presentation Current Slide Label Variable

Summary

Added a new variable active_presentation_current_slide_label that displays the assigned label text for the currently selected slide in ProPresenter.

Changes

  • New Variable: Added Active Presentation Current Slide Label variable definition in src/variables.ts
  • API Integration: Modified presentationSlideIndexUpdate() function in src/main.ts to fetch complete presentation data using presentationUUIDGet() API
  • Label Extraction: Implemented logic to extract slide labels from presentation groups and match them to the current slide index
  • Fallback Handling: Variable displays empty string when no label is assigned or when no presentation is active

Technical Details

  • Uses ProPresenter.presentationUUIDGet() to get complete presentation data with slide information
  • Iterates through all presentation groups to find the slide at the current index
  • Extracts the label field from the slide data structure
  • Handles cases where slides don't have labels assigned

Usage

The variable $(Propresenter-API:active_presentation_current_slide_label) will now display:

  • The actual slide label name when a label is assigned
  • Empty string when no label is assigned
  • Empty string when no presentation is active

@greyshirtguy

greyshirtguy commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

Hey there @rashmisinha07

Thanks for the PR.
I'm planning on doing this quite differently!
and unforetunertly I'm not sure we can (quickly/easily) edit this to make it the way I want to do it...so I might just leave this PR for now..

@greyshirtguy

greyshirtguy commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

If you are really keen....

Then please update to:

  1. Do not pull the presentation data on every slide click! This is asking for the same info over and over again as users click slides.
    Instead, we should add the presentation data to the local cache of data "ProPresenterStateStore" and update it only when the current presentation changes (user clicks a slide in a different presentation). This way we only pull it when it changes and not on every slide click (asking for the full presentation data on every slide could, quite likely, create a noticeable performance lag when users click slides in large presentations - I really really do not want to be responsible for slowing down peoples ProPresenter setups!)

  2. This implementation will fail with arranged presentations (you can't pull the presentation slides from the library and apply the current slide index to that - as current slide index respects custom arrangements). SO you have to determine the current arrangement first and then use slide index to enumerate that, find the real current slide to check for a slide label.

Getting the current arrangement is a little unintuitive... Because arrangements can be different for a presentation if it's triggered from the library (using the arrangement selected in the library) or from a playlist (using a sometimes different arrangement selected in the playlist )....(the same song could be in a playlist multiple times with different arrangements...

So I plan to:

  • query /v1/playlist/active to learn the {id} of the active playlist and the {index} of the item/presentation that is active in the active playlist. (essentially checking if the active presentation is triggered from a playlist)

  • If the {id} of the active playlist is null, then the active presentation is triggered directly from a library (not a playlist) and the current arrangement can be learned by querying the active presentation itself /v1/presentation/active and checking the value of the "current_arrangement"

Otherwise, if {id} of the active playlist is NOT null, then

  • query /v1/playlist/{id of active_playlist} and get the arrangement (as set by the playlist) of the presentation/item at {index} .

At this point we now know WHICH arrangement the active presentation is using.... We can use the arrangement info combined with the current slide index (that respects arrangements) to determine the current slide and check for a label!

I have already roughed this out in my head and I plan to implement soon..(coming weeks)

Unless - Are you really keen to update your PR to match? let me know if you will.. I'll wait,

@greyshirtguy

Copy link
Copy Markdown
Collaborator

Let me know - I don't mean to scare you! If you feel confident to fix the issues with the PR, please let me know.
Otherwise, I was planning to do this soon!

@rashmisinha07

Copy link
Copy Markdown
Contributor Author

@greyshirtguy can you review the latest changes?

@greyshirtguy

Copy link
Copy Markdown
Collaborator

Sure can - please be a little patient - I am drowning at work in my day job atm... might be a few days

@greyshirtguy

Copy link
Copy Markdown
Collaborator

Sorry about delay - I'll look at this soon

@josephdadams

Copy link
Copy Markdown
Member

I'd love this feature! I want to have a blinking button on my stream deck when the selected slide = a specific value

@greyshirtguy

Copy link
Copy Markdown
Collaborator

Sorry about delay..
I am "back on the wagon" now...
So I took another look at this - however there is still an issue of getting wrong arrangement for a presentation that has been added to a playlist and set with a different arrangement than the default arrangement in the library.
You need to determine if the active presentation is in a playlist with a different arrangement!

To see what I mean....
Find a presentation in the library with a couple of arrangements. (say arrangement 1 and arrangement 2).
In the library, set the arrangement to arrangement 1.
Now add the presentation to a playlist and in the playlist set the arrangement to arrangement 2 and click a slide in that arrangement 2 in the playlist....(so the presentation with arrangement 2 in a playlist is active).

Note how presentationData.currentArrangement reports "arrangement 1" from the library.
But the active presentation has arrangement 2 (set in the playlist).

Also, it does not refresh the presentationData when user edits the presentation.

I should have some time to look at this a bit closer and suggest code changes in the next week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants