faultCode 804 faultString "); ini_set("error_append_string", " "); header("Content-type: text/xml"); /* ================================================================= includes */ require_once 'DB.php'; require_once "XML/RPC/Server.php"; require_once '../conf.php'; require_once '../LocStor.php'; /* ============================================ setting default error handler */ function errHndl($errno, $errmsg, $filename, $linenum, $vars){ if($errno == 8 /*E_NOTICE*/) return; $xr =& new XML_RPC_Response(0, 805, "ERROR:xrLocStor: $errno $errmsg ($filename:$linenum)"); header("Content-type: text/xml"); echo $xr->serialize(); exit($errno); } $old_error_handler = set_error_handler("errHndl"); /* ====================================== XML-RPC interface class for LocStor */ /** * XML-RPC interface for LocStor class * */ class XR_LocStor extends LocStor{ /* ------------------------------------------------------- authentication */ /** * Checks the login name and password of the user and return * true if login data are correct, othervise return false. * * The XML-RPC name of this method is "locstor.authenticate". * * Input parameters: XML-RPC struct with the following fields: * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see Subjects::authenticate */ function xr_authenticate($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->authenticate($r['login'], $r['pass']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 804,"xr_authenticate: database error"); } $retval = ($res !== FALSE); return new XML_RPC_Response( XML_RPC_encode(array('authenticate'=>$retval)) ); } /** * Checks the login name and password of the user. If the login is * correct, a new session ID string is generated, to be used in all * subsequent XML-RPC calls as the "sessid" field of the * parameters. * * The XML-RPC name of this method is "locstor.login". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see Alib::login */ function xr_login($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->login($r['login'], $r['pass']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 804,"xr_login: database error"); } if($res === FALSE) return new XML_RPC_Response(0, 802, "xr_login: login failed - incorrect username or password." ); else return new XML_RPC_Response(XML_RPC_encode(array('sessid'=>$res))); } /** * Logout, destroy session and return status. * If session is not valid error message is returned. * * The XML-RPC name of this method is "locstor.logout". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see GreenBox::logout */ function xr_logout($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->logout($r['sessid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 803, "xr_logout: logout failed - not logged." ); } return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); } /* ---------------------------------------------------------------- store */ /** * Open writable URL for store new AudioClip or replace existing one. * Writing to returned URL is possible using HTTP PUT method * (as e.g. curl -T <filename> command does) * * The XML-RPC name of this method is "locstor.storeAudioClipOpen". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::storeAudioClipOpen */ function xr_storeAudioClipOpen($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->storeAudioClipOpen( $r['sessid'], $r['gunid'], $r['metadata'], $r['chsum'] ); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_storeAudioClipOpen: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Close writable URL for store new AudioClip or replace existing one. * * The XML-RPC name of this method is "locstor.storeAudioClip". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::storeAudioClipClose */ function xr_storeAudioClipClose($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->storeAudioClipClose($r['sessid'], $r['token']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_storeAudioClipClose: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); } /* ------------------------------------------------ access raw audio data */ /** * Make access to audio clip. * * The XML-RPC name of this method is "locstor.accessRawAudioData". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::accessRawAudioData */ function xr_accessRawAudioData($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->accessRawAudioData($r['sessid'], $r['gunid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_accessRawAudioData: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Release access to audio clip * * The XML-RPC name of this method is "locstor.releaseRawAudioData". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::releaseRawAudioData */ function xr_releaseRawAudioData($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->releaseRawAudioData($r['sessid'], $r['token']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_releaseRawAudioData: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); } /* ---------------------------------------------- download raw audio data */ /** * Create downlodable URL for stored file * * The XML-RPC name of this method is "locstor.downloadRawAudioDataOpen". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::downloadRawAudioDataOpen */ function xr_downloadRawAudioDataOpen($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->downloadRawAudioDataOpen($r['sessid'], $r['gunid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_downloadRawAudioDataOpen: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Delete downlodable URL with media file. * * The XML-RPC name of this method is "locstor.downloadRawAudioDataClose". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::downloadRawAudioDataClose */ function xr_downloadRawAudioDataClose($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->downloadRawAudioDataClose($r['token']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_downloadRawAudioDataClose: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); } /* ---------------------------------------------------- download metadata */ /** * Create downlodable URL for metadata part of stored file * * The XML-RPC name of this method is "locstor.downloadMetadataOpen". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::downloadRawAudioDataOpen */ function xr_downloadMetadataOpen($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->downloadMetadataOpen($r['sessid'], $r['gunid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_downloadMetadataOpen: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Delete downlodable URL with metadata. * * The XML-RPC name of this method is "locstor.downloadMetadataClose". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::downloadRawAudioDataClose */ function xr_downloadMetadataClose($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->downloadMetadataClose($r['token']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_downloadMetadataClose: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res))); } /* --------------------------------------------------------------- delete */ /** * Delete existing audio clip * * The XML-RPC name of this method is "locstor.deleteAudioClip". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::deleteAudioClip */ function xr_deleteAudioClip($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->deleteAudioClip($r['sessid'], $r['gunid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_deleteAudioClip: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); } /*====================================================== playlist methods */ /** * Create a new Playlist metafile. * * The XML-RPC name of this method is "locstor.createPlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::createPlaylist */ function xr_createPlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->createPlaylist($r['sessid'], $r['plid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_createPlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('plid'=>$res))); } /** * Open a Playlist metafile for editing. * Open readable URL and mark file as beeing edited. * * The XML-RPC name of this method is "locstor.editPlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::editPlaylist */ function xr_editPlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->editPlaylist($r['sessid'], $r['plid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_editPlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Store a new Playlist metafile in place of the old one. * * The XML-RPC name of this method is "locstor.savePlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::savePlaylist */ function xr_savePlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->savePlaylist( $r['sessid'], $r['token'], $r['newPlaylist']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_savePlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); } /** * Delete a Playlist metafile. * * The XML-RPC name of this method is "locstor.deletePlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::deletePlaylist */ function xr_deletePlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->deletePlaylist($r['sessid'], $r['plid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_deletePlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); } /** * Access (read) a Playlist metafile. * * The XML-RPC name of this method is "locstor.accessPlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::accessPlaylist */ function xr_accessPlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->accessPlaylist($r['sessid'], $r['plid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_accessPlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Release the resources obtained earlier by accessPlaylist(). * * The XML-RPC name of this method is "locstor.releasePlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::releasePlaylist */ function xr_releasePlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->releasePlaylist($r['sessid'], $r['token']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_releasePlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('plid'=>$res))); } /** * Check whether a Playlist metafile with the given playlist ID exists. * * The XML-RPC name of this method is "locstor.existsPlaylist". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::existsPlaylist */ function xr_existsPlaylist($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->existsPlaylist($r['sessid'], $r['plid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_existsPlaylist: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('exists'=>$res))); } /** * Check whether a Playlist metafile with the given playlist ID * is available for editing, i.e., exists and is not marked as * beeing edited. * * The XML-RPC name of this method is "locstor.playlistIsAvailable". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::playlistIsAvailable */ function xr_playlistIsAvailable($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->playlistIsAvailable($r['sessid'], $r['plid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_playlistIsAvailable: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('available'=>$res))); } /* ----------------------------------------------------------------- etc. */ /** * Check if audio clip exists and return TRUE/FALSE * * The XML-RPC name of this method is "locstor.existsAudioClip". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::existsAudioClip */ function xr_existsAudioClip($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; #$this->debugLog(join(', ', $r)); $res = $this->existsAudioClip($r['sessid'], $r['gunid']); #$this->debugLog($res); if(PEAR::isError($res)) return new XML_RPC_Response(0, 805, "xr_existsAudioClip: ".$res->getMessage(). " ".$res->getUserInfo() ); return new XML_RPC_Response(XML_RPC_encode(array('exists'=>$res))); } /** * Return all file's metadata as XML string * * The XML-RPC name of this method is "locstor.getAudioClip". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::getAudioClip */ function xr_getAudioClip($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->getAudioClip($r['sessid'], $r['gunid']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('metadata'=>$res))); } /** * Update existing audio clip metadata * * The XML-RPC name of this method is "locstor.updateAudioClipMetadata". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::updateAudioClipMetadata */ function xr_updateAudioClipMetadata($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->updateAudioClipMetadata( $r['sessid'], $r['gunid'], $r['metadata'] ); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_updateAudioClip: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res))); } /** * Search in local metadata database * * The XML-RPC name of this method is "locstor.searchMetadata". * * The input parameters are an XML-RPC struct with the following * fields: * * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::searchMetadata * @see GreenBox::localSearch */ function xr_searchMetadata($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->searchMetadata($r['sessid'], $r['criteria']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 803, "xr_searchAudioClip: ".$res->getMessage(). " ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('results'=>$res))); } /** * Reset storageServer for debugging. * * The XML-RPC name of this method is "locstor.resetStorage". * * The input parameters are an empty XML-RPC struct. * * On success, returns a XML-RPC struct with single field: * * * On errors, returns an XML-RPC error response. * The possible error codes and error message are: * * * @param input XMLRPC struct * @return XMLRPC struct * @see LocStor::getAudioClip */ function xr_resetStorage($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->resetStorage(); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('gunids'=>$res))); } /* ------------------------------------------- test methods for debugging */ /** * Test XMLRPC - strupper and return given string, * also return loginname of logged user * - debug method only * * @param input XMLRPC struct * @return XMLRPC struct */ function xr_test($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; return new XML_RPC_Response(XML_RPC_encode(array( 'str'=>strtoupper($r['teststring']), 'login'=>$this->getSessLogin($r['sessid']), 'sessid'=>$r['sessid'] ))); } /** * Open writable URL for put method - debug method only * * @param input XMLRPC struct * @return XMLRPC struct */ function xr_openPut($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->bsOpenPut(); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode($res)); } /** * Close writable URL - debug method only * * @param input XMLRPC struct * @return XMLRPC struct */ function xr_closePut($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; $res = $this->bsClosePut($r['token'], $r['chsum']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() ); } return new XML_RPC_Response(XML_RPC_encode(array('fname'=>$res))); } /* ---------------------------------------------------- "private" methods */ /** * Check and convert struct of parameters * * @param input XMLRPC parameters * @return array */ function _xr_getPars($input) { $p = $input->getParam(0); if(isset($p) && $p->scalartyp()=="struct"){ $r = XML_RPC_decode($p); return array(TRUE, $r); } else return array(FALSE, new XML_RPC_Response(0, 801, "wrong 1st parameter, struct expected." )); } } // end of class definition /* ============================================================= runable code */ PEAR::setErrorHandling(PEAR_ERROR_RETURN); $dbc = DB::connect($config['dsn'], TRUE); $dbc->setFetchMode(DB_FETCHMODE_ASSOC); $locStor = &new XR_LocStor(&$dbc, $config); $methods = array( 'test' => 'Tests toupper and checks sessid, params: '. 'teststring, sessid.', 'authenticate' => 'Checks authentication.', 'login' => 'Login to storage.', 'logout' => 'Logout from storage.', 'existsAudioClip' => 'Checks if an Audio clip with the specified '. 'id is stored in local storage.', 'storeAudioClipOpen' => 'Open channel for store a new audio clip '. 'or replace an existing one.', 'storeAudioClipClose' => 'Close channel for store a new audio clip'. ' or replace an existing one.', 'downloadRawAudioDataOpen'=> 'Create and return downloadable URL'. 'for audio file', 'downloadRawAudioDataClose'=>'Discard downloadable URL for audio file', 'downloadMetadataOpen' => 'Create and return downloadable URL'. 'for metadata', 'downloadMetadataClose' => 'Discard downloadable URL for metadata', 'openPut' => 'openPut', 'closePut' => 'closePut', 'deleteAudioClip' => 'Delete an existing Audio clip.', 'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '. 'stored in Local storage.', 'searchMetadata' => 'Search through the metadata of stored '. 'AudioClips, return all matching clip ids.', 'accessRawAudioData' => 'Get access to raw audio data.', 'releaseRawAudioData' => 'Release access to raw audio data.', 'getAudioClip' => 'Return the contents of an Audio clip.', 'resetStorage' => 'Reset storageServer for debugging.', 'createPlaylist' => 'Create a new Playlist metafile.', 'editPlaylist' => 'Open a Playlist metafile for editing.', 'savePlaylist' => 'Save a Playlist metafile.', 'deletePlaylist' => 'Delete a Playlist metafile.', 'accessPlaylist' => 'Open readable URL to a Playlist metafile.', 'releasePlaylist' => 'Release readable URL from accessPlaylist.', 'existsPlaylist' => 'Check whether a Playlist exists.', 'playlistIsAvailable' => 'Check whether a Playlist is available '. 'for editing.', ); $defs = array(); foreach($methods as $method=>$description){ $defs["locstor.$method"] = array( # "function" => array(&$locStor, "xr_$method"), "function" => "\$GLOBALS['locStor']->xr_$method", "signature" => array( array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct']) ), "docstring" => $description ); } $s=new XML_RPC_Server( $defs ); ?>