Search method with structured query support added.
(http://bugs.campware.org/view.php?id=481) (+probably: http://bugs.campware.org/view.php?id=513) +solved: http://bugs.campware.org/view.php?id=522
This commit is contained in:
parent
7259599ce1
commit
0f1625db38
10 changed files with 310 additions and 104 deletions
41
livesupport/modules/storageServer/bin/resetStorage.sh
Executable file
41
livesupport/modules/storageServer/bin/resetStorage.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/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/resetStorage.sh,v $
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# This script does httpd writeable directories setup
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
reldir=`dirname $0`/..
|
||||||
|
WWW_ROOT=`cd $reldir/var/install; php -q getWwwRoot.php` || exit $?
|
||||||
|
echo "# storageServer root URL: $WWW_ROOT"
|
||||||
|
|
||||||
|
$reldir/var/xmlrpc/xr_cli_test.py -s $WWW_ROOT/xmlrpc/xrLocStor.php \
|
||||||
|
resetStorage || exit $?
|
||||||
|
|
||||||
|
echo "# resetStorage: OK"
|
||||||
|
exit 0
|
38
livesupport/modules/storageServer/doc/index.html
Normal file
38
livesupport/modules/storageServer/doc/index.html
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
|
||||||
|
<title>storageServer documentation</title>
|
||||||
|
<meta content="$Author: tomas $" name="author">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Preface</h1>
|
||||||
|
This document is part of the
|
||||||
|
<a href="http://livesupport.campware.org/">LiveSupport</a>
|
||||||
|
project, Copyright © 2004 <a href="http://www.mdlf.org/">Media
|
||||||
|
Development Loan Fund</a>, under the GNU <a
|
||||||
|
href="http://www.gnu.org/licenses/gpl.html">GPL</a>.<br>
|
||||||
|
<ul>
|
||||||
|
<li>Author: $Author: tomas $</li>
|
||||||
|
<li>Version: $Revision: 1.1 $</li>
|
||||||
|
<li>Location: $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/doc/index.html,v $</li>
|
||||||
|
</ul>
|
||||||
|
<h1>Scope</h1>
|
||||||
|
This document collects storageServer documentation, both
|
||||||
|
generated and handwritten.<br>
|
||||||
|
<h1>Introduction</h1>
|
||||||
|
The links below provide useful documentation for the storageServer
|
||||||
|
developer or user.<br>
|
||||||
|
<h1>Static documentation.</h1>
|
||||||
|
<ul>
|
||||||
|
<li> <a href="search.html">search query format description</a><br>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h1>Generated documentation</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href="doxygen/html/">documentation generated from the source
|
||||||
|
code</a></li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</body>
|
||||||
|
</html>
|
67
livesupport/modules/storageServer/doc/search.html
Normal file
67
livesupport/modules/storageServer/doc/search.html
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
|
||||||
|
<title>storageServer search query format description</title>
|
||||||
|
<meta content="$Author: tomas $" name="author">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Preface</h1>
|
||||||
|
This document is part of the
|
||||||
|
<a href="http://livesupport.campware.org/">LiveSupport</a>
|
||||||
|
project, Copyright © 2004 <a href="http://www.mdlf.org/">Media
|
||||||
|
Development Loan Fund</a>, under the GNU <a
|
||||||
|
href="http://www.gnu.org/licenses/gpl.html">GPL</a>.<br>
|
||||||
|
<ul>
|
||||||
|
<li>Author: $Author: tomas $</li>
|
||||||
|
<li>Version: $Revision: 1.1 $</li>
|
||||||
|
<li>Location: $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/doc/Attic/search.html,v $</li>
|
||||||
|
</ul>
|
||||||
|
<h1>Scope</h1>
|
||||||
|
This document describes search query format for searching in storageServer
|
||||||
|
metadata database.<br>
|
||||||
|
<h1>Introduction</h1>
|
||||||
|
How to call search methods:
|
||||||
|
<ul>
|
||||||
|
<li>PHP: <code>$locStor->searchMetadata($sessid, $criteria)</code></li>
|
||||||
|
<li>XMLRPC: <code>locstor.searchMetadata</code>
|
||||||
|
(with struct parameter containing <code>sessid</code> string and
|
||||||
|
<code>criteria</code> struct)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Criteria format (php/xmlrpc)</h2>
|
||||||
|
Type: hash/struct with following fields:<br>
|
||||||
|
<ul>
|
||||||
|
<li>filetype - string, type of searched files,
|
||||||
|
meaningful values: 'audioclip', 'playlist', 'all'</li>
|
||||||
|
<li>operator - string, type of conditions join
|
||||||
|
(any condition matches / all conditions match),
|
||||||
|
meaningful values: 'and', 'or', ''
|
||||||
|
(may be empty or ommited only with less then 2 items in
|
||||||
|
"conditions" field)
|
||||||
|
</li>
|
||||||
|
<li>conditions - array of hashes/structs with structure:
|
||||||
|
<ul>
|
||||||
|
<li>cat - string, metadata category name</li>
|
||||||
|
<li>op - string, operator - meaningful values:
|
||||||
|
'full', 'partial', 'prefix', '=', '<', '<=', '>', '>='</li>
|
||||||
|
<li>val - string, search value</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Return value</h2>
|
||||||
|
Hash/struct with fields:<br>
|
||||||
|
<ul>
|
||||||
|
<li>results - array, array with gunid strings of files have been found</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<h2></h2>
|
||||||
|
<ul>
|
||||||
|
</ul>
|
||||||
|
-->
|
||||||
|
<br>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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/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.10 $
|
* @version $Revision: 1.11 $
|
||||||
* @see Alib
|
* @see Alib
|
||||||
*/
|
*/
|
||||||
class BasicStor extends Alib{
|
class BasicStor extends Alib{
|
||||||
|
@ -487,69 +487,64 @@ class BasicStor extends Alib{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search in local metadata database.<br>
|
* Search in local metadata database.
|
||||||
* <b>TODO: NOT FINISHED</b><br>
|
|
||||||
* It will support structured queries - array of mode and query parts.
|
|
||||||
* Mode is "match all" or "match any".
|
|
||||||
* Query parts is array of [fieldname, operator, value] entities.
|
|
||||||
*
|
*
|
||||||
* @param criteria string, search query -
|
* @param criteria hash, search criteria - see
|
||||||
* only one SQL LIKE term supported now.
|
* <a href="../../search.html">format description</a>
|
||||||
* It will be searched in all literal object values
|
* @return hash, field 'results' is an array with gunid strings
|
||||||
* in metadata database
|
* of files have been found
|
||||||
* @return array of gunid strings
|
|
||||||
*/
|
*/
|
||||||
function bsLocalSearch($criteria)
|
function bsLocalSearch($criteria)
|
||||||
{
|
{
|
||||||
$types = array('and'=>'AND', 'or'=>'OR');
|
$operators = array('and'=>'AND', 'or'=>'OR');
|
||||||
$ops = array('full'=>"='%s'", 'partial'=>"like '%%%s%%'", 'prefix'=>"like '%s%%'",
|
$ops = array('full'=>"='%s'", 'partial'=>"like '%%%s%%'", 'prefix'=>"like '%s%%'",
|
||||||
'<'=>"< '%s'", '='=>"= '%s'", '>'=>"> '%s'", '<='=>"<= '%s'", '>='=>">= '%s'"
|
'<'=>"< '%s'", '='=>"= '%s'", '>'=>"> '%s'", '<='=>"<= '%s'", '>='=>">= '%s'"
|
||||||
);
|
);
|
||||||
# var_dump($criteria);
|
$operator = strtolower($criteria['operator']);
|
||||||
echo "\n";
|
$conds = $criteria['conditions'];
|
||||||
$type = strtolower($criteria['type']);
|
$whereArr = array();
|
||||||
$conds = $criteria['conds'];
|
|
||||||
$whereArr = array();
|
|
||||||
foreach($conds as $cond){
|
foreach($conds as $cond){
|
||||||
$cat = strtolower($cond['cat']);
|
$cat = strtolower($cond['cat']);
|
||||||
$opVal = sprintf($ops[$cond['op']], strtolower($cond['val']));
|
$opVal = sprintf($ops[$cond['op']],
|
||||||
|
addslashes(strtolower($cond['val'])));
|
||||||
|
// escape % for sprintf in whereArr construction:
|
||||||
|
$cat = str_replace("%", "%%", $cat);
|
||||||
|
$opVal = str_replace("%", "%%", $opVal);
|
||||||
$sqlCond = "
|
$sqlCond = "
|
||||||
%s.predicate = '".str_replace("%", "%%", $cat)."' AND
|
%s.predicate = '{$cat}' AND
|
||||||
%s.objns='_L' AND lower(%s.object) ".str_replace("%", "%%", $opVal)."\n
|
%s.objns='_L' AND lower(%s.object) {$opVal}\n
|
||||||
";
|
";
|
||||||
# echo "$sqlCond\n";
|
|
||||||
$whereArr[] = "$sqlCond";
|
$whereArr[] = "$sqlCond";
|
||||||
}
|
}
|
||||||
if($type == 'and'){
|
if($operator == 'and'){
|
||||||
|
// operator: and
|
||||||
$from = array(); $joinArr = array();
|
$from = array(); $joinArr = array();
|
||||||
foreach($whereArr as $i=>$v){
|
foreach($whereArr as $i=>$v){
|
||||||
$from[] = "{$this->mdataTable} md$i";
|
$from[] = "{$this->mdataTable} md$i";
|
||||||
$whereArr[$i] = sprintf($v, "md$i", "md$i", "md$i");
|
$whereArr[$i] = sprintf($v, "md$i", "md$i", "md$i");
|
||||||
$joinArr[] = "md$i.gunid = md".($i+1).".gunid";
|
$joinArr[] = "md$i.gunid = md".($i+1).".gunid";
|
||||||
}
|
}
|
||||||
|
// there are n-1 join condtions for join n tables - remove last:
|
||||||
array_pop($joinArr);
|
array_pop($joinArr);
|
||||||
|
// query construcion:
|
||||||
$sql = "SELECT to_hex(md0.gunid)as gunid \nFROM ".join(", ", $from).
|
$sql = "SELECT to_hex(md0.gunid)as gunid \nFROM ".join(", ", $from).
|
||||||
"\nWHERE ".join(' AND ', $whereArr);
|
"\nWHERE ".join(' AND ', $whereArr);
|
||||||
|
// add join conditions if there are any:
|
||||||
if(count($joinArr)>0){ $sql .= " AND ".join(" AND ", $joinArr); }
|
if(count($joinArr)>0){ $sql .= " AND ".join(" AND ", $joinArr); }
|
||||||
}else{
|
}else{
|
||||||
|
// operator: or
|
||||||
foreach($whereArr as $i=>$v){
|
foreach($whereArr as $i=>$v){
|
||||||
$whereArr[$i] = sprintf($v, "md", "md", "md");
|
$whereArr[$i] = sprintf($v, "md", "md", "md");
|
||||||
}
|
}
|
||||||
|
// query construcion:
|
||||||
$sql = "\nSELECT to_hex(gunid)as gunid \n".
|
$sql = "\nSELECT to_hex(gunid)as gunid \n".
|
||||||
"FROM {$this->mdataTable} md \nWHERE ".join(' OR ', $whereArr);
|
"FROM {$this->mdataTable} md \nWHERE ".join(' OR ', $whereArr);
|
||||||
}
|
}
|
||||||
echo "$sql\n";
|
|
||||||
# var_dump($whereArr);
|
|
||||||
$sql0 = "SELECT to_hex(md.gunid)as gunid
|
|
||||||
FROM {$this->filesTable} f, {$this->mdataTable} md
|
|
||||||
WHERE f.gunid=md.gunid AND md.objns='_L' AND
|
|
||||||
md.object like '%$criteria%'
|
|
||||||
GROUP BY md.gunid
|
|
||||||
";
|
|
||||||
$res = $this->dbc->getCol($sql);
|
$res = $this->dbc->getCol($sql);
|
||||||
if(!is_array($res)) $res = array();
|
if(!is_array($res)) $res = array();
|
||||||
// $res = array_map("StoredFile::_normalizeGunid", $res); // TODO: correct!
|
$res = array_map(array("StoredFile", "_normalizeGunid"), $res);
|
||||||
return $res;
|
# return array('sql'=>$sql, 'results'=>$res);
|
||||||
|
return array('results'=>$res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------- info methods */
|
/* --------------------------------------------------------- info methods */
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.16 $
|
Version : $Revision: 1.17 $
|
||||||
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.16 $
|
* @version $Revision: 1.17 $
|
||||||
* @see BasicStor
|
* @see BasicStor
|
||||||
*/
|
*/
|
||||||
class GreenBox extends BasicStor{
|
class GreenBox extends BasicStor{
|
||||||
|
@ -258,19 +258,13 @@ class GreenBox extends BasicStor{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search in local metadata database.<br>
|
* Search in local metadata database.
|
||||||
* <b>TODO: NOT FINISHED</b><br>
|
|
||||||
* It will support structured queries - array of mode and query parts.
|
|
||||||
* Mode is "match all" or "match any".
|
|
||||||
* Query parts is array of [fieldname, operator, value] entities.
|
|
||||||
*
|
*
|
||||||
*
|
* @param criteria hash, search criteria - see
|
||||||
* @param criteria string, search query -
|
* <a href="../../search.html">format description</a>
|
||||||
* only one SQL LIKE term supported now.
|
|
||||||
* It will be searched in all literal object values
|
|
||||||
* in metadata database
|
|
||||||
* @param sessid string, session id
|
* @param sessid string, session id
|
||||||
* @return array of gunid strings
|
* @return hash, field 'results' is an array with gunid strings
|
||||||
|
* of files have been found
|
||||||
*/
|
*/
|
||||||
function localSearch($criteria, $sessid='')
|
function localSearch($criteria, $sessid='')
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.15 $
|
Version : $Revision: 1.16 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -42,11 +42,13 @@ class LocStor extends GreenBox{
|
||||||
*
|
*
|
||||||
* @param sessid string
|
* @param sessid string
|
||||||
* @param gunid string
|
* @param gunid string
|
||||||
* @param metadata string with metadata XML
|
* @param metadata string, metadata XML string
|
||||||
|
* @param fname string, human readable menmonic file name
|
||||||
|
* with extension corresponding to filetype
|
||||||
* @param chsum string, md5 checksum of media file
|
* @param chsum string, md5 checksum of media file
|
||||||
* @return struct {url:writable URL for HTTP PUT, token:access token
|
* @return struct {url:writable URL for HTTP PUT, token:access token
|
||||||
*/
|
*/
|
||||||
function storeAudioClipOpen($sessid, $gunid, $metadata, $chsum)
|
function storeAudioClipOpen($sessid, $gunid, $metadata, $fname, $chsum)
|
||||||
{
|
{
|
||||||
// test if specified gunid exists:
|
// test if specified gunid exists:
|
||||||
if(!preg_match("|^([0-9a-fA-F]{16})?$|", $gunid)){
|
if(!preg_match("|^([0-9a-fA-F]{16})?$|", $gunid)){
|
||||||
|
@ -71,12 +73,12 @@ class LocStor extends GreenBox{
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
}else{
|
}else{
|
||||||
// gunid doesn't exists - do insert
|
// gunid doesn't exists - do insert
|
||||||
$tmpid = uniqid('');
|
$tmpFname = uniqid('');
|
||||||
$parid = $this->_getHomeDirId($sessid);
|
$parid = $this->_getHomeDirId($sessid);
|
||||||
if(PEAR::isError($parid)) return $parid;
|
if(PEAR::isError($parid)) return $parid;
|
||||||
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
$oid = $this->addObj($tmpid , 'File', $parid);
|
$oid = $this->addObj($tmpFname , 'File', $parid);
|
||||||
if(PEAR::isError($oid)) return $oid;
|
if(PEAR::isError($oid)) return $oid;
|
||||||
$ac =& StoredFile::insert(
|
$ac =& StoredFile::insert(
|
||||||
&$this, $oid, '', '', $metadata, 'string',
|
&$this, $oid, '', '', $metadata, 'string',
|
||||||
|
@ -86,11 +88,15 @@ class LocStor extends GreenBox{
|
||||||
$res = $this->removeObj($oid);
|
$res = $this->removeObj($oid);
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
$res = $this->renameFile($oid, $ac->gunid, $sessid);
|
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
}
|
}
|
||||||
$res = $ac->setState('incomplete');
|
$res = $ac->setState('incomplete');
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
|
if($fname == ''){
|
||||||
|
$fname = "newFile";
|
||||||
|
}
|
||||||
|
$res = $this->renameFile($oid, $fname, $sessid);
|
||||||
|
if(PEAR::isError($res)) return $res;
|
||||||
return $this->bsOpenPut($chsum, $ac->gunid);
|
return $this->bsOpenPut($chsum, $ac->gunid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,11 +111,11 @@ class LocStor extends GreenBox{
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByToken(&$this, $token);
|
$ac =& StoredFile::recallByToken(&$this, $token);
|
||||||
if(PEAR::isError($ac)){ return $ac; }
|
if(PEAR::isError($ac)){ return $ac; }
|
||||||
$fname = $this->bsClosePut($token);
|
$tmpFname = $this->bsClosePut($token);
|
||||||
if(PEAR::isError($fname)){ $ac->delete(); return $fname; }
|
if(PEAR::isError($tmpFname)){ $ac->delete(); return $tmpFname; }
|
||||||
$res = $ac->replaceRawMediaData($fname);
|
$res = $ac->replaceRawMediaData($tmpFname);
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
if(file_exists($fname)) @unlink($fname);
|
if(file_exists($tmpFname)) @unlink($tmpFname);
|
||||||
$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;
|
||||||
|
@ -341,17 +347,20 @@ class LocStor extends GreenBox{
|
||||||
{
|
{
|
||||||
$this->deleteData();
|
$this->deleteData();
|
||||||
$rootHD = $this->getObjId('root', $this->storId);
|
$rootHD = $this->getObjId('root', $this->storId);
|
||||||
$this->login('root', $this->config['tmpRootPass']);
|
# $this->login('root', $this->config['tmpRootPass']);
|
||||||
$s = $this->sessid;
|
# $s = $this->sessid;
|
||||||
include"../tests/sampleData.php";
|
include"../tests/sampleData.php";
|
||||||
$res = array();
|
$res = array();
|
||||||
foreach($sampleData as $k=>$it){
|
foreach($sampleData as $k=>$it){
|
||||||
list($media, $meta) = $it;
|
list($media, $meta) = $it;
|
||||||
$r = $this->putFile($rootHD, "file".($k+1), $media, $meta, $s);
|
# $r = $this->putFile($rootHD, "file".($k+1), $media, $meta, $s);
|
||||||
|
$r = $this->bsPutFile(
|
||||||
|
$rootHD, basename($media), $media, $meta, '', 'audioclip'
|
||||||
|
);
|
||||||
if(PEAR::isError($r)){ return $r; }
|
if(PEAR::isError($r)){ return $r; }
|
||||||
$res[] = $this->_gunidFromId($r);
|
$res[] = $this->_gunidFromId($r);
|
||||||
}
|
}
|
||||||
$this->logout($this->sessid);
|
# $this->logout($this->sessid);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,9 +371,10 @@ class LocStor extends GreenBox{
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
* @param sessid string, session ID
|
||||||
* @param playlistId string, playlist global unique ID
|
* @param playlistId string, playlist global unique ID
|
||||||
|
* @param fname string, human readable menmonic file name
|
||||||
* @return string, playlist global unique ID
|
* @return string, playlist global unique ID
|
||||||
*/
|
*/
|
||||||
function createPlaylist($sessid, $playlistId)
|
function createPlaylist($sessid, $playlistId, $fname)
|
||||||
{
|
{
|
||||||
$ex = $this->existsPlaylist($sessid, $playlistId);
|
$ex = $this->existsPlaylist($sessid, $playlistId);
|
||||||
if(PEAR::isError($ex)){ return $ex; }
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
|
@ -373,12 +383,12 @@ class LocStor extends GreenBox{
|
||||||
'LocStor.php: createPlaylist: already exists'
|
'LocStor.php: createPlaylist: already exists'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$tmpid = uniqid('');
|
$tmpFname = uniqid('');
|
||||||
$parid = $this->_getHomeDirId($sessid);
|
$parid = $this->_getHomeDirId($sessid);
|
||||||
if(PEAR::isError($parid)) return $parid;
|
if(PEAR::isError($parid)) return $parid;
|
||||||
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
$oid = $this->addObj($tmpid , 'File', $parid);
|
$oid = $this->addObj($tmpFname , 'File', $parid);
|
||||||
if(PEAR::isError($oid)) return $oid;
|
if(PEAR::isError($oid)) return $oid;
|
||||||
$ac =& StoredFile::insert(&$this, $oid, '', '',
|
$ac =& StoredFile::insert(&$this, $oid, '', '',
|
||||||
'<?xml version="1.0" encoding="UTF-8"?><smil><body/></smil>',
|
'<?xml version="1.0" encoding="UTF-8"?><smil><body/></smil>',
|
||||||
|
@ -388,7 +398,10 @@ class LocStor extends GreenBox{
|
||||||
$res = $this->removeObj($oid);
|
$res = $this->removeObj($oid);
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
$res = $this->renameFile($oid, $ac->gunid, $sessid);
|
if($fname == ''){
|
||||||
|
$fname = "newFile.xml";
|
||||||
|
}
|
||||||
|
$res = $this->renameFile($oid, $fname, $sessid);
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
$res = $ac->setState('ready');
|
$res = $ac->setState('ready');
|
||||||
if(PEAR::isError($res)) return $res;
|
if(PEAR::isError($res)) return $res;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.12 $
|
Version : $Revision: 1.13 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -550,6 +550,9 @@ class StoredFile{
|
||||||
*/
|
*/
|
||||||
function _getExt()
|
function _getExt()
|
||||||
{
|
{
|
||||||
|
$fname = $this->_getFileName();
|
||||||
|
$ext = substr($fname, strrpos($fname, '.')+1);
|
||||||
|
if($ext !== FALSE) return $ext;
|
||||||
switch(strtolower($this->mime)){
|
switch(strtolower($this->mime)){
|
||||||
case"audio/mpeg":
|
case"audio/mpeg":
|
||||||
$ext="mp3"; break;
|
$ext="mp3"; break;
|
||||||
|
@ -611,6 +614,21 @@ class StoredFile{
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mnemonic file name
|
||||||
|
*
|
||||||
|
* @param gunid string, optional, global unique id of file
|
||||||
|
* @return string, see install()
|
||||||
|
*/
|
||||||
|
function _getFileName($gunid=NULL)
|
||||||
|
{
|
||||||
|
if(is_null($gunid)) $gunid = $this->gunid;
|
||||||
|
return $this->dbc->getOne("
|
||||||
|
SELECT name FROM {$this->filesTable}
|
||||||
|
WHERE gunid=x'$gunid'::bigint
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get and optionaly create subdirectory in real filesystem for storing
|
* Get and optionaly create subdirectory in real filesystem for storing
|
||||||
* raw media data
|
* raw media data
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: tomas $
|
# Author : $Author: tomas $
|
||||||
# Version : $Revision: 1.11 $
|
# Version : $Revision: 1.12 $
|
||||||
# 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 $
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -65,13 +65,11 @@ existsAudioClip() {
|
||||||
}
|
}
|
||||||
|
|
||||||
storeAudioClip() {
|
storeAudioClip() {
|
||||||
# echo -n "# storeAudioClip: "
|
|
||||||
# MEDIA=../tests/ex1.mp3
|
|
||||||
MEDIA=var/tests/ex1.mp3
|
MEDIA=var/tests/ex1.mp3
|
||||||
MD5=`md5sum $MEDIA`; for i in $MD5; do MD5=$i; break; done
|
MD5=`md5sum $MEDIA`; for i in $MD5; do MD5=$i; break; done
|
||||||
echo "md5=$MD5"
|
echo "md5=$MD5"
|
||||||
echo -n "# storeAudioClipOpen: "
|
echo -n "# storeAudioClipOpen: "
|
||||||
RES=`$XR_CLI storeAudioClipOpen "$SESSID" '' "$METADATA" "$MD5"` || \
|
RES=`$XR_CLI storeAudioClipOpen "$SESSID" '' "$METADATA" "stored file.mp3" "$MD5"` || \
|
||||||
{ ERN=$?; echo $RES; exit $ERN; }
|
{ ERN=$?; echo $RES; exit $ERN; }
|
||||||
unset URL
|
unset URL
|
||||||
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
|
for i in $RES; do if [ -z $URL ] ; then URL=$i; else TOKEN=$i; fi; done
|
||||||
|
@ -127,7 +125,6 @@ downloadMeta() {
|
||||||
echo $URL
|
echo $URL
|
||||||
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
echo -n "# curl: "
|
echo -n "# curl: "
|
||||||
# curl -Ifs $URL > /dev/null || { ERN=$?; echo $RES; exit $ERN; }
|
|
||||||
METAOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
|
METAOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
|
||||||
echo "OK"
|
echo "OK"
|
||||||
if [ $DEBUG ]; then echo $METAOUT; echo -n "Press enter ..."; read KEY; fi
|
if [ $DEBUG ]; then echo $METAOUT; echo -n "Press enter ..."; read KEY; fi
|
||||||
|
@ -169,7 +166,7 @@ PLID="123456789abcdef2"
|
||||||
|
|
||||||
createPlaylist() {
|
createPlaylist() {
|
||||||
echo -n "# createPlaylist: "
|
echo -n "# createPlaylist: "
|
||||||
$XR_CLI createPlaylist $SESSID $PLID || exit $?
|
$XR_CLI createPlaylist $SESSID $PLID "newPlaylist.xml" || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
accessPlaylist() {
|
accessPlaylist() {
|
||||||
|
|
|
@ -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/xmlrpc/xrLocStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -225,8 +225,10 @@ class XR_LocStor extends LocStor{
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> sessid : string - session id </li>
|
* <li> sessid : string - session id </li>
|
||||||
* <li> gunid : string - global unique id of AudioCLip</li>
|
* <li> gunid : string - global unique id of AudioCLip</li>
|
||||||
* <li> metadata : metadata XML string</li>
|
* <li> metadata : string - metadata XML string</li>
|
||||||
* <li> chsum : md5 checksum of media file</li>
|
* <li> fname : string - human readable menmonic file name
|
||||||
|
* with extension corresponding to filetype</li>
|
||||||
|
* <li> chsum : string - md5 checksum of media file</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* On success, returns a XML-RPC struct:
|
* On success, returns a XML-RPC struct:
|
||||||
|
@ -254,7 +256,7 @@ class XR_LocStor extends LocStor{
|
||||||
list($ok, $r) = $this->_xr_getPars($input);
|
list($ok, $r) = $this->_xr_getPars($input);
|
||||||
if(!$ok) return $r;
|
if(!$ok) return $r;
|
||||||
$res = $this->storeAudioClipOpen(
|
$res = $this->storeAudioClipOpen(
|
||||||
$r['sessid'], $r['gunid'], $r['metadata'], $r['chsum']
|
$r['sessid'], $r['gunid'], $r['metadata'], $r['fname'], $r['chsum']
|
||||||
);
|
);
|
||||||
if(PEAR::isError($res)){
|
if(PEAR::isError($res)){
|
||||||
return new XML_RPC_Response(0, 805,
|
return new XML_RPC_Response(0, 805,
|
||||||
|
@ -646,6 +648,7 @@ class XR_LocStor extends LocStor{
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> sessid : string - session id </li>
|
* <li> sessid : string - session id </li>
|
||||||
* <li> plid : string - global unique id of Playlist</li>
|
* <li> plid : string - global unique id of Playlist</li>
|
||||||
|
* <li> fname : string - human readable menmonic file name</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* On success, returns a XML-RPC struct with single field:
|
* On success, returns a XML-RPC struct with single field:
|
||||||
|
@ -671,7 +674,7 @@ class XR_LocStor extends LocStor{
|
||||||
{
|
{
|
||||||
list($ok, $r) = $this->_xr_getPars($input);
|
list($ok, $r) = $this->_xr_getPars($input);
|
||||||
if(!$ok) return $r;
|
if(!$ok) return $r;
|
||||||
$res = $this->createPlaylist($r['sessid'], $r['plid']);
|
$res = $this->createPlaylist($r['sessid'], $r['plid'], $r['fname']);
|
||||||
if(PEAR::isError($res)){
|
if(PEAR::isError($res)){
|
||||||
return new XML_RPC_Response(0, 805,
|
return new XML_RPC_Response(0, 805,
|
||||||
"xr_createPlaylist: ".$res->getMessage().
|
"xr_createPlaylist: ".$res->getMessage().
|
||||||
|
@ -1153,15 +1156,13 @@ class XR_LocStor extends LocStor{
|
||||||
* fields:
|
* fields:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> sessid : string - session id </li>
|
* <li> sessid : string - session id </li>
|
||||||
* <li> criteria : search string
|
* <li> criteria : search criteria, see
|
||||||
* - will be searched in object part of RDF tripples
|
<a href="../../search.html">format description</a>
|
||||||
* - <b>this parameter may be changed</b> structured
|
|
||||||
* queries will be supported in the near future</li>
|
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* On success, returns a XML-RPC struct with single field:
|
* On success, returns a XML-RPC struct with single field:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> results: array - array of gunids have founded</li>
|
* <li> results: array - array of gunids have been found</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* On errors, returns an XML-RPC error response.
|
* On errors, returns an XML-RPC error response.
|
||||||
|
@ -1190,7 +1191,7 @@ class XR_LocStor extends LocStor{
|
||||||
" ".$res->getUserInfo()
|
" ".$res->getUserInfo()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return new XML_RPC_Response(XML_RPC_encode(array('results'=>$res)));
|
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,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/Attic/xr_cli_test.py,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/Attic/xr_cli_test.py,v $
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -73,7 +73,6 @@ if verbose:
|
||||||
print "pars: "
|
print "pars: "
|
||||||
print pars
|
print pars
|
||||||
print "result:"
|
print "result:"
|
||||||
#sys.exit(0)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if method=="listMethods":
|
if method=="listMethods":
|
||||||
|
@ -85,59 +84,103 @@ try:
|
||||||
elif method=="test":
|
elif method=="test":
|
||||||
print server.locstor.test({'sessid':pars[0], 'teststring':pars[1]})
|
print server.locstor.test({'sessid':pars[0], 'teststring':pars[1]})
|
||||||
elif method=="authenticate":
|
elif method=="authenticate":
|
||||||
print server.locstor.authenticate({'login':pars[0], 'pass':pars[1]})['authenticate']
|
print server.locstor.authenticate(
|
||||||
|
{'login':pars[0], 'pass':pars[1]}
|
||||||
|
)['authenticate']
|
||||||
elif method=="login":
|
elif method=="login":
|
||||||
print server.locstor.login({'login':pars[0], 'pass':pars[1]})['sessid']
|
print server.locstor.login(
|
||||||
|
{'login':pars[0], 'pass':pars[1]}
|
||||||
|
)['sessid']
|
||||||
elif method=="logout":
|
elif method=="logout":
|
||||||
print server.locstor.logout({'sessid':pars[0]})
|
print server.locstor.logout({'sessid':pars[0]})
|
||||||
elif method=="storeAudioClipOpen":
|
elif method=="storeAudioClipOpen":
|
||||||
r = server.locstor.storeAudioClipOpen({'sessid':pars[0], 'gunid':pars[1], 'metadata':pars[2], 'chsum':pars[3]})
|
r = server.locstor.storeAudioClipOpen({
|
||||||
|
'sessid':pars[0], 'gunid':pars[1], 'metadata':pars[2],
|
||||||
|
'fname':pars[3], 'chsum':pars[4]
|
||||||
|
})
|
||||||
print r['url']+'\n'+r['token']
|
print r['url']+'\n'+r['token']
|
||||||
elif method=="storeAudioClipClose":
|
elif method=="storeAudioClipClose":
|
||||||
print server.locstor.storeAudioClipClose({'sessid':pars[0], 'token':pars[1]})['gunid']
|
print server.locstor.storeAudioClipClose(
|
||||||
|
{'sessid':pars[0], 'token':pars[1]}
|
||||||
|
)['gunid']
|
||||||
elif method=="accessRawAudioData":
|
elif method=="accessRawAudioData":
|
||||||
r = server.locstor.accessRawAudioData({'sessid':pars[0], 'gunid':pars[1]})
|
r = server.locstor.accessRawAudioData(
|
||||||
|
{'sessid':pars[0], 'gunid':pars[1]}
|
||||||
|
)
|
||||||
print r['url']+'\n'+r['token']
|
print r['url']+'\n'+r['token']
|
||||||
elif method=="releaseRawAudioData":
|
elif method=="releaseRawAudioData":
|
||||||
print server.locstor.releaseRawAudioData({'sessid':pars[0], 'token':pars[1]})
|
print server.locstor.releaseRawAudioData(
|
||||||
|
{'sessid':pars[0], 'token':pars[1]}
|
||||||
|
)
|
||||||
elif method=="downloadRawAudioDataOpen":
|
elif method=="downloadRawAudioDataOpen":
|
||||||
r = server.locstor.downloadRawAudioDataOpen({'sessid':pars[0], 'gunid':pars[1]})
|
r = server.locstor.downloadRawAudioDataOpen(
|
||||||
|
{'sessid':pars[0], 'gunid':pars[1]}
|
||||||
|
)
|
||||||
print r['url']+'\n'+r['token']
|
print r['url']+'\n'+r['token']
|
||||||
elif method=="downloadRawAudioDataClose":
|
elif method=="downloadRawAudioDataClose":
|
||||||
print server.locstor.downloadRawAudioDataClose({'sessid':pars[0], 'token':pars[1]})
|
print server.locstor.downloadRawAudioDataClose(
|
||||||
|
{'sessid':pars[0], 'token':pars[1]}
|
||||||
|
)
|
||||||
elif method=="downloadMetadataOpen":
|
elif method=="downloadMetadataOpen":
|
||||||
r = server.locstor.downloadMetadataOpen({'sessid':pars[0], 'gunid':pars[1]})
|
r = server.locstor.downloadMetadataOpen(
|
||||||
|
{'sessid':pars[0], 'gunid':pars[1]}
|
||||||
|
)
|
||||||
print r['url']+'\n'+r['token']
|
print r['url']+'\n'+r['token']
|
||||||
elif method=="downloadMetadataClose":
|
elif method=="downloadMetadataClose":
|
||||||
print server.locstor.downloadMetadataClose({'sessid':pars[0], 'token':pars[1]})
|
print server.locstor.downloadMetadataClose(
|
||||||
|
{'sessid':pars[0], 'token':pars[1]}
|
||||||
|
)
|
||||||
elif method=="deleteAudioClip":
|
elif method=="deleteAudioClip":
|
||||||
print server.locstor.deleteAudioClip({'sessid':pars[0], 'gunid':pars[1]})
|
print server.locstor.deleteAudioClip(
|
||||||
|
{'sessid':pars[0], 'gunid':pars[1]}
|
||||||
|
)
|
||||||
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], 'metadata':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':{
|
||||||
|
'filetype':'audioclip',
|
||||||
|
'operator':'and',
|
||||||
|
'conditions':[
|
||||||
|
{'cat':pars[1], 'op':'partial', 'val':pars[2]}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
elif method=="existsPlaylist":
|
elif method=="existsPlaylist":
|
||||||
print server.locstor.existsPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
print server.locstor.existsPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
elif method=="playlistIsAvailable":
|
elif method=="playlistIsAvailable":
|
||||||
print server.locstor.playlistIsAvailable({'sessid':pars[0], 'plid':pars[1]})
|
print server.locstor.playlistIsAvailable(
|
||||||
|
{'sessid':pars[0], 'plid':pars[1]}
|
||||||
|
)
|
||||||
elif method=="createPlaylist":
|
elif method=="createPlaylist":
|
||||||
print server.locstor.createPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
print server.locstor.createPlaylist(
|
||||||
|
{'sessid':pars[0], 'plid':pars[1], 'fname':pars[2]}
|
||||||
|
)
|
||||||
elif method=="editPlaylist":
|
elif method=="editPlaylist":
|
||||||
r = server.locstor.editPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
r = server.locstor.editPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
print r['url']+'\n'+r['token']
|
print r['url']+'\n'+r['token']
|
||||||
elif method=="savePlaylist":
|
elif method=="savePlaylist":
|
||||||
print server.locstor.savePlaylist({'sessid':pars[0], 'token':pars[1], 'newPlaylist':pars[2]})
|
print server.locstor.savePlaylist(
|
||||||
|
{'sessid':pars[0], 'token':pars[1], 'newPlaylist':pars[2]}
|
||||||
|
)
|
||||||
elif method=="deletePlaylist":
|
elif method=="deletePlaylist":
|
||||||
print server.locstor.deletePlaylist({'sessid':pars[0], 'plid':pars[1]})
|
print server.locstor.deletePlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
elif method=="accessPlaylist":
|
elif method=="accessPlaylist":
|
||||||
r = server.locstor.accessPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
r = server.locstor.accessPlaylist({'sessid':pars[0], 'plid':pars[1]})
|
||||||
print r['url']+'\n'+r['token']
|
print r['url']+'\n'+r['token']
|
||||||
elif method=="releasePlaylist":
|
elif method=="releasePlaylist":
|
||||||
print server.locstor.releasePlaylist({'sessid':pars[0], 'token':pars[1]})
|
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']
|
||||||
|
@ -151,5 +194,4 @@ try:
|
||||||
print "Unknown command: "+method
|
print "Unknown command: "+method
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except Error, v:
|
except Error, v:
|
||||||
# print "XML-RPC Error:",v
|
|
||||||
sys.exit(v)
|
sys.exit(v)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue