Webstream support added.

This commit is contained in:
tomas 2005-02-09 22:39:37 +00:00
parent 108a6a154b
commit fe15dbd069
6 changed files with 115 additions and 11 deletions

View File

@ -166,7 +166,7 @@ $tpldata['showMenu']=true;
</td><td valign="top">
<i><?php echo($o['gunid'] ? "({$o['gunid']})" : '' )?></i>
</td><td>
<?php $a=array('Folder'=>'D', 'File'=>'F', 'Replica'=>'R', 'audioclip'=>'A', 'playlist'=>'P'); echo$a[$o['type']]?>
<?php $a=array('Folder'=>'D', 'File'=>'F', 'Replica'=>'R', 'audioclip'=>'A', 'playlist'=>'P', 'webstream'=>'S'); echo$a[$o['type']]?>
&nbsp;<a href="javascript:frename('<?php echo$o['name']?>', '<?php echo$o['id']?>')" class="button">rename</a>
<?php if($o['type']!='Folder'){?>
&nbsp;<a href="javascript:fmove('<?php echo$o['id']?>', '')" class="button">move</a>
@ -184,6 +184,11 @@ $tpldata['showMenu']=true;
&nbsp;<a href="gbHttp.php?act=getMdata&amp;id=<?php echo$o['id']?>" class="button">MetaData</a>
<?php }?>
<?php if($o['type']=='playlist'){?>
&nbsp;<a href="../xmlrpc/simpleGet.php?sessid=<?php echo$sessid?>&amp;id=<?php echo$o['gunid']?>" class="button">simpleGet</a>
&nbsp;<a href="gbHttp.php?act=getMdata&amp;id=<?php echo$o['id']?>" class="button">MetaData</a>
<?php }?>
<?php if($o['type']=='webstream'){?>
&nbsp;<a href="../xmlrpc/simpleGet.php?sessid=<?php echo$sessid?>&amp;id=<?php echo$o['gunid']?>" class="button">simpleGet</a>
&nbsp;<a href="gbHttp.php?act=getMdata&amp;id=<?php echo$o['id']?>" class="button">MetaData</a>
<?php }?>
<?php if($o['type']=='Replica'){?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.13 $
Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php,v $
------------------------------------------------------------------------------*/
@ -276,6 +276,57 @@ class XR_LocStor extends LocStor{
return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res)));
}
/**
* Store audio stream identified by URL - no raw audio data
*
* The XML-RPC name of this method is "locstor.storeWebstream".
*
* The input parameters are an XML-RPC struct with the following
* fields:
* <ul>
* <li> sessid : string - session id </li>
* <li> gunid : string - global unique id of AudioCLip</li>
* <li> metadata : string - metadata XML string</li>
* <li> fname : string - human readable mnemonic file name
* with extension corresponding to filetype</li>
* <li> url : string - URL of the webstrea,</li>
* </ul>
*
* On success, returns a XML-RPC struct with single field:
* <ul>
* <li> gunid : string - gunid of stored file</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_storeWebstream:
* &lt;message from lower layer&gt; </li>
* </ul>
*
* @param input XMLRPC struct
* @return XMLRPC struct
* @see LocStor::storeWebstream
*/
function xr_storeWebstream($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
$res = $this->storeWebstream(
$r['sessid'], $r['gunid'], $r['metadata'], $r['fname'], $r['url']
);
if(PEAR::isError($res)){
return new XML_RPC_Response(0, 805,
"xr_storeWebstream: ".$res->getMessage().
" ".$res->getUserInfo()
);
}
return new XML_RPC_Response(XML_RPC_encode(array('gunid'=>$res)));
}
/* ------------------------------------------------ access raw audio data */
/**
* Make access to audio clip.

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php,v $
------------------------------------------------------------------------------*/
@ -97,15 +97,34 @@ if(PEAR::isError($ex_pl)){
if(!$ex_ac && !$ex_pl){ http_error(404, "404 File not found"); }
$ac =& StoredFile::recallByGunid($locStor, $gunid);
if(PEAR::isError($ac)){ http_error(500, $ac->getMessage()); }
$ftype = $locStor->getObjType($id = $locStor->_idFromGunid($gunid));
if(PEAR::isError($ftype)){ http_error(500, $ftype->getMessage()); }
if($ex_ac){
$realFname = $ac->_getRealRADFname();
$mime = $ac->rmd->getMime();
header("Content-type: $mime");
readfile($realFname);
switch($ftype){
case"audioclip":
$realFname = $ac->_getRealRADFname();
$mime = $ac->rmd->getMime();
header("Content-type: $mime");
readfile($realFname);
break;
case"webstream":
$url = $locStor->bsGetMetadataValue($id, 'ls:url');
if(PEAR::isError($url)){ http_error(500, $url->getMessage()); }
$url = $url[0]['value'];
$txt = "Location: $url";
header($txt);
// echo "$txt\n";
break;
default:
var_dump($ftype);
http_error(500, "500 Unknown ftype ($ftype)");
}
exit;
}
if($ex_pl){
$md = $locStor->getMdata($ac->getId(), $sessid);
// $md = $locStor->bsGetMetadata($ac->getId(), $sessid);
$md = $locStor->getAudioClip($sessid, $gunid);
// header("Content-type: text/xml");
header("Content-type: application/smil");
echo $md;
exit;

View File

@ -23,7 +23,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.20 $
# Version : $Revision: 1.21 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
#-------------------------------------------------------------------------------
@ -176,6 +176,14 @@ browseCategory() {
echo $RES
}
storeWebstream() {
URL="http://localhost/x"
echo -n "# storeWebstream: "
RGUNID=`$XR_CLI storeWebstream "$SESSID" '' "$METADATA" "new stream" "$URL"` || \
{ ERN=$?; echo $RGUNID; exit $ERN; }
echo $RGUNID
}
PLID="123456789abcdef8"
createPlaylist() {
@ -342,6 +350,19 @@ playlistTest(){
echo ""
}
webstreamTest(){
echo "#XMLRPC webstream test"
login
storeWebstream; GUNID=$RGUNID
# GUNID="4e58a66cf6e9f539"
# downloadMeta
getAudioClip
deleteAudioClip
logout
echo "#XMLRPC: webstream: OK."
echo ""
}
storageTest(){
echo "#XMLRPC: storage test"
login
@ -400,6 +421,8 @@ elif [ "$COMM" == "preferences" ]; then
preferenceTest
elif [ "$COMM" == "playlists" ]; then
playlistTest
elif [ "$COMM" == "webstream" ]; then
webstreamTest
elif [ "$COMM" == "storage" ]; then
storageTest
elif [ "x$COMM" == "x" ]; then

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.21 $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
------------------------------------------------------------------------------*/
@ -105,6 +105,8 @@ $methods = array(
'releaseRawAudioData' => 'Release access to raw audio data.',
'getAudioClip' => 'Return the contents of an Audio clip.',
'resetStorage' => 'Reset storageServer for debugging.',
'storeWebstream' => 'Store audio stream identified by URL',
'createPlaylist' => 'Create a new Playlist metafile.',
'editPlaylist' => 'Open a Playlist metafile for editing.',
'savePlaylist' => 'Save a Playlist metafile.',

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php,v $
------------------------------------------------------------------------------*/
@ -104,6 +104,10 @@ $infos = array(
"searchMetadata" => array('m'=>"locstor.searchMetadata", 'p'=>NULL),
"browseCategory" => array('m'=>"locstor.browseCategory", 'p'=>NULL),
"resetStorage" => array('m'=>"locstor.resetStorage", 'p'=>array()),
"storeWebstream" => array('m'=>"locstor.storeWebstream",
'p'=>array('sessid', 'gunid', 'metadata', 'fname', 'url'),
'r'=>array('gunid')
),
"createPlaylist" => array('m'=>"locstor.createPlaylist",
'p'=>array('sessid', 'plid', 'fname'), 'r'=>'plid'),