From 0f77a912eaaeb44fc87c532bd345a34b81cc9ea9 Mon Sep 17 00:00:00 2001 From: tomash Date: Mon, 6 Mar 2006 04:37:28 +0000 Subject: [PATCH] #1599, #1582 dummy XML-RPC interfaces added --- .../src/modules/storageServer/var/LocStor.php | 151 ++++ .../storageServer/var/xmlrpc/XR_LocStor.php | 724 +++++++++++++++++- .../storageServer/var/xmlrpc/xrLocStor.php | 15 + 3 files changed, 889 insertions(+), 1 deletion(-) diff --git a/livesupport/src/modules/storageServer/var/LocStor.php b/livesupport/src/modules/storageServer/var/LocStor.php index 087d1ae2e..41afec93b 100644 --- a/livesupport/src/modules/storageServer/var/LocStor.php +++ b/livesupport/src/modules/storageServer/var/LocStor.php @@ -685,6 +685,11 @@ class LocStor extends BasicStor{ * @param playlistId string, playlist global unique ID * @param getUid boolean, optional flag for returning editedby uid * @return boolean + + + + + */ function playlistIsAvailable($sessid, $playlistId, $getUid=FALSE) { @@ -701,6 +706,152 @@ class LocStor extends BasicStor{ return FALSE; } + /** + * Create a tarfile with playlist export - playlist and all matching + * sub-playlists and media files (if desired) + * + * @param sessid - string, session ID + * @param plid - string, playlist global unique ID + * @param type - string, playlist format, values: lspl | smil | m3u + * @param standalone - boolean, if only playlist should be exported or + * with all related files + * @return hasharray with fields: + * url string: readable url, + * token srring: access token + * chsum string: md5 checksum, + */ + function exportPlaylistOpen($sessid, $plid, $type='lspl', $standalone=FALSE) + { + return PEAR::raiseError( + "LocStor::exportPlaylistOpen: not imnplemented" + ); + } + + /** + * Close playlist export previously opened by the exportPlaylistOpen method + * + * @param token - string, access token obtained from exportPlaylistOpen + * method call + * @return boolean true or error object + */ + function exportPlaylistClose($token) + { + return PEAR::raiseError( + "LocStor::exportPlaylistClose: not imnplemented" + ); + } + + /** + * Open writable handle for import playlist in LS Archive format + * + * @param sessid string, session id + * @param chsum string, md5 checksum of imported file + * @return hasharray with: + * url string: writable URL + * token string: PUT token + */ + function importPlaylistOpen($sessid, $chsum) + { + return PEAR::raiseError( + "LocStor::importPlaylistOpen: not imnplemented" + ); + } + + /** + * Close import-handle and import playlist + * + * @param token string, import token obtained by importPlaylistOpen method + * @return string, result file global id (or error object) + */ + function importPlaylistClose($token) + { + return PEAR::raiseError( + "LocStor::importPlaylistClose: not imnplemented" + ); + } + + function renderPlaylistToFileOpen($sessid, $plid) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToFileOpen: not imnplemented" + ); + } + + function renderPlaylistToFileCheck($token) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToFileCheck: not imnplemented" + ); + } + + function renderPlaylistToFileClose($token) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToFileClose: not imnplemented" + ); + } + + + function renderPlaylistToStorageOpen($sessid, $plid) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToStorageOpen: not imnplemented" + ); + } + + function renderPlaylistToStorageCheck($token) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToStorageCheck: not imnplemented" + ); + } + + + function renderPlaylistToRSSOpen($sessid, $plid) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToRSSOpen: not imnplemented" + ); + } + + function renderPlaylistToRSSCheck($token) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToRSSCheck: not imnplemented" + ); + } + + function renderPlaylistToRSSClose($token) + { + return PEAR::raiseError( + "LocStor::renderPlaylistToRSSClose: not imnplemented" + ); + } + + + /*==================================================storage admin methods */ + /* ------------------------------------------------------- backup methods */ + function locstor.createBackupOpen($sessid, $criteria) + { + return PEAR::raiseError( + "LocStor::createBackupOpen: not imnplemented" + ); + } + + function locstor.createBackupCheck($token) + { + return PEAR::raiseError( + "LocStor::createBackupCheck: not imnplemented" + ); + } + + function locstor.createBackupClose($token) + { + return PEAR::raiseError( + "LocStor::createBackupClose: not imnplemented" + ); + } + /*===================================================== auxiliary methods */ /** * Dummy method - only returns livesupport version diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php index d5cb6002f..60f33a57c 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php @@ -1154,7 +1154,729 @@ class XR_LocStor extends LocStor{ ))); } - /* --------------------------------------------------------- info methods */ + /* ------------------------------------------------------ export playlist */ + /** + * Create a tarfile with playlist export - playlist and all matching + * sub-playlists and media files (if desired) + * + * The XML-RPC name of this method is "locstor.exportPlaylistOpen". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::exportPlaylistOpen + */ + function xr_exportPlaylistOpen($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + if(!isset($t['standalone'])) $r['standalone']=FALSE; + $res = $this->exportPlaylistOpen( + $r['sessid'], $r['plid'], $r['type'], $r['standalone'] + ); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_exportPlaylistOpen: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'url' => $res['url'], + 'token' => $res['token'], + ))); + } + + /** + * Close playlist export previously opened by the exportPlaylistOpen method + * + * The XML-RPC name of this method is "locstor.exportPlaylistClose". + * + * 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::exportPlaylistClose + */ + function xr_exportPlaylistClose($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->exportPlaylistClose($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_exportPlaylistClose: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array('status'=>TRUE))); + } + + /* ------------------------------------------------------ import playlist */ + /** + * Open writable URL for import playlist in LS Archive format + * + * The XML-RPC name of this method is "locstor.importPlaylistOpen". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::importPlaylistOpen + */ + function xr_importPlaylistOpen($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->importPlaylistOpen($r['sessid'], $r['chsum']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_importPlaylistOpen: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'url'=>$res['url'], + 'token'=>$res['token'], + ))); + } + + /** + * Open writable URL for import playlist in LS Archive format + * + * The XML-RPC name of this method is "locstor.importPlaylistClose". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::importPlaylistClose + */ + function xr_importPlaylistClose($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->importPlaylistClose($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_importPlaylistClose: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'gunid'=>$res, + ))); + } + + /* ---------------------------------------------- render playlist to file */ + /** + * Render playlist to ogg file (open handle) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToFileOpen". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToFileOpen + */ + function xr_renderPlaylistToFileOpen($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToFileOpen($r['sessid'], $r['plid']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToFileOpen: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'token'=>$res['token'], + ))); + } + + /** + * Render playlist to ogg file (check results) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToFileCheck". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToFileCheck + */ + function xr_renderPlaylistToFileCheck($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToFileCheck($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToFileCheck: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'url'=>$res['url'], + 'status'=>$res['status'], + ))); + } + + /** + * Render playlist to ogg file (close handle) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToFileClose". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToFileClose + */ + function xr_renderPlaylistToFileClose($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToFileClose($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToFileClose: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'status'=>$res['status'], + ))); + } + + /* ------------------------------------------- render playlist to storage */ + /** + * Render playlist to storage media clip (open handle) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToStorageOpen". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToStorageOpen + */ + function xr_renderPlaylistToStorageOpen($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToStorageOpen($r['sessid'], $r['plid']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToStorageOpen: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'token'=>$res['token'], + ))); + } + + /** + * Render playlist to storage media clip (check results) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToStorageCheck". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToStorageCheck + */ + function xr_renderPlaylistToStorageCheck($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToStorageCheck($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToStorageCheck: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'gunid'=>$res['gunid'], + 'status'=>$res['status'], + ))); + } + + /* ----------------------------------------------- render playlist to RSS */ + /** + * Render playlist to RSS file (open handle) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToRSSOpen". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToRSSOpen + */ + function xr_renderPlaylistToRSSOpen($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToRSSOpen($r['sessid'], $r['plid']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToRSSOpen: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'token'=>$res['token'], + ))); + } + + /** + * Render playlist to RSS file (check results) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToRSSCheck". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToRSSCheck + */ + function xr_renderPlaylistToRSSCheck($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToRSSCheck($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToRSSCheck: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'url'=>$res['url'], + 'status'=>$res['status'], + ))); + } + + /** + * Render playlist to RSS file (close handle) + * + * The XML-RPC name of this method is "locstor.renderPlaylistToRSSClose". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::renderPlaylistToRSSClose + */ + function xr_renderPlaylistToRSSClose($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->renderPlaylistToRSSClose($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_renderPlaylistToRSSClose: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'status'=>$res['status'], + ))); + } + + /*==================================================storage admin methods */ + /* ------------------------------------------------------- backup methods */ + /** + * Create backup of storage (open handle) + * + * The XML-RPC name of this method is "locstor.createBackupOpen". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::createBackupOpen + */ + function xr_createBackupOpen($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->createBackupOpen($r['sessid'], $r['criteria']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_createBackupOpen: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'token'=>$res['token'], + ))); + } + + /** + * Create backup of storage (check results) + * + * The XML-RPC name of this method is "locstor.createBackupCheck". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::createBackupCheck + */ + function xr_createBackupCheck($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->createBackupCheck($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_createBackupCheck: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'url'=>$res['url'], + 'status'=>$res['status'], + 'metafile'=>$res['metafile'], + ))); + } + + /** + * Create backup of storage (close handle) + * + * The XML-RPC name of this method is "locstor.createBackupClose". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with following fields: + * + * + * 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::createBackupClose + */ + function xr_createBackupClose($input) + { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + $res = $this->createBackupClose($r['token']); + if(PEAR::isError($res)){ + return new XML_RPC_Response(0, 805, + "xr_createBackupClose: ".$res->getMessage(). + " ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array( + 'status'=>$res['status'], + ))); + } + + /*========================================================== info methods */ /** * Check if audio clip exists and return TRUE/FALSE * diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php b/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php index 577611c06..6768aec5e 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php @@ -137,6 +137,21 @@ $methods = array( 'importPlaylistOpen' => 'Open writable handle for playlist import.', 'importPlaylistClose' => 'Close import-handle and import playlist.', + 'renderPlaylistToFileOpen' => 'Render playlist to ogg file (open handle)', + 'renderPlaylistToFileCheck' => 'Render playlist to ogg file (check results)', + 'renderPlaylistToFileClose' => 'Render playlist to ogg file (close handle)', + + 'renderPlaylistToStorageOpen' => 'Render playlist to storage media clip (open handle)', + 'renderPlaylistToStorageCheck' => 'Render playlist to storage media clip (check results)', + + 'renderPlaylistToRSSOpen' => 'Render playlist to RSS file (open handle)', + 'renderPlaylistToRSSCheck' => 'Render playlist to RSS file (check results)', + 'renderPlaylistToRSSClose' => 'Render playlist to RSS file (close handle)', + + 'locstor.createBackupOpen' => 'Create backup of storage (open handle)', + 'locstor.createBackupCheck' => 'Create backup of storage (check results)', + 'locstor.createBackupClose' => 'Create backup of storage (close handle)', + 'loadPref' => 'Load user preference value.', 'savePref' => 'Save user preference value.', 'delPref' => 'Delete user preference record.',