Ejemplo n.º 1
0
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
*/
require 'upnpctrl_util.php';
//header("content-type: text/html");
header("content-type: text/json");
$cmd_prev = 'POST /MediaRenderer/AVTransport/Control HTTP/1.1
CONNECTION: close
HOST: ' . $address . ':' . $port . '
CONTENT-LENGTH: 258
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Previous"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Previous xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID></u:Previous></s:Body></s:Envelope>';
$actionResponse = sendUpnpAction($cmd_prev, $address, $port);
//echo "actionResponse xml: ";
//print_r($actionResponse);
//echo "</br>'";
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $actionResponse, $actionResponseArray, $index);
xml_parser_free($xmlParser);
//print_r($actionResponseArray);
//print_r($index);
print_r("{\"actionstatus\" : 'OK'}");
Ejemplo n.º 2
0
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
*/
require 'upnpctrl_util.php';
header("content-type: text/html");
//header("content-type: text/json");
$mute = $_GET['mute'];
$cmd_setmute = 'POST /MediaRenderer/RenderingControl/Control HTTP/1.1
CONNECTION: close
HOST: ' . $address . ':' . $port . '
CONTENT-LENGTH: 314
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:RenderingControl:1#SetMute"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"><InstanceID>0</InstanceID><Channel>Master</Channel><DesiredMute>' . $mute . '</DesiredMute></u:SetMute></s:Body></s:Envelope>';
$actionResponse = sendUpnpAction($cmd_setmute, $address, $port);
//echo "actionResponse xml: ";
//print_r($actionResponse);
//echo "</br>'";
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $actionResponse, $actionResponseArray, $index);
xml_parser_free($xmlParser);
//print_r($actionResponseArray);
//print_r($index);
print_r("{\"actionstatus\" : 'OK'}");
Ejemplo n.º 3
0
//	print_r($actionResponseArray);
$transportStateResponse = getValueOfResponse($actionResponseArray, "CURRENTTRANSPORTSTATE");
if ($transportStateResponse == "PAUSED_PLAYBACK") {
    $transportState = 'Pause';
} else {
    if ($transportStateResponse == "PLAYING") {
        $transportState = 'Play';
    } else {
        if ($transportStateResponse == "STOPPED") {
            $transportState = 'Stop';
        } else {
            $transportState = 'unknown';
        }
    }
}
$actionResponse = sendUpnpAction($cmd_getpositioninfo, $address, $port);
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $actionResponse, $actionResponseArray, $index);
xml_parser_free($xmlParser);
//	print_r($actionResponseArray);
$reltimeResponse = getValueOfResponse($actionResponseArray, "RELTIME");
$durationResponse = getValueOfResponse($actionResponseArray, "TRACKDURATION");
$trackMetaDataResponse = getValueOfResponse($actionResponseArray, "TRACKMETADATA");
//	print_r($trackMetaDataResponse);
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $trackMetaDataResponse, $actionResponseArray, $index);
xml_parser_free($xmlParser);
//	print_r($actionResponseArray);
$title = getValueOfResponse($actionResponseArray, "TITLE");
Ejemplo n.º 4
0
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
*/
require 'upnpctrl_util.php';
//header("content-type: text/html");
header("content-type: text/json");
$cmd_next = 'POST /MediaRenderer/AVTransport/Control HTTP/1.1
CONNECTION: close
HOST: ' . $address . ':' . $port . '
CONTENT-LENGTH: 250
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#Next"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Next xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID></u:Next></s:Body></s:Envelope>';
$actionResponse = sendUpnpAction($cmd_next, $address, $port);
//echo "actionResponse xml: ";
//print_r($actionResponse);
//echo "</br>'";
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $actionResponse, $actionResponseArray, $index);
xml_parser_free($xmlParser);
//print_r($actionResponseArray);
//print_r($index);
print_r("{\"actionstatus\" : 'OK'}");
Ejemplo n.º 5
0
require 'upnpctrl_util.php';
$format = $_GET['format'];
if ($format == 'html') {
    header("content-type: text/html");
} else {
    header("content-type: text/json");
}
$cmd_playlist = 'POST /MediaServer/ContentDirectory/Control HTTP/1.1
CONNECTION: close
HOST: ' . $address . ':' . $port . '
CONTENT-LENGTH: 416
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"

<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1"><ObjectID>SQ:</ObjectID><BrowseFlag>BrowseDirectChildren</BrowseFlag><Filter></Filter><StartingIndex>0</StartingIndex><RequestedCount>100</RequestedCount><SortCriteria></SortCriteria></u:Browse></s:Body></s:Envelope>';
$actionResponse = sendUpnpAction($cmd_playlist, $address, $port);
//echo "actionResponse xml: ";
//print_r($actionResponse);
//echo "</br>'";
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $actionResponse, $actionResponseArray, $index);
xml_parser_free($xmlParser);
//print_r($actionResponseArray);
//print_r($index);
$totalMatches = getValueOfResponse($actionResponseArray, "TOTALMATCHES");
$playListsMeta = getValueOfResponse($actionResponseArray, "RESULT");
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parse_into_struct($xmlParser, $playListsMeta, $playListsArray, $index);
xml_parser_free($xmlParser);