Пример #1
0
                                $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');
Пример #2
0
 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));
 }