<?php define('NO_SESSION', '1'); require_once '../lib/init.php'; if (!AmpConfig::get('upnp_backend')) { echo "Disabled."; exit; } if ($_GET['btnSend'] || $_GET['btnSendAuto']) { $msIP = 1; Upnp_Api::sddpSend($msIP); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- Propulsed by Ampache | ampache.org --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php if ($_GET['btnSendAuto']) { echo '<meta http-equiv="refresh" content="1">'; } ?> <title>Ampache UPnP</title> <style type="text/css" media="screen"> body { color:black; background-color:white; background-image:url(images/upnp.jpg); background-repeat:no-repeat; background-position:50% 50%;
$items = Upnp_Api::_musicMetadata($reqObjectURL['path'], $reqObjectURL['query']); } else { list($totMatches, $items) = Upnp_Api::_musicChilds($reqObjectURL['path'], $reqObjectURL['query'], $upnpRequest['startingindex'], $upnpRequest['requestedcount']); } break; case 'video': if ($upnpRequest['browseflag'] == 'BrowseMetadata') { $items = Upnp_Api::_videoMetadata($reqObjectURL['path'], $reqObjectURL['query']); } else { list($totMatches, $items) = Upnp_Api::_videoChilds($reqObjectURL['path'], $reqObjectURL['query'], $upnpRequest['startingindex'], $upnpRequest['requestedcount']); } break; } break; } } break; } $totMatches = $totMatches == 0 ? count($items) : $totMatches; if ($items == null || $totMatches == 0) { $domDIDL = Upnp_Api::createDIDL(''); $numRet = 0; } else { $domDIDL = Upnp_Api::createDIDL($items); $numRet = count($items); } $xmlDIDL = $domDIDL->saveXML(); $domSOAP = Upnp_Api::createSOAPEnvelope($xmlDIDL, $numRet, $totMatches, $responseType); $soapXML = $domSOAP->saveXML(); echo $soapXML; //!!debug_event('upnp', 'Response: ' . $soapXML, '5');
<?php define('NO_SESSION', '1'); require_once '../lib/init.php'; if (!AmpConfig::get('upnp_backend')) { echo "Disabled."; exit; } set_time_limit(600); header("Content-Type: text/html; charset=UTF-8"); // Parse the request from UPnP player $requestRaw = file_get_contents('php://input'); if ($requestRaw != '') { $upnpRequest = Upnp_Api::parseUPnPRequest($requestRaw); debug_event('upnp-cm', 'Request: ' . $requestRaw, '5'); } else { echo 'Error: no UPnP request.'; debug_event('upnp-cm', 'No request', '5'); exit; } switch ($upnpRequest['action']) { case 'getprotocolinfo': $responseType = 'u:GetProtocolInfoResponse'; //$items = Upnp_Api::cm_getProtocolInfo(); break; }
private function prepareURIRequest($song, $prefix) { if ($song == null) { return null; } $songUrl = $song['link']; $songId = preg_replace('/(.+)\\/oid\\/(\\d+)\\/(.+)/i', '${2}', $songUrl); $song = new song($songId); $song->format(); $songItem = Upnp_Api::_itemSong($song, ''); $domDIDL = Upnp_Api::createDIDL($songItem); $xmlDIDL = $domDIDL->saveXML(); return array('InstanceID' => 0, $prefix . 'URI' => $songUrl, $prefix . 'URIMetaData' => htmlentities($xmlDIDL)); }
<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType> <friendlyName><?php echo AmpConfig::get('site_title'); ?> </friendlyName> <manufacturer>ampache.org</manufacturer> <manufacturerURL>http://ampache.org</manufacturerURL> <modelDescription>A web based audio/video streaming application and file manager allowing you to access your music and videos from anywhere, using almost any Internet enabled device.</modelDescription> <modelName>Ampache</modelName> <modelNumber><?php echo AmpConfig::get('version'); ?> </modelNumber> <modelURL>http://ampache.org</modelURL> <UDN>uuid:<?php echo Upnp_Api::get_uuidStr(); ?> </UDN> <iconList> <icon> <mimetype>image/png</mimetype> <width>32</width> <height>32</height> <depth>24</depth> <url><?php echo $web_path; ?> /upnp/images/icon32.png</url> </icon> <icon> <mimetype>image/png</mimetype>