New method browseCategory added.
This commit is contained in:
parent
299c46b93d
commit
2e351ca72f
livesupport/modules/storageServer/var
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.26 $
|
||||
Version : $Revision: 1.27 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -35,7 +35,7 @@ require_once "BasicStor.php";
|
|||
* LiveSupport file storage module
|
||||
*
|
||||
* @author $Author: tomas $
|
||||
* @version $Revision: 1.26 $
|
||||
* @version $Revision: 1.27 $
|
||||
* @see BasicStor
|
||||
*/
|
||||
class GreenBox extends BasicStor{
|
||||
|
@ -254,6 +254,8 @@ class GreenBox extends BasicStor{
|
|||
* (may be empty or ommited only with less then 2 items in
|
||||
* "conditions" field)
|
||||
* </li>
|
||||
* <li>limit : int - limit for result arrays (0 means unlimited)</li>
|
||||
* <li>offset : int - starting point (0 means without offset)</li>
|
||||
* <li>conditions - array of hashes with structure:
|
||||
* <ul>
|
||||
* <li>cat - string, metadata category name</li>
|
||||
|
@ -271,9 +273,31 @@ class GreenBox extends BasicStor{
|
|||
*/
|
||||
function localSearch($criteria, $sessid='')
|
||||
{
|
||||
return $this->bsLocalSearch($criteria);
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
return $this->bsLocalSearch($criteria, $limit, $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return values of specified metadata category
|
||||
*
|
||||
* @param category string, metadata category name
|
||||
* with or without namespace prefix (dc:title, author)
|
||||
* @param criteria hash, see localSearch method
|
||||
* @param sessid string
|
||||
* @return hash, fields:
|
||||
* results : array with gunid strings
|
||||
* cnt : integer - number of matching values
|
||||
* @see BasicStor::bsBrowseCategory
|
||||
*/
|
||||
function browseCategory($category, $criteria, $sessid='')
|
||||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------- info methods */
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.24 $
|
||||
Version : $Revision: 1.25 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -257,7 +257,7 @@ class LocStor extends BasicStor{
|
|||
return $md;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- search */
|
||||
/* ------------------------------------------------------- search, browse */
|
||||
/**
|
||||
* Search in metadata database
|
||||
*
|
||||
|
@ -288,18 +288,22 @@ class LocStor extends BasicStor{
|
|||
* <ul>
|
||||
* <li>audioClipResults : array with gunid strings
|
||||
* of audioClips have been found</li>
|
||||
* <li>audioClipCnt : int - number of audioClips matching
|
||||
* the criteria</li>
|
||||
* <li>playlistResults : array with gunid strings
|
||||
* of playlists have been found</li>
|
||||
* <li>playlistCnt : int - number of playlists matching
|
||||
* the criteria</li>
|
||||
* </ul>
|
||||
* @see GreenBox::localSearch
|
||||
*/
|
||||
* @see BasicStor::localSearch
|
||||
*/
|
||||
function searchMetadata($sessid, $criteria)
|
||||
{
|
||||
if(($res = $this->_authorize('read', $this->storId, $sessid)) !== TRUE)
|
||||
return $res;
|
||||
$filetype = strtolower($criteria['filetype']);
|
||||
$limit = intval($criteria['limit']);
|
||||
$offset = intval($criteria['offset']);
|
||||
$filetype = strtolower($criteria['filetype']);
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
if($filetype=='all'){
|
||||
$criteriaAC = $criteria; $criteriaAC['filetype'] = 'audioclip';
|
||||
$criteriaPL = $criteria; $criteriaPL['filetype'] = 'playlist';
|
||||
|
@ -332,6 +336,26 @@ class LocStor extends BasicStor{
|
|||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return values of specified metadata category
|
||||
*
|
||||
* @param category string, metadata category name
|
||||
* with or without namespace prefix (dc:title, author)
|
||||
* @param criteria hash, see searchMetadata method
|
||||
* @param sessid string
|
||||
* @return hash, fields:
|
||||
* results : array with gunid strings
|
||||
* cnt : integer - number of matching values
|
||||
* @see BasicStor::bsBrowseCategory
|
||||
*/
|
||||
function browseCategory($category, $criteria=NULL, $sessid='')
|
||||
{
|
||||
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
|
||||
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
|
||||
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- etc. */
|
||||
/**
|
||||
* Check if audio clip exists
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.11 $
|
||||
Version : $Revision: 1.12 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -159,7 +159,6 @@ class XR_LocStor extends LocStor{
|
|||
*
|
||||
* @param input XMLRPC struct
|
||||
* @return XMLRPC struct
|
||||
* @see GreenBox::logout
|
||||
*/
|
||||
function xr_logout($input)
|
||||
{
|
||||
|
@ -1188,7 +1187,7 @@ class XR_LocStor extends LocStor{
|
|||
* @param input XMLRPC struct
|
||||
* @return XMLRPC struct
|
||||
* @see LocStor::searchMetadata
|
||||
* @see GreenBox::localSearch
|
||||
* @see BasicStor::localSearch
|
||||
*/
|
||||
function xr_searchMetadata($input)
|
||||
{
|
||||
|
@ -1215,7 +1214,66 @@ class XR_LocStor extends LocStor{
|
|||
(count($res['playlistResults'])==0
|
||||
? new XML_RPC_Value(array(), 'array')
|
||||
: XML_RPC_encode($res['playlistResults'])
|
||||
),
|
||||
),
|
||||
));
|
||||
return new XML_RPC_Response($xv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return values of specified metadata category
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.browseCategory".
|
||||
*
|
||||
* The input parameters are an XML-RPC struct with the following
|
||||
* fields:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> category : string - metadata category name
|
||||
* with or without namespace prefix (dc:title, author) </li>
|
||||
* <li> criteria : hash - see searchMetadata method </li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with the following fields:
|
||||
* <ul>
|
||||
* <li> results : array with values having been found </li>
|
||||
* <li> cnt : integer - number of matching values </li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_browseCategory:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @param input XMLRPC struct
|
||||
* @return XMLRPC struct
|
||||
* @see Pref::browseCategory
|
||||
*/
|
||||
function xr_browseCategory($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->browseCategory(
|
||||
$r['category'], $r['criteria'], $r['sessid']
|
||||
);
|
||||
if(PEAR::isError($res)){
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
|
||||
);
|
||||
}
|
||||
$xv = new XML_RPC_Value;
|
||||
$xv->addStruct(array(
|
||||
'cnt' => XML_RPC_encode($res['cnt']),
|
||||
'results' =>
|
||||
(count($res['results'])==0
|
||||
? new XML_RPC_Value(array(), 'array')
|
||||
: XML_RPC_encode($res['results'])
|
||||
),
|
||||
));
|
||||
return new XML_RPC_Response($xv);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.19 $
|
||||
Version : $Revision: 1.20 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -99,7 +99,8 @@ $methods = array(
|
|||
'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.',
|
||||
'files, return all matching clip ids.',
|
||||
'browseCategory' =>'Return values of specified metadata category.',
|
||||
'accessRawAudioData' => 'Get access to raw audio data.',
|
||||
'releaseRawAudioData' => 'Release access to raw audio data.',
|
||||
'getAudioClip' => 'Return the contents of an Audio clip.',
|
||||
|
|
Loading…
Reference in New Issue