Web controller for Acdsee

Last Updated or created 2023-02-06

UPDATE: 2023 It’s still working

I made a webcontroller for viewing images on a big TV.

Using a Acdsee instance with MCE Controller installed and a webserver.

https://tig.github.io/mcec/example_commands.html

Rate the picture 1-5, clear rating, slideshow start, escape, open/close image, zoom-in out and zoom-reset. Previous and next image fullscreen and delete/yes

Some used defined keys (see php file)

 if ($cmd=="I"){ $put="chars:+"; };
 if ($cmd=="O"){ $put="chars:-"; };
 if ($cmd=="R"){ $put="chars:*"; };
 if ($cmd=="Y"){ $put="chars:y"; };
 if ($cmd=="F"){ $put="chars:f"; };
 if ($cmd=="D"){ $put="delete"; };
 if ($cmd=="N"){ $put="right"; };
 if ($cmd=="P"){ $put="left"; };
 if ($cmd=="ENTER"){ $put="enter"; };
 if ($cmd=="ESC"){ $put="escape"; };

PHP Script for the buttons and creating the TCP packets for MCE.

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<?php
  $ip           = "remoteserver";
  $port         = "5150";

if (empty($put)) $put = "";
if (empty($line)) $line = "";
$cmd=$_POST['cmd'];
 if ($cmd=="I"){ $put="chars:+"; };
 if ($cmd=="O"){ $put="chars:-"; };
 if ($cmd=="R"){ $put="chars:*"; };
 if ($cmd=="Y"){ $put="chars:y"; };
 if ($cmd=="F"){ $put="chars:f"; };
 if ($cmd=="D"){ $put="delete"; };
 if ($cmd=="N"){ $put="right"; };
 if ($cmd=="P"){ $put="left"; };
 if ($cmd=="ENTER"){ $put="enter"; };
 if ($cmd=="ESC"){ $put="escape"; };
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
    $task = send_cmd("$put", $fp);

 if ($cmd=="1" || $cmd=="2" || $cmd=="3" || $cmd=="4" || $cmd=="5" || $cmd=="0"){
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftdown:ctrl", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("$cmd", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftup:ctrl", $fp);
  fclose($fp);
        };
if ($cmd=="S") {
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftdown:alt", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("$cmd", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftup:alt", $fp);
  fclose($fp);
        };

 if ($cmd=="fnietF"){
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftdown:shift", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftdown:ctrl", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("$cmd", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftup:ctrl", $fp);
  fclose($fp);
  $fp = stream_socket_client("tcp://".$ip.":".$port, $errno, $errstr, 30);
        send_cmd("shiftup:shift", $fp);
  fclose($fp);
        };



//}
  echo "<html><head><title></title></head>";
  echo "<body><center><H1>";
$callself=$_SERVER['PHP_SELF'];
echo "<div data-role=\"controlgroup\" data-type=\"horizontal\">";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"1\"><input type=\"submit\" value=\"1\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"2\"><input type=\"submit\" value=\"2\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"3\"><input type=\"submit\" value=\"3\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"4\"><input type=\"submit\" value=\"4\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"5\"><input type=\"submit\" value=\"5\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"0\"><input type=\"submit\" value=\"Rate Clear\" /></form>\n";
echo "</div>";

echo "<div data-role=\"controlgroup\" data-type=\"horizontal\">";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"S\"><input type=\"submit\" value=\"SLIDESHOW\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"ESC\"><input type=\"submit\" value=\"ESC\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"ENTER\"><input type=\"submit\" value=\"OPEN/CLOSE\" /></form>\n";
  fclose($fp);
echo "</div>";

echo "<div data-role=\"controlgroup\" data-type=\"horizontal\">";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"I\"><input type=\"submit\" value=\"ZOOMIN\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"R\"><input type=\"submit\" value=\"ZOOMRESET\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"O\"><input type=\"submit\" value=\"ZOOMOUT\" /></form>\n";
echo "</div>";

echo "<div data-role=\"controlgroup\" data-type=\"horizontal\">";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"P\"><input type=\"submit\" value=\"PREV\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"D\"><input type=\"submit\" value=\"DEL\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"Y\"><input type=\"submit\" value=\"Y\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"F\"><input type=\"submit\" value=\"FULL\" /></form>\n";
    echo "<form data-transition=\"none\" style=\"display:inline;\" name=\"input\" action=\"$callself\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"N\"><input type=\"submit\" value=\"NEXT\" /></form>\n";
echo "</div>";
  echo "</body></html>";
  function send_cmd($cmd, $fp){
    fwrite($fp, $cmd);
    fwrite($fp, "\n");
        return;
  }
?>