1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

REQUEST Get screenshot using REST/Websocket API

Discussion in 'Feature Requests' started by Joachim Prinsloo, 6 July 2018.

  1. Joachim Prinsloo

    Joachim Prinsloo New Member

    Messages:
    1
    Hardware:
    RPi3, +nodeMCU/ESP8266
    I currently have a use case where I need to get the screenshot from the grabber while hyperion is running. Unfortunately, I cannot do this using the hyperion remote in the current release of hyperion. Whenever I try to do a screen grab when hyperion is running, I get an error saying the device is busy. I need to get this screengrab every second overwriting the previous one and it would be pointless to stop the service every second.

    Is there a way that this would be achievable using hyperion.ng? and if so, how? I cannot find any references to grabbing screenshots in the api documentation that I managed to come across.

    It is worth mentioning that this is running on a RasberryPi 3 so if I can grab these screenshots and save it to the SD card every second using either a bash script or better yet, python, then that would be awesome!! This project is going to be epic! I have it working with other LED lights but I need it to work with hyperion also. I just need the final piece to the puzzle.

    The only other options I can see to achieve this is trying to modify the code of the current hyperion release to get it to save the current screenshot in mimory which it is using to set the LED's as discussed here:
    https://github.com/hyperion-project/hyperion/issues/761

    I suppose I can always try and modify the source code myself and add the following code to https://github.com/hyperion-project/hyperion.ng/blob/master/libsrc/hyperion/Hyperion.cpp#L696 under the if (priority == getCurrentPriority()) statement.

    FILE* file;
    if ((file = fopen("/home/pi/test.png", "wb")) != NULL)
    {
    fwrite(image, sizeof(char), sizeof(image), file);
    }

    would this work as a viable option?
     
    Last edited: 6 July 2018