Page 3 of 3
Re: [API] SamyGO web API
Posted: Mon Oct 29, 2018 7:25 am
by dmn33
Any plans to add a CMD feature? It's already possible to run commands via RCremap, but with a native feature in this api it would be a lot more flexible.
Security would be a concern of course, so maybe a list with allowed commands?
Re: [API] SamyGO web API
Posted: Tue Oct 30, 2018 8:39 pm
by caio
Hi, how to instal web api in model serie B?
Re: [API] SamyGO web API
Posted: Sat Dec 08, 2018 7:09 am
by shmergin
On my TV, i get a garbled BMP screenshot when using web API. After some troubleshooting using libscreenshot.so, I found that in order to get a non-garbled image using libScreenShot.so I have to use:
Code: Select all
samyGOso -d -A -B -l /mnt/opt/privateer/usr/libso/libScreenShot.so ALT
Modifying samygo-web-apt.cgi to the below just resulted in an internal server error 500:
Code: Select all
if(getLock()){
$exec=`$SAMYGOSO -d -A -B -l $LIBSDIR/libScreenShot.so PATH:/dtv ALT`;
I assume this is because the rest of the code is expecting a BMP but is getting a JPG...
Is there a way to trigger the ALT mode when retrieving the screenshot via the web interface?
Re: [API] SamyGO web API
Posted: Sat Dec 08, 2018 2:13 pm
by shmergin
After some trial and error I have gotten ALT (.jpg) screenshots working.
For anyone else looking to do the same, I modified the 'SNAPSHOT' section of samygo-web-api.cgi as per below:
Code: Select all
case 'SNAPSHOT':
error_log("Processing SNAPSHOT");
//see if TV is on or off by checking /dtv/tvIsSleeping
$file="";
if(! file_exists("/dtv/tvIsSleeping")){
#TV is on. Get a list of existing screenshots
#changed from .bmp to .jpg, as ALT captures to .jpg by default - shmergin
$initialFiles = glob("/dtv/*.jpg");
#take the screenshot
if(getLock()){
#changed injection flag from -t to -A, added ALT - shmergin
$exec=`$SAMYGOSO -d -A -B -l $LIBSDIR/libScreenShot.so PATH:/dtv ALT`;
sleep(1);
releaseLock();
#We need to find out the filename
#changed from .bmp to .jpg, as ALT captures to .jpg by default - shmergin
$currentFiles = glob("/dtv/*.jpg");
foreach ($currentFiles as $filename){
if(! array_key_exists($filename, $initialFiles)){
#this looks like a new file. Convert it to jpeg
#commented out conversion, as we are now dealing with .jpg natively - shmergin
#$exec=`$BIN/cjpeg -q 95 $filename > /dtv/screenshot.jpg`;
#we are no longer converting the .bmp to screenshot.jpg, so we have to rename the existing .jpg file from its current name to screenshot.jpg - shmergin
rename($filename, "/dtv/screenshot.jpg");
#remove the bmp file
#commented out as there is no .bmp to remove - shmergin
#unlink("$filename");
$file="/dtv/screenshot.jpg";
break;
}
}
}
Disclaimer: It worked on my TV, however I know nothing about code, so make changes at your own risk...
*edit: have added comments in the code (comments ending in -shmergin) to explain what I have changed, hope it helps someone.
Re: [API] SamyGO web API
Posted: Tue May 02, 2023 10:21 pm
by ToasterPC
Hey there!
Just finished rooting my TV last night and found out about your API!
However, it seems I'm not able to use it, since trying to open it from anywhere leads to a 500 Internal Server Error page with or without the challenge key.
The test.cgi menu works correctly from the Apache server, so I was wondering if perhaps I missed a step in getting it to work with my UN40EH5300.
In any case, thanks for the project and have a nice day!