ftype added to files db table,
resolved bug from report 0000513 at http://bugs.campware.org/view.php?id=482
This commit is contained in:
parent
3b01df226c
commit
a7698073cb
7 changed files with 122 additions and 47 deletions
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
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.5 $
|
* @version $Revision: 1.6 $
|
||||||
* @see Alib
|
* @see Alib
|
||||||
*/
|
*/
|
||||||
class BasicStor extends Alib{
|
class BasicStor extends Alib{
|
||||||
|
@ -108,16 +108,18 @@ class BasicStor extends Alib{
|
||||||
* @param mediaFileLP string, local path of media file
|
* @param mediaFileLP string, local path of media file
|
||||||
* @param mdataFileLP string, local path of metadata file
|
* @param mdataFileLP string, local path of metadata file
|
||||||
* @param gunid string, global unique id OPTIONAL
|
* @param gunid string, global unique id OPTIONAL
|
||||||
|
* @param ftype string, internal file type
|
||||||
* @return int
|
* @return int
|
||||||
* @exception PEAR::error
|
* @exception PEAR::error
|
||||||
*/
|
*/
|
||||||
function bsPutFile($parid, $fileName,
|
function bsPutFile($parid, $fileName,
|
||||||
$mediaFileLP, $mdataFileLP, $gunid=NULL)
|
$mediaFileLP, $mdataFileLP, $gunid=NULL, $ftype='unKnown')
|
||||||
{
|
{
|
||||||
$name = "$fileName";
|
$name = "$fileName";
|
||||||
$id = $this->addObj($name , 'File', $parid);
|
$id = $this->addObj($name , 'File', $parid);
|
||||||
$ac =& StoredFile::insert(
|
$ac =& StoredFile::insert(
|
||||||
&$this, $id, $name, $mediaFileLP, $mdataFileLP, 'file', $gunid
|
&$this, $id, $name, $mediaFileLP, $mdataFileLP, 'file',
|
||||||
|
$gunid, $ftype
|
||||||
);
|
);
|
||||||
if(PEAR::isError($ac)) return $ac;
|
if(PEAR::isError($ac)) return $ac;
|
||||||
return $id;
|
return $id;
|
||||||
|
@ -971,16 +973,24 @@ class BasicStor extends Alib{
|
||||||
* <li>ready</li>
|
* <li>ready</li>
|
||||||
* <li>edited</li>
|
* <li>edited</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
|
||||||
|
* file types:
|
||||||
|
* <ul>
|
||||||
|
* <li>audioclip</li>
|
||||||
|
* <li>playlist</li>
|
||||||
|
* <li>preferences</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
function install()
|
function install()
|
||||||
{
|
{
|
||||||
parent::install();
|
parent::install();
|
||||||
echo "{$this->filesTable}\n";
|
#echo "{$this->filesTable}\n";
|
||||||
$r = $this->dbc->query("CREATE TABLE {$this->filesTable} (
|
$r = $this->dbc->query("CREATE TABLE {$this->filesTable} (
|
||||||
id int not null,
|
id int not null,
|
||||||
gunid bigint not null, -- global unique ID
|
gunid bigint not null, -- global unique ID
|
||||||
name varchar(255) not null default'', -- human file id ;)
|
name varchar(255) not null default'', -- human file id ;)
|
||||||
type varchar(255) not null default'', -- mime type
|
mime varchar(255) not null default'', -- mime type
|
||||||
|
ftype varchar(128) not null default'', -- file type
|
||||||
state varchar(128) not null default'empty', -- file state
|
state varchar(128) not null default'empty', -- file state
|
||||||
currentlyAccessing int not null default 0 -- access counter
|
currentlyAccessing int not null default 0 -- access counter
|
||||||
)");
|
)");
|
||||||
|
@ -992,7 +1002,7 @@ class BasicStor extends Alib{
|
||||||
$this->dbc->query("CREATE INDEX {$this->filesTable}_name_idx
|
$this->dbc->query("CREATE INDEX {$this->filesTable}_name_idx
|
||||||
ON {$this->filesTable} (name)");
|
ON {$this->filesTable} (name)");
|
||||||
|
|
||||||
echo "{$this->mdataTable}\n";
|
#echo "{$this->mdataTable}\n";
|
||||||
$this->dbc->createSequence("{$this->mdataTable}_id_seq");
|
$this->dbc->createSequence("{$this->mdataTable}_id_seq");
|
||||||
$r = $this->dbc->query("CREATE TABLE {$this->mdataTable} (
|
$r = $this->dbc->query("CREATE TABLE {$this->mdataTable} (
|
||||||
id int not null,
|
id int not null,
|
||||||
|
@ -1015,7 +1025,7 @@ class BasicStor extends Alib{
|
||||||
$this->dbc->query("CREATE INDEX {$this->mdataTable}_pred_idx
|
$this->dbc->query("CREATE INDEX {$this->mdataTable}_pred_idx
|
||||||
ON {$this->mdataTable} (predns, predicate)");
|
ON {$this->mdataTable} (predns, predicate)");
|
||||||
|
|
||||||
echo "{$this->accessTable}\n";
|
#echo "{$this->accessTable}\n";
|
||||||
$r = $this->dbc->query("CREATE TABLE {$this->accessTable} (
|
$r = $this->dbc->query("CREATE TABLE {$this->accessTable} (
|
||||||
gunid bigint,
|
gunid bigint,
|
||||||
sessid char(32) not null default'',
|
sessid char(32) not null default'',
|
||||||
|
|
|
@ -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/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.13 $
|
* @version $Revision: 1.14 $
|
||||||
* @see BasicStor
|
* @see BasicStor
|
||||||
*/
|
*/
|
||||||
class GreenBox extends BasicStor{
|
class GreenBox extends BasicStor{
|
||||||
|
@ -67,16 +67,18 @@ class GreenBox extends BasicStor{
|
||||||
* @param mdataFileLP string, local path of metadata file
|
* @param mdataFileLP string, local path of metadata file
|
||||||
* @param sessid string, session id
|
* @param sessid string, session id
|
||||||
* @param gunid string, global unique id OPTIONAL
|
* @param gunid string, global unique id OPTIONAL
|
||||||
|
* @param ftype string, internal file type
|
||||||
* @return int
|
* @return int
|
||||||
* @exception PEAR::error
|
* @exception PEAR::error
|
||||||
*/
|
*/
|
||||||
function putFile($parid, $fileName,
|
function putFile($parid, $fileName,
|
||||||
$mediaFileLP, $mdataFileLP, $sessid='', $gunid=NULL)
|
$mediaFileLP, $mdataFileLP, $sessid='',
|
||||||
|
$gunid=NULL, $ftype='audioclip')
|
||||||
{
|
{
|
||||||
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
if(($res = $this->_authorize('write', $parid, $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
return $this->bsPutFile(
|
return $this->bsPutFile(
|
||||||
$parid, $fileName, $mediaFileLP, $mdataFileLP, $gunid
|
$parid, $fileName, $mediaFileLP, $mdataFileLP, $gunid, $ftype
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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/LocStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -79,7 +79,8 @@ class LocStor extends GreenBox{
|
||||||
$oid = $this->addObj($tmpid , 'File', $parid);
|
$oid = $this->addObj($tmpid , 'File', $parid);
|
||||||
if(PEAR::isError($oid)) return $oid;
|
if(PEAR::isError($oid)) return $oid;
|
||||||
$ac =& StoredFile::insert(
|
$ac =& StoredFile::insert(
|
||||||
&$this, $oid, '', '', $metadata, 'string', $gunid
|
&$this, $oid, '', '', $metadata, 'string',
|
||||||
|
$gunid, 'audioclip'
|
||||||
);
|
);
|
||||||
if(PEAR::isError($ac)){
|
if(PEAR::isError($ac)){
|
||||||
$res = $this->removeObj($oid);
|
$res = $this->removeObj($oid);
|
||||||
|
@ -255,6 +256,20 @@ class LocStor extends GreenBox{
|
||||||
* @see GreenBox
|
* @see GreenBox
|
||||||
*/
|
*/
|
||||||
function existsAudioClip($sessid, $gunid)
|
function existsAudioClip($sessid, $gunid)
|
||||||
|
{
|
||||||
|
return LocStor::existsFile($sessid, $gunid, 'audioclip');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if file exists in the storage
|
||||||
|
*
|
||||||
|
* @param sessid string
|
||||||
|
* @param gunid string
|
||||||
|
* @param ftype string, internal file type
|
||||||
|
* @return boolean
|
||||||
|
* @see GreenBox
|
||||||
|
*/
|
||||||
|
function existsFile($sessid, $gunid, $ftype=NULL)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||||
if(PEAR::isError($ac)){
|
if(PEAR::isError($ac)){
|
||||||
|
@ -267,6 +282,7 @@ class LocStor extends GreenBox{
|
||||||
default: return $ac;
|
default: return $ac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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 $ac->exists();
|
||||||
|
|
|
@ -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/MetaData.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/MetaData.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -386,7 +386,7 @@ class MetaData{
|
||||||
$row = $this->dbc->getRow("
|
$row = $this->dbc->getRow("
|
||||||
SELECT * FROM {$this->mdataTable}
|
SELECT * FROM {$this->mdataTable}
|
||||||
WHERE gunid=x'{$this->gunid}'::bigint
|
WHERE gunid=x'{$this->gunid}'::bigint
|
||||||
AND subjns='_G' AND subject=x'{$this->gunid}'::bigint
|
AND subjns='_G' AND subject='{$this->gunid}'
|
||||||
");
|
");
|
||||||
if(PEAR::isError($row)) return $row;
|
if(PEAR::isError($row)) return $row;
|
||||||
if(is_null($row)){
|
if(is_null($row)){
|
||||||
|
|
|
@ -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/StoredFile.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/StoredFile.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -83,21 +83,22 @@ class StoredFile{
|
||||||
* @return instace of StoredFile object
|
* @return instace of StoredFile object
|
||||||
*/
|
*/
|
||||||
function insert(&$gb, $oid, $name,
|
function insert(&$gb, $oid, $name,
|
||||||
$mediaFileLP='', $metadata='', $mdataLoc='file', $gunid=NULL)
|
$mediaFileLP='', $metadata='', $mdataLoc='file',
|
||||||
|
$gunid=NULL, $type=NULL)
|
||||||
{
|
{
|
||||||
$ac =& new StoredFile(&$gb, ($gunid ? $gunid : NULL));
|
$ac =& new StoredFile(&$gb, ($gunid ? $gunid : NULL));
|
||||||
$ac->name = $name;
|
$ac->name = $name;
|
||||||
$ac->id = $oid;
|
$ac->id = $oid;
|
||||||
$ac->type = "unKnown";
|
$ac->mime = "unKnown";
|
||||||
$emptyState = TRUE;
|
$emptyState = TRUE;
|
||||||
if($ac->name=='') $ac->name=$ac->gunid;
|
if($ac->name=='') $ac->name=$ac->gunid;
|
||||||
$this->dbc->query("BEGIN");
|
$this->dbc->query("BEGIN");
|
||||||
$res = $ac->dbc->query("
|
$res = $ac->dbc->query("
|
||||||
INSERT INTO {$ac->filesTable}
|
INSERT INTO {$ac->filesTable}
|
||||||
(id, name, gunid, type, state)
|
(id, name, gunid, mime, state, ftype)
|
||||||
VALUES
|
VALUES
|
||||||
('$oid', '{$ac->name}', x'{$ac->gunid}'::bigint,
|
('$oid', '{$ac->name}', x'{$ac->gunid}'::bigint,
|
||||||
'{$ac->type}', 'incomplete')
|
'{$ac->mime}', 'incomplete', '$type')
|
||||||
");
|
");
|
||||||
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
|
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
|
||||||
// --- metadata insert:
|
// --- metadata insert:
|
||||||
|
@ -159,7 +160,7 @@ class StoredFile{
|
||||||
: "gunid=x'$gunid'::bigint"
|
: "gunid=x'$gunid'::bigint"
|
||||||
);
|
);
|
||||||
$row = $gb->dbc->getRow("
|
$row = $gb->dbc->getRow("
|
||||||
SELECT id, to_hex(gunid)as gunid, type, name
|
SELECT id, to_hex(gunid)as gunid, mime, name
|
||||||
FROM {$gb->filesTable} WHERE $cond
|
FROM {$gb->filesTable} WHERE $cond
|
||||||
");
|
");
|
||||||
if(PEAR::isError($row)) return $row;
|
if(PEAR::isError($row)) return $row;
|
||||||
|
@ -171,7 +172,7 @@ class StoredFile{
|
||||||
}
|
}
|
||||||
$gunid = StoredFile::_normalizeGunid($row['gunid']);
|
$gunid = StoredFile::_normalizeGunid($row['gunid']);
|
||||||
$ac =& new StoredFile(&$gb, $gunid);
|
$ac =& new StoredFile(&$gb, $gunid);
|
||||||
$ac->type = $row['type'];
|
$ac->mime = $row['mime'];
|
||||||
$ac->name = $row['name'];
|
$ac->name = $row['name'];
|
||||||
$ac->id = $row['id'];
|
$ac->id = $row['id'];
|
||||||
return $ac;
|
return $ac;
|
||||||
|
@ -220,7 +221,10 @@ class StoredFile{
|
||||||
*/
|
*/
|
||||||
function copyOf(&$src, $nid)
|
function copyOf(&$src, $nid)
|
||||||
{
|
{
|
||||||
$ac =& StoredFile::insert(&$src->gb, $nid, $src->name, $src->_getRealRADFname(), '');
|
$ac =& StoredFile::insert(
|
||||||
|
&$src->gb, $nid, $src->name, $src->_getRealRADFname(),
|
||||||
|
'', '', 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(), 'xml');
|
||||||
return $ac;
|
return $ac;
|
||||||
|
@ -441,13 +445,13 @@ class StoredFile{
|
||||||
/**
|
/**
|
||||||
* Set mime-type of virtual file
|
* Set mime-type of virtual file
|
||||||
*
|
*
|
||||||
* @param type string, mime-type
|
* @param mime string, mime-type
|
||||||
* @return boolean or error
|
* @return boolean or error
|
||||||
*/
|
*/
|
||||||
function setType($type)
|
function setType($mime)
|
||||||
{
|
{
|
||||||
$res = $this->dbc->query("
|
$res = $this->dbc->query("
|
||||||
UPDATE {$this->filesTable} SET type='$type'
|
UPDATE {$this->filesTable} SET mime='$mime'
|
||||||
WHERE gunid=x'{$this->gunid}'::bigint
|
WHERE gunid=x'{$this->gunid}'::bigint
|
||||||
");
|
");
|
||||||
if(PEAR::isError($res)){ return $res; }
|
if(PEAR::isError($res)){ return $res; }
|
||||||
|
@ -576,7 +580,7 @@ class StoredFile{
|
||||||
*/
|
*/
|
||||||
function _getExt()
|
function _getExt()
|
||||||
{
|
{
|
||||||
switch($this->type){
|
switch($this->mime){
|
||||||
case"audio/mpeg": $ext="mp3"; break;
|
case"audio/mpeg": $ext="mp3"; break;
|
||||||
case"audio/x-wave": $ext="wav"; break;
|
case"audio/x-wave": $ext="wav"; break;
|
||||||
case"application/x-ogg": $ext="ogg"; break;
|
case"application/x-ogg": $ext="ogg"; break;
|
||||||
|
@ -586,14 +590,46 @@ class StoredFile{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get filetype from global id
|
* Get mime-type from global id
|
||||||
*
|
*
|
||||||
* @param gunid string, optional, global unique id of file
|
* @param gunid string, optional, global unique id of file
|
||||||
|
* @return string, mime-type
|
||||||
*/
|
*/
|
||||||
function _getType($gunid)
|
function _getMime($gunid=NULL)
|
||||||
{
|
{
|
||||||
|
if(is_null($gunid)) $gunid = $this->gunid;
|
||||||
return $this->dbc->getOne("
|
return $this->dbc->getOne("
|
||||||
SELECT type FROM {$this->filesTable}
|
SELECT mime FROM {$this->filesTable}
|
||||||
|
WHERE gunid=x'$gunid'::bigint
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get storage-internal file type
|
||||||
|
*
|
||||||
|
* @param gunid string, optional, global unique id of file
|
||||||
|
* @return string, see install()
|
||||||
|
*/
|
||||||
|
function _getType($gunid=NULL)
|
||||||
|
{
|
||||||
|
if(is_null($gunid)) $gunid = $this->gunid;
|
||||||
|
return $this->dbc->getOne("
|
||||||
|
SELECT ftype FROM {$this->filesTable}
|
||||||
|
WHERE gunid=x'$gunid'::bigint
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get storage-internal file state
|
||||||
|
*
|
||||||
|
* @param gunid string, optional, global unique id of file
|
||||||
|
* @return string, see install()
|
||||||
|
*/
|
||||||
|
function _getState($gunid=NULL)
|
||||||
|
{
|
||||||
|
if(is_null($gunid)) $gunid = $this->gunid;
|
||||||
|
return $this->dbc->getOne("
|
||||||
|
SELECT state FROM {$this->filesTable}
|
||||||
WHERE gunid=x'$gunid'::bigint
|
WHERE gunid=x'$gunid'::bigint
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,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/testRunner.sh,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ COMM=$1
|
||||||
shift
|
shift
|
||||||
GUNID=$1
|
GUNID=$1
|
||||||
|
|
||||||
|
METADATA="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||||
|
<metadata><title>ěščřžé</title></metadata>"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
|
XMLRPC=`cd var/install; php -q getXrUrl.php` || exit $?
|
||||||
echo "# storageServer XMLRPC URL: $XMLRPC"
|
echo "# storageServer XMLRPC URL: $XMLRPC"
|
||||||
|
@ -52,7 +55,7 @@ test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
existsAudioClip() {
|
existsAudioClip() {
|
||||||
echo "# existsAudioClip: "
|
echo -n "# existsAudioClip (${GUNID}): "
|
||||||
$XR_CLI existsAudioClip $SESSID $GUNID || exit $?
|
$XR_CLI existsAudioClip $SESSID $GUNID || exit $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,23 +63,20 @@ storeAudioClip() {
|
||||||
# echo -n "# storeAudioClip: "
|
# echo -n "# storeAudioClip: "
|
||||||
# MEDIA=../tests/ex1.mp3
|
# MEDIA=../tests/ex1.mp3
|
||||||
MEDIA=var/tests/ex1.mp3
|
MEDIA=var/tests/ex1.mp3
|
||||||
# METADATA=var/tests/mdata4.xml
|
|
||||||
# RGUNID=`$XR_CLI storeAudioClip "$SESSID" '' "$MEDIA" "$METADATA"` || \
|
|
||||||
# { ERN=$?; echo $RGUNID; exit $ERN; }
|
|
||||||
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><title>ěščřžé</title></metadata>' "$MD5"` || \
|
RES=`$XR_CLI storeAudioClipOpen "$SESSID" '' "$METADATA" "$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
|
||||||
echo $TOKEN
|
echo $TOKEN
|
||||||
echo $URL
|
echo $URL
|
||||||
if [ $DEBUG ]; then echo -n "Pres a key ..."; read KEY; fi
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
echo -n "# curl (PUT): "
|
echo -n "# curl (PUT): "
|
||||||
curl -C 0 -T $MEDIA $URL || { ERN=$?; echo $RGUNID; exit $ERN; }
|
curl -C 0 -T $MEDIA $URL || { ERN=$?; echo $RGUNID; exit $ERN; }
|
||||||
echo "status: $?"
|
echo "status: $?"
|
||||||
if [ $DEBUG ]; then echo -n "Pres a key ..."; read KEY; fi
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
echo -n "# storeAudioClipClose: "
|
echo -n "# storeAudioClipClose: "
|
||||||
RGUNID=`$XR_CLI storeAudioClipClose "$SESSID" "$TOKEN"` || \
|
RGUNID=`$XR_CLI storeAudioClipClose "$SESSID" "$TOKEN"` || \
|
||||||
{ ERN=$?; echo $RGUNID; exit $ERN; }
|
{ ERN=$?; echo $RGUNID; exit $ERN; }
|
||||||
|
@ -91,7 +91,7 @@ accessRawAudioData() {
|
||||||
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
|
||||||
echo $TOKEN
|
echo $TOKEN
|
||||||
echo $URL
|
echo $URL
|
||||||
if [ $DEBUG ]; then echo -n "Pres a key ..."; read KEY; fi
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
echo -n "# releaseRawAudioData: "
|
echo -n "# releaseRawAudioData: "
|
||||||
$XR_CLI releaseRawAudioData $SESSID $TOKEN || exit $?
|
$XR_CLI releaseRawAudioData $SESSID $TOKEN || exit $?
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ downloadRAD() {
|
||||||
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
|
||||||
echo $TOKEN
|
echo $TOKEN
|
||||||
echo $URL
|
echo $URL
|
||||||
if [ $DEBUG ]; then echo -n "Pres a key ..."; 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; }
|
curl -Ifs $URL > /dev/null || { ERN=$?; echo $RES; exit $ERN; }
|
||||||
echo "status: $?"
|
echo "status: $?"
|
||||||
|
@ -120,12 +120,21 @@ downloadMeta() {
|
||||||
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
|
||||||
echo $TOKEN
|
echo $TOKEN
|
||||||
echo $URL
|
echo $URL
|
||||||
if [ $DEBUG ]; then echo -n "Pres a key ..."; read KEY; fi
|
if [ $DEBUG ]; then echo -n "Press enter ..."; read KEY; fi
|
||||||
echo -n "# curl: "
|
echo -n "# curl: "
|
||||||
if [ $DEBUG ]; then lynx -source $URL; else
|
# curl -Ifs $URL > /dev/null || { ERN=$?; echo $RES; exit $ERN; }
|
||||||
curl -Ifs $URL > /dev/null || { ERN=$?; echo $RES; exit $ERN; }
|
METAOUT=`curl -fs $URL;` || { ERN=$?; echo $RES; exit $ERN; }
|
||||||
|
echo "OK"
|
||||||
|
if [ $DEBUG ]; then echo $METAOUT; echo -n "Press enter ..."; read KEY; fi
|
||||||
|
echo -n "# metadata check:"
|
||||||
|
if [ "x$METAOUT" != "x$METADATA" ] ; then
|
||||||
|
echo " NOT MATCH"
|
||||||
|
echo " Expected:"; echo $METADATA
|
||||||
|
echo " Downloaded:"; echo $METAOUT
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo " OK"
|
||||||
fi
|
fi
|
||||||
echo "status: $?"
|
|
||||||
echo -n "# downloadMetadataClose: "
|
echo -n "# downloadMetadataClose: "
|
||||||
$XR_CLI downloadMetadataClose $SESSID $TOKEN || exit $?
|
$XR_CLI downloadMetadataClose $SESSID $TOKEN || exit $?
|
||||||
}
|
}
|
||||||
|
@ -199,10 +208,12 @@ elif [ "x$COMM" == "x" ]; then
|
||||||
login
|
login
|
||||||
storeAudioClip
|
storeAudioClip
|
||||||
GUNID=$RGUNID
|
GUNID=$RGUNID
|
||||||
|
existsAudioClip
|
||||||
accessRawAudioData
|
accessRawAudioData
|
||||||
downloadRAD
|
downloadRAD
|
||||||
downloadMeta
|
downloadMeta
|
||||||
deleteAudioClip
|
deleteAudioClip
|
||||||
|
existsAudioClip
|
||||||
logout
|
logout
|
||||||
echo "#XMLRPC tests: OK."
|
echo "#XMLRPC tests: OK."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
@ -24,7 +24,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/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 $
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -113,7 +113,7 @@ try:
|
||||||
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]} )['exists']
|
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], 'mdataFileLP':pars[2]})
|
||||||
elif method=="searchMetadata":
|
elif method=="searchMetadata":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue