Store user preferences functionality added.

(http://bugs.campware.org/view.php?id=494)
+Fixed: http://bugs.campware.org/view.php?id=533
This commit is contained in:
tomas 2005-01-10 03:04:01 +00:00
parent df10eaab66
commit ad01370c52
12 changed files with 520 additions and 66 deletions

View File

@ -20,7 +20,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.8 $
# Version : $Revision: 1.9 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $
#
# @configure_input@
@ -119,7 +119,6 @@ distclean: clean docclean
testonly: ${TEST_RUNNER}
${TEST_RUNNER}
${TEST_RUNNER} playlists
# $(MAKE) transtest
check: all testonly

View File

@ -0,0 +1,36 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2004 Media Development Loan Fund
#
# This file is part of the LiveSupport project.
# http://livesupport.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# LiveSupport is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LiveSupport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LiveSupport; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.1 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/bin/runPhpTest.sh,v $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
cd $reldir/var/tests
php -q $1 || exit $?
exit 0

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.12 $
Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
------------------------------------------------------------------------------*/
@ -35,6 +35,7 @@ define('GBERR_WRTYPE', 44);
define('GBERR_NONE', 45);
define('GBERR_AOBJNEX', 46);
define('GBERR_NOTF', 47);
define('GBERR_SESS', 48);
define('GBERR_NOTIMPL', 50);
@ -48,7 +49,7 @@ require_once "StoredFile.php";
* Core of LiveSupport file storage module
*
* @author $Author: tomas $
* @version $Revision: 1.12 $
* @version $Revision: 1.13 $
* @see Alib
*/
class BasicStor extends Alib{

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.9 $
Version : $Revision: 1.10 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/MetaData.php,v $
------------------------------------------------------------------------------*/
@ -148,7 +148,7 @@ class MetaData{
*/
function delete()
{
if(file_exists($fname)) @unlink($this->fname);
if(file_exists($this->fname)) @unlink($this->fname);
$res = $this->dbc->query("
DELETE FROM {$this->mdataTable}
WHERE gunid=x'{$this->gunid}'::bigint

View File

@ -0,0 +1,247 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: tomas $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/Prefs.php,v $
------------------------------------------------------------------------------*/
/**
* Prefs class
*
* LiveSupport preference storage class
*
* @see StoredFile
*/
/* ================== Prefs ================== */
class Prefs{
/**
* Constructor
*
* @param gb, GreenBox object reference
*/
function Prefs(&$gb)
{
$this->gb =& $gb;
$this->dbc =& $gb->dbc;
$this->prefTable = $gb->config['tblNamePrefix'].'pref';
}
/* ======================================================= public methods */
/**
* Read preference record by session id
*
* @param sessid string, session id
* @param key string, preference key
* @return string, preference value
*/
function loadPref($sessid, $key)
{
$subjid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($subjid)) return $subjid;
if(is_null($subjid)){
return PEAR::raiseError("Prefs::loadPref: invalid session id",
GBERR_SESS);
}
$val = $this->readVal($subjid, $key);
if(PEAR::isError($val)) return $val;
return $val;
}
/**
* Save preference record by session id
*
* @param sessid string, session id
* @param key string, preference key
* @param value string, preference value
* @return boolean
*/
function savePref($sessid, $key, $value)
{
$subjid = $this->gb->getSessUserId($sessid);
if(PEAR::isError($subjid)) return $subjid;
if(is_null($subjid)){
return PEAR::raiseError("Prefs::loadPref: invalid session id",
GBERR_SESS);
}
$r = $this->delete($subjid, $key);
if(PEAR::isError($r)) return $r;
if($value != ''){
$r = $this->insert($subjid, $key, $value);
if(PEAR::isError($r)) return $r;
}
return TRUE;
}
/* ===================================================== gb level methods */
/**
* Insert of new preference record
*
* @param subjid int, local user id
* @param keystr string, preference key
* @param valstr string, preference value
* @return int, local user id
*/
function insert($subjid, $keystr, $valstr='')
{
$id = $this->dbc->nextId("{$this->prefTable}_id_seq");
if(PEAR::isError($id)) return $id;
$r = $this->dbc->query("
INSERT INTO {$this->prefTable}
(id, subjid, keystr, valstr)
VALUES
($id, $subjid, '$keystr', '$valstr')
");
if(PEAR::isError($r)) return $r;
return $id;
}
/**
* Read value of preference record
*
* @param subjid int, local user id
* @param keystr string, preference key
* @return string, preference value
*/
function readVal($subjid, $keystr)
{
$val = $this->dbc->getOne("
SELECT valstr FROM {$this->prefTable}
WHERE subjid=$subjid AND keystr='$keystr'
");
if(PEAR::isError($val)) return $val;
if(is_null($val)) return '';
return $val;
}
/**
* Update value of preference record
*
* @param subjid int, local user id
* @param keystr string, preference key
* @param newvalstr string, new preference value
* @return boolean
*/
function update($subjid, $keystr, $newvalstr='')
{
$r = $this->dbc->query("
UPDATE {$this->prefTable} SET
valstr='$newvalstr'
WHERE subjid=$subjid AND keystr='$keystr'
");
if(PEAR::isError($r)) return $r;
return TRUE;
}
/**
* Delete preference record
*
* @param subjid int, local user id
* @param keystr string, preference key
* @return boolean
*/
function delete($subjid, $keystr)
{
$r = $this->dbc->query("
DELETE FROM {$this->prefTable}
WHERE subjid=$subjid AND keystr='$keystr'
");
if(PEAR::isError($r)) return $r;
return TRUE;
}
/* ==================================================== auxiliary methods */
/**
* Test method
*
*/
function test()
{
$sessid = $this->gb->login('root', $this->gb->config['tmpRootPass']);
$testkey = 'testKey';
$testVal = 'abcDef 0123 ěščřžýáíé ĚŠČŘŽÝÁÍÉ';
$r = savePref($sessid, $testKey, $testVal);
if(PEAR::isError($r)) return $r;
$val = loadPref($sessid, $testKey);
if($val != $testVal){
echo "ERROR: preference storage test failed.\n ($testVal / $val)\n";
return FALSE;
}
$r = savePref($sessid, $testKey, '');
if(PEAR::isError($r)) return $r;
$val = loadPref($sessid, $testKey);
if($val != $testVal){
echo "ERROR: preference storage test failed.\n ('' / '$val')\n";
return FALSE;
}
return TRUE;
}
/**
* Install database table for preference storage
*
* @return boolean
*/
function install()
{
$this->dbc->createSequence("{$this->prefTable}_id_seq");
$r = $this->dbc->query("CREATE TABLE {$this->prefTable} (
id int not null,
subjid int REFERENCES {$this->gb->subjTable} ON DELETE CASCADE,
keystr varchar(255),
valstr text
)");
if(PEAR::isError($r)) return $r;
$this->dbc->query("CREATE UNIQUE INDEX {$this->prefTable}_id_idx
ON {$this->prefTable} (id)");
$this->dbc->query("CREATE UNIQUE INDEX {$this->prefTable}_subj_key_idx
ON {$this->prefTable} (subjid, keystr)");
$this->dbc->query("CREATE INDEX {$this->prefTable}_subjid_idx
ON {$this->prefTable} (subjid)");
return TRUE;
}
/**
* Uninstall database table for preference storage
*
* @return boolean
*/
function uninstall()
{
$this->dbc->query("DROP TABLE {$this->prefTable}");
$this->dbc->dropSequence("{$this->prefTable}_id_seq");
}
/**
*
* /
function ()
{
}*/
}
?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.6 $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/RawMediaData.php,v $
------------------------------------------------------------------------------*/
@ -37,7 +37,6 @@
* @see StoredFile
*/
/* ================== RawMediaData ================== */
class RawMediaData{
/**
@ -216,4 +215,4 @@ class RawMediaData{
return $log;
}
}
?>
?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.7 $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/install.php,v $
------------------------------------------------------------------------------*/
@ -96,6 +96,14 @@ echo "# Install Transport submodule\n";
require_once "../Transport.php";
$tr =& new Transport(&$dbc, $config);
$r = $tr->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "\n";
echo "# Install Prefs submodule\n";
require_once "../Prefs.php";
$pr =& new Prefs(&$gb);
$r = $pr->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "\n";
$dbc->disconnect();

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/install/uninstall.php,v $
------------------------------------------------------------------------------*/
@ -63,6 +63,15 @@ echo "# Uninstall Transport submodule ...\n";
require_once "../Transport.php";
$tr =& new Transport(&$dbc, $config);
$r = $tr->uninstall();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "\n";
echo "# Uninstall Prefs submodule\n";
require_once "../Prefs.php";
$pr =& new Prefs(&$gb);
$r = $pr->uninstall();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "\n";
$dbc->disconnect();
?>

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php,v $
------------------------------------------------------------------------------*/
@ -1218,6 +1218,105 @@ class XR_LocStor extends LocStor{
return new XML_RPC_Response(XML_RPC_encode(array('gunids'=>$res)));
}
/**
* Load user preference value
*
* The XML-RPC name of this method is "locstor.loadPref".
*
* The input parameters are an XML-RPC struct with the following
* fields:
* <ul>
* <li> sessid : string - session id </li>
* <li> key : string - preference key:<br>
* <ul>
*
* On success, returns a XML-RPC struct with single field:
* <ul>
* <li> value : string - preference value </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_loadPref:
* &lt;message from lower layer&gt; </li>
* <li> 848 - invalid session id.</li>
* </ul>
*
* @param input XMLRPC struct
* @return XMLRPC struct
* @see LocStor::getAudioClip
*/
function xr_loadPref($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
require_once '../../../storageServer/var/Prefs.php';
$pr =& new Prefs(&$this);
$res = $pr->loadPref($r['sessid'], $r['key']);
if(PEAR::isError($res)){
$ec = intval($res->getCode());
return new XML_RPC_Response(0, 800+($ec == 48 ? 48 : 5 ),
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
);
}
return new XML_RPC_Response(XML_RPC_encode(array('value'=>$res)));
}
/**
* Save user preference value
*
* The XML-RPC name of this method is "locstor.savePref".
*
* The input parameters are an XML-RPC struct with the following
* fields:
* <ul>
* <li> sessid : string - session id </li>
* <li> key : string - preference key:<br>
* <li> value : string - preference value:<br>
* <ul>
*
* On success, returns a XML-RPC struct with single field:
* <ul>
* <li> status : 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_savePref:
* &lt;message from lower layer&gt; </li>
* <li> 848 - invalid session id.</li>
* </ul>
*
* @param input XMLRPC struct
* @return XMLRPC struct
* @see LocStor::getAudioClip
*/
function xr_savePref($input)
{
list($ok, $r) = $this->_xr_getPars($input);
if(!$ok) return $r;
require_once '../../../storageServer/var/Prefs.php';
$pr =& new Prefs(&$this);
$res = $pr->savePref($r['sessid'], $r['key'], $r['value']);
if(PEAR::isError($res)){
#return new XML_RPC_Response(0, 805,
$ec = intval($res->getCode());
return new XML_RPC_Response(0, 800+($ec == 48 ? 48 : 5 ),
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
);
}
return new XML_RPC_Response(XML_RPC_encode(array('status'=>$res)));
}
/* ------------------------------------------- test methods for debugging */
/**

View File

@ -23,11 +23,12 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.12 $
# Version : $Revision: 1.13 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
#-------------------------------------------------------------------------------
#DEBUG=yes
#DEBUG_I=yes
COMM=$1
shift
@ -67,19 +68,19 @@ existsAudioClip() {
storeAudioClip() {
MEDIA=var/tests/ex1.mp3
MD5=`md5sum $MEDIA`; for i in $MD5; do MD5=$i; break; done
echo "md5=$MD5"
if [ $DEBUG_I ]; then echo "md5=$MD5"; fi
echo -n "# storeAudioClipOpen: "
RES=`$XR_CLI storeAudioClipOpen "$SESSID" '' "$METADATA" "stored file.mp3" "$MD5"` || \
{ 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
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# curl (PUT): "
curl -C 0 -T $MEDIA $URL || { ERN=$?; echo $RGUNID; exit $ERN; }
echo "status: $?"
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# storeAudioClipClose: "
RGUNID=`$XR_CLI storeAudioClipClose "$SESSID" "$TOKEN"` || \
{ ERN=$?; echo $RGUNID; exit $ERN; }
@ -87,27 +88,27 @@ storeAudioClip() {
}
accessRawAudioData() {
echo "# accessRawAudioData: "
echo -n "# accessRawAudioData: "
RES=`$XR_CLI accessRawAudioData $SESSID $GUNID` || \
{ 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
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# releaseRawAudioData: "
$XR_CLI releaseRawAudioData $SESSID $TOKEN || exit $?
}
downloadRAD() {
echo "# downloadRawAudioDataOpen: "
echo -n "# downloadRawAudioDataOpen: "
RES=`$XR_CLI downloadRawAudioDataOpen $SESSID $GUNID` || \
{ 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
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# curl: "
curl -Ifs $URL > /dev/null || { ERN=$?; echo $RES; exit $ERN; }
echo "status: $?"
@ -116,18 +117,18 @@ downloadRAD() {
}
downloadMeta() {
echo "# downloadMetadataOpen: "
echo -n "# downloadMetadataOpen: "
RES=`$XR_CLI downloadMetadataOpen $SESSID $GUNID` || \
{ 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
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# curl: "
METAOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
echo "OK"
if [ $DEBUG ]; then echo $METAOUT; echo -n "Press enter ..."; read KEY; fi
if [ $DEBUG_I ]; then echo $METAOUT; echo -n "Press enter ..."; read KEY; fi
echo -n "# metadata check:"
if [ "x$METAOUT" != "x$METADATA" ] ; then
echo " NOT MATCH"
@ -170,18 +171,19 @@ createPlaylist() {
}
accessPlaylist() {
echo "# accessPlaylist: "
echo -n "# 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
if [ $DEBUG_I ]; then echo $URL; fi
echo "# curl: "
curl -fs $URL || { ERN=$?; echo $RES; exit $ERN; }
echo ""
CURLOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
if [ $DEBUG ]; then echo $CURLOUT; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo "# status: $?"
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
echo -n "# releasePlaylist: "
$XR_CLI releasePlaylist $SESSID $TOKEN || exit $?
}
@ -197,16 +199,15 @@ editPlaylist() {
<audio src=\"123456789abcdefa\"/>
<audio src=\"123456789abcdefb\"/>
</seq></body></smil>"
echo "# editPlaylist: "
echo -n "# 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
if [ $DEBUG_I ]; then echo $URL; fi
if [ $DEBUG_I ]; then echo -n "Press enter ..."; read KEY; fi
if [ $DEBUG_I ]; then echo " Playlist:"; echo $PLAYLIST; fi
echo -n "# savePlaylist: "
$XR_CLI savePlaylist $SESSID $TOKEN "$PLAYLIST" || exit $?
}
@ -223,11 +224,78 @@ deletePlaylist() {
echo "# status: $?"
}
prefTest() {
PREFKEY="testKey"
PREFVAL="test preference value"
echo -n "# savePref: "
$XR_CLI savePref $SESSID "$PREFKEY" "$PREFVAL"|| exit $?
echo -n "# loadPref: "
VAL=`$XR_CLI loadPref $SESSID "$PREFKEY"` || \
{ ERN=$?; echo $RES; exit $ERN; }
echo "$VAL "
if [ "x$VAL" != "x$PREFVAL" ] ; then
echo " NOT MATCH"
echo " Expected:"; echo $PREFVAL
echo " Returned:"; echo $VAL
exit 1
else
echo "# pref value check: OK"
fi
echo -n "# savePref: "
$XR_CLI savePref $SESSID "$PREFKEY" ""|| exit $?
echo -n "# loadPref: "
VAL=`$XR_CLI loadPref $SESSID "$PREFKEY"` || \
{ ERN=$?; echo $RES; exit $ERN; }
echo $VAL
}
logout() {
echo -n "# logout: "
$XR_CLI logout $SESSID || exit $?
}
preferenceTest(){
echo "#XMLRPC preference test"
login
prefTest
logout
echo "#XMLRPC: preference: OK."
echo ""
}
playlistTest(){
echo "#XMLRPC playlists test"
login
existsPlaylist
deletePlaylist
createPlaylist
existsPlaylist
accessPlaylist
editPlaylist
accessPlaylist
deletePlaylist
existsPlaylist
logout
echo "#XMLRPC: playlists: OK."
echo ""
}
storageTest(){
echo "#XMLRPC: storage test"
login
storeAudioClip
GUNID=$RGUNID
existsAudioClip
accessRawAudioData
downloadRAD
downloadMeta
deleteAudioClip
existsAudioClip
logout
echo "#XMLRPC: storage: OK."
echo ""
}
usage(){
echo "Usage: $0 <command> [args]"
echo -e "commands:\n test\n existsAudioClip\n accessRawAudioData"
@ -267,35 +335,16 @@ elif [ "$COMM" == "searchMetadata" ]; then
login
searchMetadata
logout
elif [ "$COMM" == "preferences" ]; then
preferenceTest
elif [ "$COMM" == "playlists" ]; then
echo "#XMLRPC playlists test"
login
existsPlaylist
deletePlaylist
createPlaylist
existsPlaylist
accessPlaylist
editPlaylist
accessPlaylist
deletePlaylist
existsPlaylist
logout
echo "#XMLRPC: playlists: OK."
echo ""
playlistTest
elif [ "$COMM" == "storage" ]; then
storageTest
elif [ "x$COMM" == "x" ]; then
echo "#XMLRPC: storage test"
login
storeAudioClip
GUNID=$RGUNID
existsAudioClip
accessRawAudioData
downloadRAD
downloadMeta
deleteAudioClip
existsAudioClip
logout
echo "#XMLRPC: storage: OK."
echo ""
storageTest
playlistTest
preferenceTest
elif [ "$COMM" == "help" ]; then
usage
else

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.15 $
Version : $Revision: 1.16 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
------------------------------------------------------------------------------*/
@ -113,6 +113,9 @@ $methods = array(
'existsPlaylist' => 'Check whether a Playlist exists.',
'playlistIsAvailable' => 'Check whether a Playlist is available '.
'for editing.',
'loadPref' => 'Load user preference value.',
'savePref' => 'Save user preference value.',
);
$defs = array();

View File

@ -24,7 +24,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.11 $
# Version : $Revision: 1.12 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/Attic/xr_cli_test.py,v $
#
#------------------------------------------------------------------------------
@ -184,6 +184,10 @@ try:
elif method=="getAudioClip":
r = server.locstor.getAudioClip({'sessid':pars[0], 'gunid':pars[1]})
print r['metadata']
elif method=="loadPref":
print server.locstor.loadPref({'sessid':pars[0], 'key':pars[1]})['value']
elif method=="savePref":
print server.locstor.savePref({'sessid':pars[0], 'key':pars[1], 'value':pars[2]})
elif method=="resetStorage":
print server.locstor.resetStorage({})
elif method=="openPut":