Playlist methods added in PHP and XMLRPC layers.
+solved bug: http://bugs.campware.org/view.php?id=520 +minor change in _createGunid - for only non-negative bigint.
This commit is contained in:
parent
7adc50d7da
commit
f57fa14fbd
|
@ -20,7 +20,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: tomas $
|
# Author : $Author: tomas $
|
||||||
# Version : $Revision: 1.6 $
|
# Version : $Revision: 1.7 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -119,6 +119,7 @@ distclean: clean docclean
|
||||||
|
|
||||||
testonly: ${TEST_RUNNER}
|
testonly: ${TEST_RUNNER}
|
||||||
${TEST_RUNNER}
|
${TEST_RUNNER}
|
||||||
|
${TEST_RUNNER} playlists
|
||||||
# $(MAKE) transtest
|
# $(MAKE) transtest
|
||||||
|
|
||||||
check: all testonly
|
check: all testonly
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -48,7 +48,7 @@ require_once "Transport.php";
|
||||||
* Core of LiveSupport file storage module
|
* Core of LiveSupport file storage module
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
* @see Alib
|
* @see Alib
|
||||||
*/
|
*/
|
||||||
class BasicStor extends Alib{
|
class BasicStor extends Alib{
|
||||||
|
@ -224,7 +224,7 @@ class BasicStor extends Alib{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return access link to media file
|
* Create and return access link to real file
|
||||||
*
|
*
|
||||||
* @param realFname string, local filepath to accessed file
|
* @param realFname string, local filepath to accessed file
|
||||||
* @param ext string, useful filename extension for accessed file
|
* @param ext string, useful filename extension for accessed file
|
||||||
|
@ -261,7 +261,7 @@ class BasicStor extends Alib{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release access link to media file
|
* Release access link to real file
|
||||||
*
|
*
|
||||||
* @param token string, access token
|
* @param token string, access token
|
||||||
* @param type string 'access'|'download'
|
* @param type string 'access'|'download'
|
||||||
|
@ -312,17 +312,7 @@ class BasicStor extends Alib{
|
||||||
$ext = $ac->_getExt();
|
$ext = $ac->_getExt();
|
||||||
break;
|
break;
|
||||||
case"metadata":
|
case"metadata":
|
||||||
$md = $this->bsGetMdata($id);
|
$fname = $ac->_getRealMDFname();
|
||||||
$fname = "{$this->bufferDir}/$gunid";
|
|
||||||
$e = FALSE;
|
|
||||||
if(!$fh = fopen($fname, "w")){ $e = TRUE; }
|
|
||||||
elseif(fwrite($fh, $md) === FALSE){ $e = TRUE; }
|
|
||||||
if($e){
|
|
||||||
return PEAR::raiseError(
|
|
||||||
"BasicStor::bsOpenDownload: can't write ($fname)",
|
|
||||||
GBERR_FILEIO);
|
|
||||||
}
|
|
||||||
fclose($fh);
|
|
||||||
$ext = "xml";
|
$ext = "xml";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -341,15 +331,10 @@ class BasicStor extends Alib{
|
||||||
*/
|
*/
|
||||||
function bsCloseDownload($token, $part='media')
|
function bsCloseDownload($token, $part='media')
|
||||||
{
|
{
|
||||||
if($part == 'metadata'){
|
if(!$this->bsCheckToken($token, 'download')){
|
||||||
$gunid = $this->dbc->getOne("
|
return PEAR::raiseError(
|
||||||
SELECT to_hex(gunid)as gunid FROM {$this->accessTable}
|
"BasicStor::bsCloseDownload: invalid token ($token)"
|
||||||
WHERE token=x'{$token}'::bigint AND type='download'
|
);
|
||||||
");
|
|
||||||
if(PEAR::isError($gunid)){ return $gunid; }
|
|
||||||
$gunid = StoredFile::_normalizeGunid($gunid);
|
|
||||||
$fname = "{$this->bufferDir}/$gunid";
|
|
||||||
@unlink($fname);
|
|
||||||
}
|
}
|
||||||
return $this->bsRelease($token, 'download');
|
return $this->bsRelease($token, 'download');
|
||||||
}
|
}
|
||||||
|
@ -381,7 +366,8 @@ class BasicStor extends Alib{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file from writable URL and insert it to the storage
|
* Get file from writable URL and return local filename.
|
||||||
|
* Caller should move or unlink this file.
|
||||||
*
|
*
|
||||||
* @param token string, PUT token
|
* @param token string, PUT token
|
||||||
* @return string, local path of the file having been put
|
* @return string, local path of the file having been put
|
||||||
|
@ -473,62 +459,27 @@ class BasicStor extends Alib{
|
||||||
/* ------------------------------------------------------------- metadata */
|
/* ------------------------------------------------------------- metadata */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update metadata tree
|
* Replace metadata with new XML file or string
|
||||||
*
|
*
|
||||||
* @param id int, virt.file's local id
|
* @param id int, virt.file's local id
|
||||||
* @param mdataFile string, local path of metadata XML file
|
* @param mdata string, local path of metadata XML file
|
||||||
|
* @param mdataLoc string 'file'|'string'
|
||||||
* @return boolean or PEAR::error
|
* @return boolean or PEAR::error
|
||||||
*/
|
*/
|
||||||
function bsUpdateMetadata($id, $mdataFile)
|
function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recall(&$this, $id);
|
$ac =& StoredFile::recall(&$this, $id);
|
||||||
if(PEAR::isError($ac)) return $ac;
|
if(PEAR::isError($ac)) return $ac;
|
||||||
return $ac->updateMetaData($mdataFile);
|
return $ac->replaceMetaData($mdata, $mdataLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update object namespace and value of one metadata record
|
* Get metadata as XML string
|
||||||
*
|
|
||||||
* @param id int, virt.file's local id
|
|
||||||
* @param mdid int, metadata record id
|
|
||||||
* @param object string, object value, e.g. title string
|
|
||||||
* @param objns string, object namespace prefix, have to be defined
|
|
||||||
* in file's metadata (or reserved prefix)
|
|
||||||
* @return boolean or PEAR::error
|
|
||||||
* @see MetaData
|
|
||||||
*/
|
|
||||||
function bsUpdateMetadataRecord($id, $mdid, $object, $objns='_L')
|
|
||||||
{
|
|
||||||
$ac =& StoredFile::recall(&$this, $id);
|
|
||||||
if(PEAR::isError($ac)) return $ac;
|
|
||||||
return $ac->updateMetaDataRecord($mdid, $object, $objns);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add single metadata record.<br>
|
|
||||||
* <b>TODO: NOT FINISHED</b><br>
|
|
||||||
* Params could be changed!
|
|
||||||
*
|
|
||||||
* @param id int, virt.file's local id
|
|
||||||
* @param propertyName string
|
|
||||||
* @param propertyValue string
|
|
||||||
* @return boolean or PEAR::error
|
|
||||||
* @see MetaData
|
|
||||||
*/
|
|
||||||
function bsAddMetaDataRecord($id, $propertyName, $propertyValue)
|
|
||||||
{
|
|
||||||
return PEAR::raiseError(
|
|
||||||
'GreenBox::addMetaDataRecord: not implemented', GBERR_NOTIMPL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get metadata XML tree as string
|
|
||||||
*
|
*
|
||||||
* @param id int, virt.file's local id
|
* @param id int, virt.file's local id
|
||||||
* @return string or PEAR::error
|
* @return string or PEAR::error
|
||||||
*/
|
*/
|
||||||
function bsGetMdata($id)
|
function bsGetMetadata($id)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recall(&$this, $id);
|
$ac =& StoredFile::recall(&$this, $id);
|
||||||
if(PEAR::isError($ac)) return $ac;
|
if(PEAR::isError($ac)) return $ac;
|
||||||
|
@ -647,202 +598,6 @@ class BasicStor extends Alib{
|
||||||
return $nid;
|
return $nid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- remote repository methods */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Upload file to remote repository
|
|
||||||
*
|
|
||||||
* @param id int, virt.file's local id
|
|
||||||
* @param gunid string, global id
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return string - transfer id or PEAR::error
|
|
||||||
*/
|
|
||||||
function uploadFile($id, $gunid, $sessid='')
|
|
||||||
{
|
|
||||||
$res = $this->prepareForTransport($id, $gunid, $sessid);
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
list($mediaFile, $mdataFile, $gunid) = $res;
|
|
||||||
$tr =& new Transport(&$this->dbc, $this->config);
|
|
||||||
$res = $tr->uploadOpen($mediaFile, 'media', $sessid, $gunid);
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
$res2 = $tr->uploadOpen($mdataFile, 'metadata', $sessid, $gunid);
|
|
||||||
if(PEAR::isError($res2)) return $res2;
|
|
||||||
$res3 = $tr->getTransportStatus($res);
|
|
||||||
$res4 = $tr->getTransportStatus($res2);
|
|
||||||
# return $res;
|
|
||||||
return array($res, $res2, $res3, $res4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Download file from remote repository
|
|
||||||
*
|
|
||||||
* @param gunid int, global unique id
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return string - transfer id or PEAR::error
|
|
||||||
*/
|
|
||||||
function downloadFile($gunid, $sessid='')
|
|
||||||
{
|
|
||||||
$tr =& new Transport(&$this->dbc, $this->config);
|
|
||||||
// get home dir if needed
|
|
||||||
$res = $tr->downloadOpen($sessid, 'media', $gunid,
|
|
||||||
$this->getSessUserId($sessid)
|
|
||||||
);
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
$res2 = $tr->downloadOpen($sessid, 'metadata', $gunid,
|
|
||||||
$this->getSessUserId($sessid)
|
|
||||||
);
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
$res3 = $tr->getTransportStatus($res);
|
|
||||||
$res4 = $tr->getTransportStatus($res2);
|
|
||||||
# return $res;
|
|
||||||
return array($res, $res2, $res3, $res4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method for handling interupted transports via cron
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function cronJob()
|
|
||||||
{
|
|
||||||
$tr =& new Transport(&$this->dbc, $this->config);
|
|
||||||
$ru = $tr->uploadCron();
|
|
||||||
$rd = $tr->downloadCron(&$this);
|
|
||||||
return array($ru, $rd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get status of asynchronous transfer
|
|
||||||
*
|
|
||||||
* @param transferId int, id of asynchronous transfer
|
|
||||||
* returned by uploadFile or downloadFile methods
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return string or PEAR::error
|
|
||||||
*/
|
|
||||||
function getTransferStatus($transferId, $sessid='')
|
|
||||||
{
|
|
||||||
return PEAR::raiseError(
|
|
||||||
'GreenBox::getTransferStatus: not implemented', GBERR_NOTIMPL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare symlink to media file and create metadata file for transport
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param gunid
|
|
||||||
* @param sessid
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function prepareForTransport($id, $gunid, $sessid='')
|
|
||||||
{
|
|
||||||
if(!$gunid) $gunid = $this->_gunidFromId($id);
|
|
||||||
else $id = $this->_idFromGunid($gunid);
|
|
||||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
|
||||||
if(PEAR::isError($ac)) return $ac;
|
|
||||||
$mediaTarget = $ac->_getRealRADFname();
|
|
||||||
$mediaFile = "$gunid";
|
|
||||||
$mdataFile = "$gunid.xml";
|
|
||||||
@symlink($mediaTarget, $this->transDir."/$mediaFile");
|
|
||||||
$mdata = $this->getMdata($id, $sessid);
|
|
||||||
if(PEAR::isError($mdata)) return $mdata;
|
|
||||||
if(!($fh = fopen($this->transDir."/$mdataFile", 'w'))) $res=FALSE;
|
|
||||||
else{
|
|
||||||
$res = fwrite($fh, $mdata);
|
|
||||||
fclose($fh);
|
|
||||||
}
|
|
||||||
if($res === FALSE) return PEAR::raiseError(
|
|
||||||
"GreenBox::prepareForTransport:".
|
|
||||||
" can't write metadata tmp file ($mdataFile)"
|
|
||||||
);
|
|
||||||
return array($mediaFile, $mdataFile, $gunid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert transported file and metadata into storage.<br>
|
|
||||||
* TODO: cals methods from LocStor - it's not good
|
|
||||||
*
|
|
||||||
* @param sessid string - session id
|
|
||||||
* @param file string - local path to filr
|
|
||||||
* @param type string - media|metadata|search
|
|
||||||
* @param gunid string - global unique id
|
|
||||||
*/
|
|
||||||
function processTransported($sessid, $file, $type, $gunid='X')
|
|
||||||
{
|
|
||||||
switch($type){
|
|
||||||
case 'media':
|
|
||||||
if(!file_exists($file)) break;
|
|
||||||
$res = $this->storeAudioClip($sessid, $gunid,
|
|
||||||
$file, '');
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
@unlink($file);
|
|
||||||
break;
|
|
||||||
case 'metadata':
|
|
||||||
case 'mdata':
|
|
||||||
if(!file_exists($file)) break;
|
|
||||||
$res = $this->updateAudioClipMetadata($sessid, $gunid,
|
|
||||||
$file);
|
|
||||||
if(PEAR::isError($res)){
|
|
||||||
// catch valid exception
|
|
||||||
if($res->getCode() == GBERR_FOBJNEX){
|
|
||||||
$res2 = $this->storeAudioClip($sessid, $gunid,
|
|
||||||
'', $file);
|
|
||||||
if(PEAR::isError($res2)) return $res2;
|
|
||||||
}else return $res;
|
|
||||||
}
|
|
||||||
@unlink($file);
|
|
||||||
break;
|
|
||||||
case 'search':
|
|
||||||
//$this->localSearch($criteria);
|
|
||||||
return PEAR::raiseError("processTranferred: search not implemented");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return PEAR::raiseError("processTranferred: unknown type ($type)");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search in central metadata database
|
|
||||||
*
|
|
||||||
* @param criteria string, search query - see localSearch method
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return string - job id or PEAR::error
|
|
||||||
*/
|
|
||||||
function globalSearch($criteria, $sessid='')
|
|
||||||
{
|
|
||||||
return PEAR::raiseError(
|
|
||||||
'GreenBox::globalSearch: not implemented', GBERR_NOTIMPL
|
|
||||||
);
|
|
||||||
/*
|
|
||||||
$srchid = md5($sessid.mtime());
|
|
||||||
$fh = fopen($this->transDir."/$srchid", "w");
|
|
||||||
fwrite($fh, serialize($criteria));
|
|
||||||
fclose($fh);
|
|
||||||
$res = $tr->uploadOpen($srchid, 'search', $sessid, $gunid);
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
return $res;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get results from asynchronous search
|
|
||||||
*
|
|
||||||
* @param transferId int, transfer id returned by
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return array with results or PEAR::error
|
|
||||||
*/
|
|
||||||
function getSearchResults($transferId, $sessid='')
|
|
||||||
{
|
|
||||||
return PEAR::raiseError(
|
|
||||||
'GreenBox::getSearchResults: not implemented', GBERR_NOTIMPL
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =============================================== test and debug methods */
|
/* =============================================== test and debug methods */
|
||||||
/**
|
/**
|
||||||
* dump
|
* dump
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.14 $
|
Version : $Revision: 1.15 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
|
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
|
* LiveSupport file storage module
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.14 $
|
* @version $Revision: 1.15 $
|
||||||
* @see BasicStor
|
* @see BasicStor
|
||||||
*/
|
*/
|
||||||
class GreenBox extends BasicStor{
|
class GreenBox extends BasicStor{
|
||||||
|
@ -228,58 +228,21 @@ class GreenBox extends BasicStor{
|
||||||
/* ------------------------------------------------------------- metadata */
|
/* ------------------------------------------------------------- metadata */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update metadata tree
|
* Replace metadata with new XML file or string
|
||||||
*
|
*
|
||||||
* @param id int, virt.file's local id
|
* @param id int, virt.file's local id
|
||||||
* @param mdataFile string, local path of metadata XML file
|
* @param mdata string, local path of metadata XML file
|
||||||
|
* @param mdataLoc string 'file'|'string'
|
||||||
* @param sessid string, session id
|
* @param sessid string, session id
|
||||||
* @return boolean or PEAR::error
|
* @return boolean or PEAR::error
|
||||||
*/
|
*/
|
||||||
function updateMetadata($id, $mdataFile, $sessid='')
|
function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
|
||||||
{
|
{
|
||||||
if(($res = $this->_authorize('write', $id, $sessid)) !== TRUE)
|
if(($res = $this->_authorize('write', $id, $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
return $this->bsUpdateMetadata($id, $mdataFile);
|
return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update object namespace and value of one metadata record
|
|
||||||
*
|
|
||||||
* @param id int, virt.file's local id
|
|
||||||
* @param mdid int, metadata record id
|
|
||||||
* @param object string, object value, e.g. title string
|
|
||||||
* @param objns string, object namespace prefix, have to be defined
|
|
||||||
* in file's metadata (or reserved prefix)
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return boolean or PEAR::error
|
|
||||||
* @see MetaData
|
|
||||||
*/
|
|
||||||
function updateMetadataRecord($id, $mdid, $object, $objns='_L', $sessid='')
|
|
||||||
{
|
|
||||||
if(($res = $this->_authorize('write', $id, $sessid)) !== TRUE)
|
|
||||||
return $res;
|
|
||||||
return $this->bsUpdateMetadataRecord($id, $mdid, $object, $objns);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add single metadata record.<br>
|
|
||||||
* <b>TODO: NOT FINISHED</b><br>
|
|
||||||
* Params could be changed!
|
|
||||||
*
|
|
||||||
* @param id int, virt.file's local id
|
|
||||||
* @param propertyName string
|
|
||||||
* @param propertyValue string
|
|
||||||
* @param sessid string, session id
|
|
||||||
* @return boolean or PEAR::error
|
|
||||||
* @see MetaData
|
|
||||||
*/
|
|
||||||
function addMetaDataRecord($id, $propertyName, $propertyValue, $sessid='')
|
|
||||||
{
|
|
||||||
if(($res = $this->_authorize('write', $id, $sessid)) !== TRUE)
|
|
||||||
return $res;
|
|
||||||
return $this->bsAddMetaDataRecord($id, $propertyName, $propertyValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get metadata XML tree as string
|
* Get metadata XML tree as string
|
||||||
*
|
*
|
||||||
|
@ -291,7 +254,7 @@ class GreenBox extends BasicStor{
|
||||||
{
|
{
|
||||||
if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE)
|
if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
return $this->bsGetMdata($id);
|
return $this->bsGetMetadata($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.13 $
|
Version : $Revision: 1.14 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -109,7 +109,7 @@ class LocStor extends GreenBox{
|
||||||
if(PEAR::isError($fname)){ return $fname; }
|
if(PEAR::isError($fname)){ return $fname; }
|
||||||
$res = $ac->replaceRawMediaData($fname);
|
$res = $ac->replaceRawMediaData($fname);
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
@unlink($fname);
|
if(file_exists($fname)) @unlink($fname);
|
||||||
$res = $ac->setState('ready');
|
$res = $ac->setState('ready');
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
return $ac->gunid;
|
return $ac->gunid;
|
||||||
|
@ -257,7 +257,11 @@ class LocStor extends GreenBox{
|
||||||
*/
|
*/
|
||||||
function existsAudioClip($sessid, $gunid)
|
function existsAudioClip($sessid, $gunid)
|
||||||
{
|
{
|
||||||
return LocStor::existsFile($sessid, $gunid, 'audioclip');
|
$ex = $this->existsFile($sessid, $gunid, 'audioclip');
|
||||||
|
if(!$ex) return FALSE;
|
||||||
|
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||||
|
if(PEAR::isError($ac)){ return $ac; }
|
||||||
|
return $ac->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -282,10 +286,10 @@ class LocStor extends GreenBox{
|
||||||
default: return $ac;
|
default: return $ac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!is_null($ftype) && $ac->_getType() != $ftype) return FALSE;
|
if(!is_null($ftype) && ($ac->_getType() != $ftype)) return FALSE;
|
||||||
if(($res = $this->_authorize('read', $ac->getId(), $sessid)) !== TRUE)
|
if(($res = $this->_authorize('read', $ac->getId(), $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
return $ac->exists();
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,5 +354,224 @@ class LocStor extends GreenBox{
|
||||||
$this->logout($this->sessid);
|
$this->logout($this->sessid);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*====================================================== playlist methods */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Playlist metafile.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return string, playlist global unique ID
|
||||||
|
*/
|
||||||
|
function createPlaylist($sessid, $playlistId)
|
||||||
|
{
|
||||||
|
$ex = $this->existsPlaylist($sessid, $playlistId);
|
||||||
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
|
if($ex){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: createPlaylist: already exists'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$tmpid = uniqid('');
|
||||||
|
$parid = $this->_getHomeDirId($sessid);
|
||||||
|
if(PEAR::isError($parid)) return $parid;
|
||||||
|
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
||||||
|
return $res;
|
||||||
|
$oid = $this->addObj($tmpid , 'File', $parid);
|
||||||
|
if(PEAR::isError($oid)) return $oid;
|
||||||
|
$ac =& StoredFile::insert(&$this, $oid, '', '',
|
||||||
|
'<?xml version="1.0" encoding="UTF-8"?><smil><body/></smil>',
|
||||||
|
'string', $playlistId, 'playlist'
|
||||||
|
);
|
||||||
|
if(PEAR::isError($ac)){
|
||||||
|
$res = $this->removeObj($oid);
|
||||||
|
return $ac;
|
||||||
|
}
|
||||||
|
$res = $this->renameFile($oid, $ac->gunid, $sessid);
|
||||||
|
if(PEAR::isError($res)) return $res;
|
||||||
|
$res = $ac->setState('ready');
|
||||||
|
if(PEAR::isError($res)) return $res;
|
||||||
|
$res = $ac->setMime('application/smil');
|
||||||
|
if(PEAR::isError($res)) return $res;
|
||||||
|
return $playlistId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open a Playlist metafile for editing.
|
||||||
|
* Open readable URL and mark file as beeing edited.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return struct {url:readable URL for HTTP GET, token:access token}
|
||||||
|
*/
|
||||||
|
function editPlaylist($sessid, $playlistId)
|
||||||
|
{
|
||||||
|
$ex = $this->existsPlaylist($sessid, $playlistId);
|
||||||
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
|
if(!$ex){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: editPlaylist: playlist not exists'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if($this->_isEdited($playlistId)){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: editPlaylist: playlist already edited'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$ac =& StoredFile::recallByGunid(&$this, $playlistId);
|
||||||
|
if(PEAR::isError($ac)){ return $ac; }
|
||||||
|
$id = $ac->getId();
|
||||||
|
$res = $this->bsOpenDownload($id, 'metadata');
|
||||||
|
if(PEAR::isError($res)){ return $res; }
|
||||||
|
$this->_setEditFlag($playlistId, TRUE);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a new Playlist metafile in place of the old one.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistToken string, playlist access token
|
||||||
|
* @param newPlaylist string, new playlist as XML string
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function savePlaylist($sessid, $playlistToken, $newPlaylist)
|
||||||
|
{
|
||||||
|
$playlistId = $this->bsCloseDownload($playlistToken, $part='metadata');
|
||||||
|
$ac =& StoredFile::recallByGunid(&$this, $playlistId);
|
||||||
|
if(PEAR::isError($ac)){ return $ac; }
|
||||||
|
$res = $ac->replaceMetaData($newPlaylist, $mdataLoc='string');
|
||||||
|
if(PEAR::isError($res)){ return $res; }
|
||||||
|
$this->_setEditFlag($playlistId, FALSE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a Playlist metafile.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function deletePlaylist($sessid, $playlistId)
|
||||||
|
{
|
||||||
|
$ex = $this->existsPlaylist($sessid, $playlistId);
|
||||||
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
|
if(!$ex){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: deletePlaylist: playlist not exists'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$ac =& StoredFile::recallByGunid(&$this, $playlistId);
|
||||||
|
if(PEAR::isError($ac)) return $ac;
|
||||||
|
if(($res = $this->_authorize('write', $ac->getId(), $sessid)) !== TRUE)
|
||||||
|
return $res;
|
||||||
|
if($this->_isEdited($playlistId)){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: deletePlaylist: playlist is edited'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$res = $this->deleteFile($ac->getId(), $sessid);
|
||||||
|
if(PEAR::isError($res)) return $res;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Access (read) a Playlist metafile.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return struct {url:readable URL for HTTP GET, token:access token
|
||||||
|
*/
|
||||||
|
function accessPlaylist($sessid, $playlistId)
|
||||||
|
{
|
||||||
|
$ex = $this->existsPlaylist($sessid, $playlistId);
|
||||||
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
|
if(!$ex){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: accessPlaylist: playlist not found'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$id = $this->_idFromGunid($playlistId);
|
||||||
|
if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE)
|
||||||
|
return $res;
|
||||||
|
return $this->bsOpenDownload($id, 'metadata');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release the resources obtained earlier by accessPlaylist().
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistToken string, playlist access token
|
||||||
|
* @return string, playlist ID
|
||||||
|
*/
|
||||||
|
function releasePlaylist($sessid, $playlistToken)
|
||||||
|
{
|
||||||
|
return $this->bsCloseDownload($playlistToken, 'metadata');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a Playlist metafile with the given playlist ID exists.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function existsPlaylist($sessid, $playlistId)
|
||||||
|
{
|
||||||
|
return $this->existsFile($sessid, $playlistId, 'playlist');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a Playlist metafile with the given playlist ID
|
||||||
|
* is available for editing, i.e., exists and is not marked as
|
||||||
|
* beeing edited.
|
||||||
|
*
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function playlistIsAvailable($sessid, $playlistId)
|
||||||
|
{
|
||||||
|
$ex = $this->existsPlaylist($sessid, $playlistId);
|
||||||
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
|
if(!$ex){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
'LocStor.php: playlistIsAvailable: playlist not exists'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return !$this->_isEdited($playlistId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------- "private" methods */
|
||||||
|
/**
|
||||||
|
* Check if playlist is marked as edited
|
||||||
|
*
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function _isEdited($playlistId)
|
||||||
|
{
|
||||||
|
$state = StoredFile::_getState($playlistId);
|
||||||
|
if($state == 'edited'){ return TRUE; }
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set edit flag
|
||||||
|
*
|
||||||
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @param val boolean, set/clear of edit flag
|
||||||
|
* @return boolean, previous state
|
||||||
|
*/
|
||||||
|
function _setEditFlag($playlistId, $val=TRUE)
|
||||||
|
{
|
||||||
|
$ac =& StoredFile::recallByGunid(&$this, $playlistId);
|
||||||
|
$state = $ac->_getState();
|
||||||
|
if($val){ $ac->setState('edited'); }
|
||||||
|
else{ $ac->setState('ready'); }
|
||||||
|
return ($state == 'edited');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.7 $
|
Version : $Revision: 1.8 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/MetaData.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/MetaData.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -43,14 +43,17 @@ class MetaData{
|
||||||
*
|
*
|
||||||
* @param gb reference to GreenBox object
|
* @param gb reference to GreenBox object
|
||||||
* @param gunid string, global unique id
|
* @param gunid string, global unique id
|
||||||
|
* @param resDir string, resource directory
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
function MetaData(&$gb, $gunid)
|
function MetaData(&$gb, $gunid, $resDir)
|
||||||
{
|
{
|
||||||
$this->dbc =& $gb->dbc;
|
$this->dbc =& $gb->dbc;
|
||||||
$this->mdataTable = $gb->mdataTable;
|
$this->mdataTable = $gb->mdataTable;
|
||||||
$this->gunid = $gunid;
|
$this->gunid = $gunid;
|
||||||
$this->exists = $this->dbCheck($gunid);
|
$this->resDir = $resDir;
|
||||||
|
$this->fname = $this->makeFname();
|
||||||
|
$this->exists = $this->dbCheck($gunid) && file_exists($this->fname);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Parse and store metadata from XML file or XML string
|
* Parse and store metadata from XML file or XML string
|
||||||
|
@ -64,6 +67,32 @@ class MetaData{
|
||||||
if($this->exists) return FALSE;
|
if($this->exists) return FALSE;
|
||||||
$res = $this->storeXMLDoc($mdata, $loc);
|
$res = $this->storeXMLDoc($mdata, $loc);
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
|
switch($loc){
|
||||||
|
case"file":
|
||||||
|
if(! @copy($mdata, $this->fname)){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
"MetaData::insert: file save failed".
|
||||||
|
" ($mdata, {$this->fname})",GBERR_FILEIO
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case"string":
|
||||||
|
$fname = $this->fname;
|
||||||
|
$e = FALSE;
|
||||||
|
if(!$fh = fopen($fname, "w")){ $e = TRUE; }
|
||||||
|
elseif(fwrite($fh, $mdata) === FALSE){ $e = TRUE; }
|
||||||
|
if($e){
|
||||||
|
return PEAR::raiseError(
|
||||||
|
"BasicStor::bsOpenDownload: can't write ($fname)",
|
||||||
|
GBERR_FILEIO);
|
||||||
|
}
|
||||||
|
fclose($fh);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return PEAR::raiseError(
|
||||||
|
"MetaData::insert: unsupported metadata location ($loc)"
|
||||||
|
);
|
||||||
|
}
|
||||||
$this->exists = TRUE;
|
$this->exists = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -76,11 +105,14 @@ class MetaData{
|
||||||
*/
|
*/
|
||||||
function update($mdata, $loc='file')
|
function update($mdata, $loc='file')
|
||||||
{
|
{
|
||||||
|
return $this->replace($mdata, $loc);
|
||||||
|
/*
|
||||||
if(!$this->exists) return FALSE;
|
if(!$this->exists) return FALSE;
|
||||||
$res = $this->storeXMLDoc($mdata, $loc, 'update');
|
$res = $this->storeXMLDoc($mdata, $loc, 'update');
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
$this->exists = TRUE;
|
$this->exists = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Call delete and insert
|
* Call delete and insert
|
||||||
|
@ -111,6 +143,7 @@ class MetaData{
|
||||||
*/
|
*/
|
||||||
function delete()
|
function delete()
|
||||||
{
|
{
|
||||||
|
if(file_exists($fname)) @unlink($this->fname);
|
||||||
$res = $this->dbc->query("
|
$res = $this->dbc->query("
|
||||||
DELETE FROM {$this->mdataTable}
|
DELETE FROM {$this->mdataTable}
|
||||||
WHERE gunid=x'{$this->gunid}'::bigint
|
WHERE gunid=x'{$this->gunid}'::bigint
|
||||||
|
@ -126,9 +159,30 @@ class MetaData{
|
||||||
*/
|
*/
|
||||||
function getMetaData()
|
function getMetaData()
|
||||||
{
|
{
|
||||||
return $this->genXMLDoc();
|
// return $this->genXMLDoc(); // obsolete
|
||||||
|
return file_get_contents($this->fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contruct filepath of metadata file
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function makeFname()
|
||||||
|
{
|
||||||
|
return "{$this->resDir}/{$this->gunid}.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return filename
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getFname()
|
||||||
|
{
|
||||||
|
return $this->fname;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there are any file's metadata in database
|
* Check if there are any file's metadata in database
|
||||||
*
|
*
|
||||||
|
@ -146,6 +200,7 @@ class MetaData{
|
||||||
return (intval($cnt) > 0);
|
return (intval($cnt) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ============================================= parse and store metadata */
|
||||||
/**
|
/**
|
||||||
* Parse and insert or update metadata XML to database
|
* Parse and insert or update metadata XML to database
|
||||||
*
|
*
|
||||||
|
@ -156,10 +211,22 @@ class MetaData{
|
||||||
*/
|
*/
|
||||||
function storeXMLDoc($mdata='', $loc='file', $mode='insert')
|
function storeXMLDoc($mdata='', $loc='file', $mode='insert')
|
||||||
{
|
{
|
||||||
if($loc=='file' && file_exists($mdata)){
|
switch($loc){
|
||||||
$xml = domxml_open_file($mdata);
|
case"file":
|
||||||
}else{
|
if(!file_exists($mdata)){
|
||||||
$xml = domxml_open_mem($mdata);
|
return PEAR::raiseError(
|
||||||
|
"MetaData::storeXMLDoc: metadata file not found ($mdata)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$xml = domxml_open_file($mdata);
|
||||||
|
break;
|
||||||
|
case"string":
|
||||||
|
$xml = domxml_open_mem($mdata);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return PEAR::raiseError(
|
||||||
|
"MetaData::storeXMLDoc: unsupported metadata location ($loc)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$root = $xml->document_element();
|
$root = $xml->document_element();
|
||||||
if(!is_object($root)) return PEAR::raiseError(
|
if(!is_object($root)) return PEAR::raiseError(
|
||||||
|
@ -375,6 +442,8 @@ class MetaData{
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* =========================================== XML reconstruction from db */
|
||||||
/**
|
/**
|
||||||
* Generate XML document from metadata database
|
* Generate XML document from metadata database
|
||||||
*
|
*
|
||||||
|
@ -460,6 +529,7 @@ class MetaData{
|
||||||
$qh->free();
|
$qh->free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========================================================= test methods */
|
||||||
/**
|
/**
|
||||||
* Test method
|
* Test method
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/RawMediaData.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/RawMediaData.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -44,7 +44,7 @@ class RawMediaData{
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param gunid string, global unique id
|
* @param gunid string, global unique id
|
||||||
* @param resDir string, directory
|
* @param resDir string, resource directory
|
||||||
* @return this
|
* @return this
|
||||||
*/
|
*/
|
||||||
function RawMediaData($gunid, $resDir)
|
function RawMediaData($gunid, $resDir)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.10 $
|
Version : $Revision: 1.11 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/StoredFile.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/StoredFile.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -65,7 +65,7 @@ class StoredFile{
|
||||||
$this->resDir = $this->_getResDir($this->gunid);
|
$this->resDir = $this->_getResDir($this->gunid);
|
||||||
$this->accessDir = $this->gb->accessDir;
|
$this->accessDir = $this->gb->accessDir;
|
||||||
$this->rmd =& new RawMediaData($this->gunid, $this->resDir);
|
$this->rmd =& new RawMediaData($this->gunid, $this->resDir);
|
||||||
$this->md =& new MetaData(&$gb, $this->gunid);
|
$this->md =& new MetaData(&$gb, $this->gunid, $this->resDir);
|
||||||
return $this->gunid;
|
return $this->gunid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +80,12 @@ class StoredFile{
|
||||||
* @param metadata string, local path to metadata XML file or XML string
|
* @param metadata string, local path to metadata XML file or XML string
|
||||||
* @param mdataLoc string 'file'|'string' (optional)
|
* @param mdataLoc string 'file'|'string' (optional)
|
||||||
* @param gunid global unique id (optional) - for insert file with gunid
|
* @param gunid global unique id (optional) - for insert file with gunid
|
||||||
|
* @param ftype string, internal file type
|
||||||
* @return instace of StoredFile object
|
* @return instace of StoredFile object
|
||||||
*/
|
*/
|
||||||
function insert(&$gb, $oid, $name,
|
function insert(&$gb, $oid, $name,
|
||||||
$mediaFileLP='', $metadata='', $mdataLoc='file',
|
$mediaFileLP='', $metadata='', $mdataLoc='file',
|
||||||
$gunid=NULL, $type=NULL)
|
$gunid=NULL, $ftype=NULL)
|
||||||
{
|
{
|
||||||
$ac =& new StoredFile(&$gb, ($gunid ? $gunid : NULL));
|
$ac =& new StoredFile(&$gb, ($gunid ? $gunid : NULL));
|
||||||
$ac->name = $name;
|
$ac->name = $name;
|
||||||
|
@ -98,7 +99,7 @@ class StoredFile{
|
||||||
(id, name, gunid, mime, state, ftype)
|
(id, name, gunid, mime, state, ftype)
|
||||||
VALUES
|
VALUES
|
||||||
('$oid', '{$ac->name}', x'{$ac->gunid}'::bigint,
|
('$oid', '{$ac->name}', x'{$ac->gunid}'::bigint,
|
||||||
'{$ac->mime}', 'incomplete', '$type')
|
'{$ac->mime}', 'incomplete', '$ftype')
|
||||||
");
|
");
|
||||||
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
|
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
|
||||||
// --- metadata insert:
|
// --- metadata insert:
|
||||||
|
@ -128,7 +129,7 @@ class StoredFile{
|
||||||
$mime = $ac->rmd->getMime();
|
$mime = $ac->rmd->getMime();
|
||||||
//$gb->debugLog("gunid={$ac->gunid}, mime=$mime");
|
//$gb->debugLog("gunid={$ac->gunid}, mime=$mime");
|
||||||
if($mime !== FALSE){
|
if($mime !== FALSE){
|
||||||
$res = $ac->setType($mime);
|
$res = $ac->setMime($mime);
|
||||||
if(PEAR::isError($res)){
|
if(PEAR::isError($res)){
|
||||||
$ac->dbc->query("ROLLBACK"); return $res;
|
$ac->dbc->query("ROLLBACK"); return $res;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +227,7 @@ class StoredFile{
|
||||||
'', '', NULL, $src->_getType()
|
'', '', NULL, $src->_getType()
|
||||||
);
|
);
|
||||||
if(PEAR::isError($ac)) return $ac;
|
if(PEAR::isError($ac)) return $ac;
|
||||||
$ac->md->replace($src->md->getMetaData(), 'xml');
|
$ac->md->replace($src->md->getMetaData());
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +332,7 @@ class StoredFile{
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
$mime = $this->rmd->getMime();
|
$mime = $this->rmd->getMime();
|
||||||
if($mime !== FALSE){
|
if($mime !== FALSE){
|
||||||
$res = $this->setType($mime);
|
$res = $this->setMime($mime);
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,38 +354,6 @@ class StoredFile{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update metadata with new XML file
|
|
||||||
*
|
|
||||||
* @param metadata string, local path to metadata XML file or XML string
|
|
||||||
* @param mdataLoc string 'file'|'string'
|
|
||||||
* @return boolean or PEAR::error
|
|
||||||
*/
|
|
||||||
function updateMetaData($metadata, $mdataLoc='file')
|
|
||||||
{
|
|
||||||
$this->dbc->query("BEGIN");
|
|
||||||
$res = $this->md->update($metadata, $mdataLoc);
|
|
||||||
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
|
|
||||||
$res = $this->dbc->query("COMMIT");
|
|
||||||
if(PEAR::isError($res)) return $res;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update object namespace and value of one metadata record
|
|
||||||
*
|
|
||||||
* @param mdid int, metadata record id
|
|
||||||
* @param object string, object value, e.g. title string
|
|
||||||
* @param objns string, object namespace prefix, have to be defined
|
|
||||||
* in file's metadata (or reserved prefix)
|
|
||||||
* @see MetaData
|
|
||||||
* @return boolean or PEAR::error
|
|
||||||
*/
|
|
||||||
function updateMetaDataRecord($mdid, $object, $objns='_L')
|
|
||||||
{
|
|
||||||
return $this->md->updateRecord($mdid, $object, $objns='_L');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get metadata as XML string
|
* Get metadata as XML string
|
||||||
*
|
*
|
||||||
|
@ -448,7 +417,7 @@ class StoredFile{
|
||||||
* @param mime string, mime-type
|
* @param mime string, mime-type
|
||||||
* @return boolean or error
|
* @return boolean or error
|
||||||
*/
|
*/
|
||||||
function setType($mime)
|
function setMime($mime)
|
||||||
{
|
{
|
||||||
$res = $this->dbc->query("
|
$res = $this->dbc->query("
|
||||||
UPDATE {$this->filesTable} SET mime='$mime'
|
UPDATE {$this->filesTable} SET mime='$mime'
|
||||||
|
@ -538,8 +507,9 @@ class StoredFile{
|
||||||
$initString =
|
$initString =
|
||||||
microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport";
|
microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport";
|
||||||
$hash = md5($initString);
|
$hash = md5($initString);
|
||||||
// int8
|
// non-negative int8
|
||||||
$res = substr($hash, 0, 16);
|
$hsd = substr($hash, 0, 1);
|
||||||
|
$res = dechex(hexdec($hsd)>>1).substr($hash, 1, 15);
|
||||||
return StoredFile::_normalizeGunid($res);
|
return StoredFile::_normalizeGunid($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,6 +627,16 @@ class StoredFile{
|
||||||
return $this->rmd->getFname();
|
return $this->rmd->getFname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get real filename of metadata file
|
||||||
|
*
|
||||||
|
* @see MetaData
|
||||||
|
*/
|
||||||
|
function _getRealMDFname()
|
||||||
|
{
|
||||||
|
return $this->md->getFname();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and return name for temporary symlink.<br>
|
* Create and return name for temporary symlink.<br>
|
||||||
* <b>TODO: Should be more unique</b>
|
* <b>TODO: Should be more unique</b>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.8 $
|
Version : $Revision: 1.9 $
|
||||||
Location : $ $
|
Location : $ $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -33,7 +33,7 @@ require_once"gbHtml_h.php";
|
||||||
* storageServer WWW-form interface
|
* storageServer WWW-form interface
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.8 $
|
* @version $Revision: 1.9 $
|
||||||
* @see Alib
|
* @see Alib
|
||||||
* @see GreenBox
|
* @see GreenBox
|
||||||
*/
|
*/
|
||||||
|
@ -119,7 +119,6 @@ switch($_REQUEST['act']){
|
||||||
$r = $gb->putFile($id, $_REQUEST['filename'], $ntmp, $mdtmp, $sessid);
|
$r = $gb->putFile($id, $_REQUEST['filename'], $ntmp, $mdtmp, $sessid);
|
||||||
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
if(PEAR::isError($r)) $_SESSION['alertMsg'] = $r->getMessage();
|
||||||
else{
|
else{
|
||||||
# $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid);
|
|
||||||
@unlink($ntmp);
|
@unlink($ntmp);
|
||||||
@unlink($mdtmp);
|
@unlink($mdtmp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata
|
||||||
|
xmlns="http://www.streamonthefly.org/"
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:dcterms="http://purl.org/dc/terms/"
|
||||||
|
xmlns:xbmf="http://www.streamonthefly.org/xbmf"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
>
|
||||||
|
<dc:title>File Title4 utf-8</dc:title>
|
||||||
|
<dcterms:alternative>ěščřžýáíé ĚŠČŘŽÝÁÍÉ úůÚŮ ďťňĎŤŇ é</dcterms:alternative>
|
||||||
|
<xbmf:contributor>
|
||||||
|
<xbmf:role>Author</xbmf:role>
|
||||||
|
<xbmf:name>John Y</xbmf:name>
|
||||||
|
<xbmf:phone>234</xbmf:phone>
|
||||||
|
</xbmf:contributor>
|
||||||
|
</metadata>
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<audioClip><metadata xmlns="http://www.streamonthefly.org/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"><dcterms:extent>00:00:11</dcterms:extent></metadata></audioClip>
|
|
@ -1,7 +1,7 @@
|
||||||
<?
|
<?
|
||||||
$sampleData = array(
|
$sampleData = array(
|
||||||
array('../tests/ex1.mp3', '../tests/mdata1.xml'),
|
array('../tests/ex1.mp3', '../tests/mdata1.xml'),
|
||||||
array('../tests/ex2.ogg', '../tests/mdata2.xml'),
|
array('../tests/ex2.ogg', '../tests/mdata5.xml'),
|
||||||
array('../tests/ex2.wav', '../tests/mdata3.xml')
|
array('../tests/ex2.wav', '../tests/mdata3.xml')
|
||||||
);
|
);
|
||||||
?>
|
?>
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -82,16 +82,32 @@ if(preg_match("|^[0-9a-fA-F]{16}$|", $_REQUEST['id'])){
|
||||||
http_error(400, "Error on id parameter. ({$_REQUEST['id']})");
|
http_error(400, "Error on id parameter. ({$_REQUEST['id']})");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ex = $locStor->existsAudioClip($sessid, $gunid);
|
$ex_ac = $locStor->existsAudioClip($sessid, $gunid);
|
||||||
if(PEAR::isError($ex)){
|
if(PEAR::isError($ex_ac)){
|
||||||
if($ex->getCode() == GBERR_DENY){ http_error(403, $ex->getMessage()); }
|
if($ex_ac->getCode() == GBERR_DENY){
|
||||||
else{ http_error(500, $ex->getMessage()); }
|
http_error(403, $ex_ac->getMessage());
|
||||||
|
}else{ http_error(500, $ex_ac->getMessage()); }
|
||||||
}
|
}
|
||||||
if(!$ex){ http_error(404, "File not found"); }
|
$ex_pl = $locStor->existsPlaylist($sessid, $gunid);
|
||||||
|
if(PEAR::isError($ex_pl)){
|
||||||
|
if($ex_pl->getCode() == GBERR_DENY){
|
||||||
|
http_error(403, $ex_pl->getMessage());
|
||||||
|
}else{ http_error(500, $ex_pl->getMessage()); }
|
||||||
|
}
|
||||||
|
if(!$ex_ac && !$ex_pl){ http_error(404, "404 File not found"); }
|
||||||
$ac =& StoredFile::recallByGunid(&$locStor, $gunid);
|
$ac =& StoredFile::recallByGunid(&$locStor, $gunid);
|
||||||
if(PEAR::isError($ac)){ http_error(500, $ac->getMessage()); }
|
if(PEAR::isError($ac)){ http_error(500, $ac->getMessage()); }
|
||||||
$realFname = $ac->_getRealRADFname();
|
if($ex_ac){
|
||||||
$mime = $ac->rmd->getMime();
|
$realFname = $ac->_getRealRADFname();
|
||||||
header("Content-type: $mime");
|
$mime = $ac->rmd->getMime();
|
||||||
readfile($realFname);
|
header("Content-type: $mime");
|
||||||
|
readfile($realFname);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if($ex_pl){
|
||||||
|
$md = $locStor->getMdata($ac->getId(), $sessid);
|
||||||
|
header("Content-type: application/smil");
|
||||||
|
echo $md;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: tomas $
|
# Author : $Author: tomas $
|
||||||
# Version : $Revision: 1.9 $
|
# Version : $Revision: 1.10 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -33,8 +33,13 @@ COMM=$1
|
||||||
shift
|
shift
|
||||||
GUNID=$1
|
GUNID=$1
|
||||||
|
|
||||||
METADATA="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
#METADATA="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||||
<metadata><title>ěščřžé</title></metadata>"
|
#<metadata><title>ěščřžé</title></metadata>"
|
||||||
|
METADATA="<?xml version=\"1.0\"?>
|
||||||
|
<audioClip><metadata xmlns=\"http://www.streamonthefly.org/\"
|
||||||
|
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
|
||||||
|
xmlns:dcterms=\"http://purl.org/dc/terms/\">
|
||||||
|
<dcterms:extent>00:00:11</dcterms:extent></metadata></audioClip>"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
|
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
|
||||||
|
@ -146,12 +151,12 @@ deleteAudioClip() {
|
||||||
|
|
||||||
updateAudioClipMetadata() {
|
updateAudioClipMetadata() {
|
||||||
echo -n "#updateAudioClipMetadata: "
|
echo -n "#updateAudioClipMetadata: "
|
||||||
$XR_CLI updateAudioClipMetadata $SESSID $GUNID '../tests/mdata3.xml' || exit $?
|
$XR_CLI updateAudioClipMetadata $SESSID $GUNID "$METADATA" || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
getAudioClip() {
|
getAudioClip() {
|
||||||
echo -n "#getAudioClip: "
|
echo -n "#getAudioClip: "
|
||||||
$XR_CLI getAudioClip $SESSID $GUNID | $TESTDIR/urldecode || exit $?
|
$XR_CLI getAudioClip $SESSID $GUNID || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
searchMetadata() {
|
searchMetadata() {
|
||||||
|
@ -160,6 +165,67 @@ searchMetadata() {
|
||||||
$XR_CLI searchMetadata $SESSID 'John %' || exit $?
|
$XR_CLI searchMetadata $SESSID 'John %' || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PLID="123456789abcdef2"
|
||||||
|
|
||||||
|
createPlaylist() {
|
||||||
|
echo -n "# createPlaylist: "
|
||||||
|
$XR_CLI createPlaylist $SESSID $PLID || exit $?
|
||||||
|
}
|
||||||
|
|
||||||
|
accessPlaylist() {
|
||||||
|
echo "# accessPlaylist: "
|
||||||
|
RES=`$XR_CLI accessPlaylist $SESSID $PLID` || \
|
||||||
|
{ ERN=$?; echo $RES; exit $ERN; }
|
||||||
|
unset URL
|
||||||
|
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
|
||||||
|
echo $TOKEN
|
||||||
|
echo $URL
|
||||||
|
echo "# curl: "
|
||||||
|
curl -fs $URL || { ERN=$?; echo $RES; exit $ERN; }
|
||||||
|
echo ""
|
||||||
|
echo "# status: $?"
|
||||||
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
|
echo -n "# releasePlaylist: "
|
||||||
|
$XR_CLI releasePlaylist $SESSID $TOKEN || exit $?
|
||||||
|
}
|
||||||
|
|
||||||
|
editPlaylist() {
|
||||||
|
DATE=`date '+%H:%M:%S'`
|
||||||
|
PLAYLIST="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||||
|
<smil><head><metadata>
|
||||||
|
<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/metadata/dublin_core#\">
|
||||||
|
<dc:title>XY $DATE</dc:title>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata></head><body><seq>
|
||||||
|
<audio src=\"123456789abcdefa\"/>
|
||||||
|
<audio src=\"123456789abcdefb\"/>
|
||||||
|
</seq></body></smil>"
|
||||||
|
echo "# editPlaylist: "
|
||||||
|
RES=`$XR_CLI editPlaylist $SESSID $PLID` || \
|
||||||
|
{ ERN=$?; echo $RES; exit $ERN; }
|
||||||
|
unset URL
|
||||||
|
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
|
||||||
|
echo $TOKEN
|
||||||
|
echo $URL
|
||||||
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
|
echo " Playlist:"
|
||||||
|
echo $PLAYLIST
|
||||||
|
echo -n "# savePlaylist: "
|
||||||
|
$XR_CLI savePlaylist $SESSID $TOKEN "$PLAYLIST" || exit $?
|
||||||
|
}
|
||||||
|
|
||||||
|
existsPlaylist() {
|
||||||
|
echo -n "# existsPlaylist (${PLID}): "
|
||||||
|
$XR_CLI existsPlaylist $SESSID $PLID || exit $?
|
||||||
|
}
|
||||||
|
|
||||||
|
deletePlaylist() {
|
||||||
|
echo -n "# deletePlaylist: "
|
||||||
|
$XR_CLI deletePlaylist $SESSID $PLID
|
||||||
|
# || exit $?
|
||||||
|
echo "# status: $?"
|
||||||
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
echo -n "# logout: "
|
echo -n "# logout: "
|
||||||
$XR_CLI logout $SESSID || exit $?
|
$XR_CLI logout $SESSID || exit $?
|
||||||
|
@ -204,7 +270,23 @@ elif [ "$COMM" == "searchMetadata" ]; then
|
||||||
login
|
login
|
||||||
searchMetadata
|
searchMetadata
|
||||||
logout
|
logout
|
||||||
|
elif [ "$COMM" == "playlists" ]; then
|
||||||
|
echo "#XMLRPC playlists test"
|
||||||
|
login
|
||||||
|
existsPlaylist
|
||||||
|
deletePlaylist
|
||||||
|
createPlaylist
|
||||||
|
existsPlaylist
|
||||||
|
accessPlaylist
|
||||||
|
editPlaylist
|
||||||
|
accessPlaylist
|
||||||
|
# deletePlaylist
|
||||||
|
existsPlaylist
|
||||||
|
logout
|
||||||
|
echo "#XMLRPC: playlists: OK."
|
||||||
|
echo ""
|
||||||
elif [ "x$COMM" == "x" ]; then
|
elif [ "x$COMM" == "x" ]; then
|
||||||
|
echo "#XMLRPC: storage test"
|
||||||
login
|
login
|
||||||
storeAudioClip
|
storeAudioClip
|
||||||
GUNID=$RGUNID
|
GUNID=$RGUNID
|
||||||
|
@ -215,7 +297,7 @@ elif [ "x$COMM" == "x" ]; then
|
||||||
deleteAudioClip
|
deleteAudioClip
|
||||||
existsAudioClip
|
existsAudioClip
|
||||||
logout
|
logout
|
||||||
echo "#XMLRPC tests: OK."
|
echo "#XMLRPC: storage: OK."
|
||||||
echo ""
|
echo ""
|
||||||
elif [ "$COMM" == "help" ]; then
|
elif [ "$COMM" == "help" ]; then
|
||||||
usage
|
usage
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.10 $
|
Version : $Revision: 1.11 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -635,6 +635,376 @@ class XR_LocStor extends LocStor{
|
||||||
return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res)));
|
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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> plid : string</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_createPlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> url : string - readable url</li>
|
||||||
|
* <li> token : string - playlist token</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_editPlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> token : string - playlist token
|
||||||
|
* returned by locstor.editPlaylist</li>
|
||||||
|
* <li> newPlaylist : string - new Playlist in XML string </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> status : boolean - TRUE</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_savePlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> status : boolean - TRUE</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_deletePlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> url : string - readable url</li>
|
||||||
|
* <li> token : string - playlist token</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_accessPlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> token : string - playlist token
|
||||||
|
* returned by locstor.accessPlaylist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> plid : string - playlist ID</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_releasePlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> exists : boolean</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_existsPlaylist:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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:
|
||||||
|
* <ul>
|
||||||
|
* <li> sessid : string - session id </li>
|
||||||
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
* <ul>
|
||||||
|
* <li> available : boolean</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_playlistIsAvailable:
|
||||||
|
* <message from lower layer> </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @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. */
|
/* ----------------------------------------------------------------- etc. */
|
||||||
/**
|
/**
|
||||||
* Check if audio clip exists and return TRUE/FALSE
|
* Check if audio clip exists and return TRUE/FALSE
|
||||||
|
@ -978,6 +1348,15 @@ $methods = array(
|
||||||
'releaseRawAudioData' => 'Release access to raw audio data.',
|
'releaseRawAudioData' => 'Release access to raw audio data.',
|
||||||
'getAudioClip' => 'Return the contents of an Audio clip.',
|
'getAudioClip' => 'Return the contents of an Audio clip.',
|
||||||
'resetStorage' => 'Reset storageServer for debugging.',
|
'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();
|
$defs = array();
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: tomas $
|
# Author : $Author: tomas $
|
||||||
# Version : $Revision: 1.8 $
|
# Version : $Revision: 1.9 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/Attic/xr_cli_test.py,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/Attic/xr_cli_test.py,v $
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -115,10 +115,29 @@ try:
|
||||||
elif method=="existsAudioClip":
|
elif method=="existsAudioClip":
|
||||||
print server.locstor.existsAudioClip({'sessid':pars[0], 'gunid':pars[1]})
|
print server.locstor.existsAudioClip({'sessid':pars[0], 'gunid':pars[1]})
|
||||||
elif method=="updateAudioClipMetadata":
|
elif method=="updateAudioClipMetadata":
|
||||||
print server.locstor.updateAudioClipMetadata({'sessid':pars[0], 'gunid':pars[1], 'mdataFileLP':pars[2]})
|
print server.locstor.updateAudioClipMetadata({'sessid':pars[0], 'gunid':pars[1], 'metadata':pars[2]})
|
||||||
elif method=="searchMetadata":
|
elif method=="searchMetadata":
|
||||||
# print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':pars[1]})
|
# print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':pars[1]})
|
||||||
print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':{'type':'and', 'conds':['a', 'b']}})
|
print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':{'type':'and', 'conds':['a', 'b']}})
|
||||||
|
elif method=="existsPlaylist":
|
||||||
|
print server.locstor.existsPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
|
elif method=="playlistIsAvailable":
|
||||||
|
print server.locstor.playlistIsAvailable({'sessid':pars[0], 'plid':pars[1]})
|
||||||
|
elif method=="createPlaylist":
|
||||||
|
print server.locstor.createPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
|
elif method=="editPlaylist":
|
||||||
|
r = server.locstor.editPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
|
print r['url']+'\n'+r['token']
|
||||||
|
elif method=="savePlaylist":
|
||||||
|
print server.locstor.savePlaylist({'sessid':pars[0], 'token':pars[1], 'newPlaylist':pars[2]})
|
||||||
|
elif method=="deletePlaylist":
|
||||||
|
print server.locstor.deletePlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
|
elif method=="accessPlaylist":
|
||||||
|
r = server.locstor.accessPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
|
print r['url']+'\n'+r['token']
|
||||||
|
elif method=="releasePlaylist":
|
||||||
|
print server.locstor.releasePlaylist({'sessid':pars[0], 'token':pars[1]})
|
||||||
|
|
||||||
elif method=="getAudioClip":
|
elif method=="getAudioClip":
|
||||||
r = server.locstor.getAudioClip({'sessid':pars[0], 'gunid':pars[1]})
|
r = server.locstor.getAudioClip({'sessid':pars[0], 'gunid':pars[1]})
|
||||||
print r['metadata']
|
print r['metadata']
|
||||||
|
|
Loading…
Reference in New Issue