Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/display data from response #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Commit-La-Grenouille
Copy link

@Commit-La-Grenouille Commit-La-Grenouille commented Apr 24, 2022

Hi,

as discussed in issue #3, here is a possible implementation of the display of data from the response on the button (latest stable on the right and this PR's code with the same API call on the left):
AFTER-and-BEFORE

This implementation uses the setTitle() to display the data on the button. The good: the user can leverage the title config (color, location, font size...) from the config to control the look of the text. The bad: you cannot use the Title field (otherwise it will hide the data from setTitle()) and must use the name field instead.

I will give a look at an alternative implementation where the data from the response is rendered as bitmap instead (but not quite sure how good it will look and it will come with its limitations on text style if we want to keep the config reasonably compact).

@Commit-La-Grenouille Commit-La-Grenouille force-pushed the feature/display-data-from-response branch from 052192a to f55f3cf Compare April 24, 2022 16:35
@Commit-La-Grenouille Commit-La-Grenouille deleted the feature/display-data-from-response branch April 24, 2022 16:42
@Commit-La-Grenouille Commit-La-Grenouille changed the title Feature/display data from response [DELETE ME] Feature/display data from response Apr 24, 2022
@Commit-La-Grenouille Commit-La-Grenouille changed the title [DELETE ME] Feature/display data from response Feature/display data from response Apr 24, 2022
@Commit-La-Grenouille Commit-La-Grenouille restored the feature/display-data-from-response branch April 24, 2022 16:43
@Commit-La-Grenouille Commit-La-Grenouille force-pushed the feature/display-data-from-response branch from f55f3cf to 64ca409 Compare April 24, 2022 16:53
@Commit-La-Grenouille Commit-La-Grenouille force-pushed the feature/display-data-from-response branch from 64ca409 to e701ea9 Compare April 25, 2022 10:47
… and cabling it correctly in the code to keep all PI elements perfectly distinct in name
@Commit-La-Grenouille
Copy link
Author

Just realized while coming back to the PR today to properly add the unit in the config (as the screenshot code was hardcoded) that it is missing the polling capability.
I fixed it by adding the proper PI elements & supporting code. To simplify the review (and any potential split), I kept the polling code in a separate commit :)

@Commit-La-Grenouille
Copy link
Author

Note for myself: I noticed this morning after a fresh boot that the refresh timeout seems not-to-be honored as I had the warning sign about every 15s (as the DNS was not resolving yet) despite the fact my buttons were configured to refresh every 300 or 600s.
To be investigated what in this PR (or not) introduce this regression...

@Commit-La-Grenouille
Copy link
Author

Hi @mjbnz,

sorry for the delayed update. I finally found some time to track the polling bug I mentioned earlier. The good news was that I missed one line to plugin the polling into to frequency calculation 😀
Let me know what you think of the diff and if you want me to do some changes to the code and/or commits prior to merging it :)

@benbalter
Copy link

+1 to this feature. It would be great to see the functionality added.

@killriam
Copy link

will this feature merged?

@Commit-La-Grenouille
Copy link
Author

Commit-La-Grenouille commented Mar 14, 2023

Hi @killriam,
technically, you can take the content of the folder and deploy it flat into your stream deck plugin folder as a plugin.
If you still want to try the version from this PR, I have created a packaged version equivalent to simplify the drag-and-drop: https://github.com/Commit-La-Grenouille/streamdeck-api-request/releases

I have been using it daily at work on 5 buttons and cannot get enough of it ;) (many thanks to @mjbnz for developing this very useful plugin !)

@doabigcheese
Copy link

doabigcheese commented May 23, 2023

i tried out this pull request as a plugin, but still i am not able to find the json path i think...
how can it look if it is:
{"channel":"12345","username":"doabigcheese","points":100,"pointsAlltime":300,"watchtime"400,"rank":1189}
I try to get the "points" from streamelements.com for a twitch channel... so there is not [ ] brackets in the response

@titogarrido
Copy link

Looking forward to see this merged!

@titogarrido
Copy link

Hi @killriam, technically, you can take the content of the folder and deploy it flat into your stream deck plugin folder as a plugin. If you still want to try the version from this PR, I have created a packaged version equivalent to simplify the drag-and-drop: https://github.com/Commit-La-Grenouille/streamdeck-api-request/releases

I have been using it daily at work on 5 buttons and cannot get enough of it ;) (many thanks to @mjbnz for developing this very useful plugin !)

I did not find the release you mentioned here. Is it still available?

Thanks!

@wiretail
Copy link

I did not find the release you mentioned here. Is it still available?

FYI, you can just download the source ZIP file from https://github.com/Commit-La-Grenouille/streamdeck-api-request and copy the contents within the Source folder into the "com.github.mjbnz.sd-api-request.sdPlugin" folder you already have (yes to overwrite). Restart the streamdeck app. You'll probably have to recreate any buttons using it though.

That's all the "release" really is.

Note it won't work unless you set a background image. And getting a different value to show from a different URL than what the button does is broken. (Which is changeable if you feel like editing.) At some point I might work on a text-only fork, as this does exactly what I need, with a secondary polling URL, but I only care about text from the response and want to use library images.

@Commit-La-Grenouille
Copy link
Author

Thanks @rgreer4 for sharing the deployment trick.

As for the limitation, I would be interested by a simple reproducer using a public service to look into it and adjust this PR accordingly (the more useful the PR the better) ;)

@titogarrido
Copy link

I am trying to install it on 6.5 but I am not able to... I couldn't even find the "com.github.mjbnz.sd-api-request.sdPlugin" folder so I can replace with @Commit-La-Grenouille code... is there a way to provide the sdPlugin package? Seems that @mjbnz is not maitaining it anymore...

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.

6 participants