Feature/display data from response
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):

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).
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 :)
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...
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 :)
+1 to this feature. It would be great to see the functionality added.
will this feature merged?
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 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
Looking forward to see this merged!
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!
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.
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) ;)
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...