[API] SamyGO web API

Here are software that related with Samsung H series TVs.
Please don't create any new topic here unless you have software to post/release.

dmn33
Posts: 2
Joined: Sun Oct 21, 2018 4:32 pm

Re: [API] SamyGO web API

Post by dmn33 » Mon Oct 29, 2018 7:25 am

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?

caio
Posts: 1
Joined: Tue Oct 30, 2018 6:45 pm

Re: [API] SamyGO web API

Post by caio » Tue Oct 30, 2018 8:39 pm

Hi, how to instal web api in model serie B?

shmergin
Posts: 2
Joined: Sun Nov 18, 2018 2:19 am

Re: [API] SamyGO web API

Post by shmergin » Sat Dec 08, 2018 7:09 am

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?

shmergin
Posts: 2
Joined: Sun Nov 18, 2018 2:19 am

Re: [API] SamyGO web API

Post by shmergin » Sat Dec 08, 2018 2:13 pm

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.

Post Reply

Return to “[H] Software”