diff --git a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
index 66b45507b..0b40ee59c 100644
--- a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
+++ b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
@@ -166,7 +166,7 @@ $tpldata['showMenu']=true;
|
- 'D', 'File'=>'F', 'Replica'=>'R', 'audioclip'=>'A', 'playlist'=>'P'); echo$a[$o['type']]?>
+ 'D', 'File'=>'F', 'Replica'=>'R', 'audioclip'=>'A', 'playlist'=>'P', 'webstream'=>'S'); echo$a[$o['type']]?>
rename
move
@@ -184,6 +184,11 @@ $tpldata['showMenu']=true;
MetaData
+ simpleGet
+ MetaData
+
+
+ simpleGet
MetaData
diff --git a/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php
index 6215083f4..5a86055f5 100644
--- a/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php
+++ b/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php
@@ -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:
+ *
+ * - sessid : string - session id
+ * - gunid : string - global unique id of AudioCLip
+ * - metadata : string - metadata XML string
+ * - fname : string - human readable mnemonic file name
+ * with extension corresponding to filetype
+ * - url : string - URL of the webstrea,
+ *
+ *
+ * On success, returns a XML-RPC struct with single field:
+ *
+ * - gunid : string - gunid of stored file
+ *
+ *
+ * On errors, returns an XML-RPC error response.
+ * The possible error codes and error message are:
+ *
+ * - 3 - Incorrect parameters passed to method:
+ * Wanted ... , got ... at param
+ * - 801 - wrong 1st parameter, struct expected.
+ * - 805 - xr_storeWebstream:
+ * <message from lower layer>
+ *
+ *
+ * @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.
diff --git a/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php b/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php
index de20f46a1..7e231e51a 100644
--- a/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php
+++ b/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php
@@ -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;
diff --git a/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh b/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh
index a29ccc3f5..7ebd6e7e0 100755
--- a/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh
+++ b/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh
@@ -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
diff --git a/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php b/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
index e283fa117..60bab0bf9 100644
--- a/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
+++ b/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php
@@ -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.',
diff --git a/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php b/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php
index 9cc68106d..45508b548 100644
--- a/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php
+++ b/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.php
@@ -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'),
|