You can get it here:
https://github.com/mad-ady/samygo-web
SamyGO web API
The Web API exposes some of SamyGO's plugins to external clients. The API tries to return data in json format where possible, but uses image/jpg for screenshots.
Features:
- Get TV State and current program details via libLogChannel
- Control the TV via samyGOrc with remote actions
- Reboot the TV
- Get a screenshot of what is on the screen via libScreenShot
- Start a widget via libRunWidget
- Display an onscreen message via libAlert
- Compatibility with libSoftPowerOff (viewtopic.php?t=8987&start=230)
- Apache (/mnt/etc/init.d/06_05_apache.init)
- samyGOso: viewtopic.php?t=6186
- samyGOrc: viewtopic.php?f=63&t=6395
- libLogChannel: viewtopic.php?f=63&t=8717
- libScreenShot: viewtopic.php?t=9201
- libRunWidget: viewtopic.php?f=63&t=9306
- libAlert: viewtopic.php?f=63&t=9099
Download to your rooted SamyGO TV:
Code: Select all
cd /tmp
curl -k https://codeload.github.com/mad-ady/samygo-web/zip/master > samygo-web-api.zip
Code: Select all
unzip samygo-web-api.zip
Code: Select all
./samygo-web-master/installer.sh
If you have libSoftPowerOff enabled in your TV and you use the screenshot functionality, in order not to inject the screenshot command when the display is off you can signal that the TV is in soft-off mode by configuring libSoftPowerOff.so to run two scripts on power on/off. When you load the libSoftPowerOff library, use the following options:
Code: Select all
CMD_ON:/mnt/scripts/onPowerOn.sh CMD_OFF:/mnt/scripts/onPowerOff.sh
Code: Select all
/dtv/tvIsSleeping
- onPowerOn.sh: rm -f /dtv/tvIsSleeping
- onPowerOff.sh: touch /dtv/tvIsSleeping
Startup:
Code: Select all
/mnt/etc/init.d/99_99_samygo_web_api.init start
Code: Select all
/mnt/etc/samygo-web-api.challenge
API Usage:
to get the current information, request for action=CHANNELINFO:
Code: Select all
$ wget -O - "http://tv-ip:1080/cgi-bin/samygo-web-api.cgi?challenge=oyd4uIz5WWAkWPo5MzfxBFraI05C3FDorSPE7xiMLCVAQ40a&action=CHANNELINFO"
{"source":"TV (0)","pvr_status":"NONE","powerstate":"Normal","tv_mode":"Cable (1)","volume":"9","channel_number":"45","channel_name":"Nat Geo HD","program_name":"Planeta dezastrelor","resolution":"1920x1080","error":false}
Code: Select all
$ wget -O - http://tv-ip:1080/cgi-bin/samygo-web-api.cgi?challenge=oyd4uIz5WWAkWPo5MzfxBFraI05C3FDorSPE7xiMLCVAQ40a&action=REBOOT
Code: Select all
$ wget -O - http://tv-ip:1080/cgi-bin/samygo-web-api.cgi?challenge=oyd4uIz5WWAkWPo5MzfxBFraI05C3FDorSPE7xiMLCVAQ40a&action=KEY&key=KEY_1
{"error":false,"message":"Sent key 4"}
to get a snapshot from the TV request for action=SNAPSHOT:
Code: Select all
$ wget -O /tmp/image.jpg http://tv-ip:1080/cgi-bin/samygo-web-api.cgi?challenge=oyd4uIz5WWAkWPo5MzfxBFraI05C3FDorSPE7xiMLCVAQ40a&action=SNAPSHOT
Code: Select all
$ wget -O - http://tv-ip:1080/cgi-bin/samygo-web-api.cgi?challenge=oyd4uIz5WWAkWPo5MzfxBFraI05C3FDorSPE7xiMLCVAQ40a&action=WIDGET&name=YouTube
Code: Select all
$ wget -O - http://tv-ip:1080/cgi-bin/samygo-web-api.cgi?challenge=oyd4uIz5WWAkWPo5MzfxBFraI05C3FDorSPE7xiMLCVAQ40a&action=ALERT&type=CENTER&message=This+is+a+test