#1701 docs updated (+minor fix)

This commit is contained in:
tomash 2006-06-27 12:48:30 +00:00
parent 06f4328e0b
commit de2fe79833
5 changed files with 51 additions and 73 deletions

View file

@ -834,7 +834,10 @@ class BasicStor extends Alib{
* (may be empty or ommited only with less then 2 items in * (may be empty or ommited only with less then 2 items in
* "conditions" field) * "conditions" field)
* </li> * </li>
* <li>orderby : string - metadata category for sorting (optional)</li> * <li>orderby : string - metadata category for sorting (optional)
* default sorting by dc:title (+ primary sorting by filetype -
* audioclips, playlists, webstreams ...)
* </li>
* <li>desc : boolean - flag for descending order (optional)</li> * <li>desc : boolean - flag for descending order (optional)</li>
* <li>conditions - array of hashes with structure: * <li>conditions - array of hashes with structure:
* <ul> * <ul>

View file

@ -371,7 +371,10 @@ class GreenBox extends BasicStor{
* </li> * </li>
* <li>limit : int - limit for result arrays (0 means unlimited)</li> * <li>limit : int - limit for result arrays (0 means unlimited)</li>
* <li>offset : int - starting point (0 means without offset)</li> * <li>offset : int - starting point (0 means without offset)</li>
* <li>orderby : string - metadata category for sorting (optional)</li> * <li>orderby : string - metadata category for sorting (optional)
* default sorting by dc:title (+ primary sorting by filetype -
* audioclips, playlists, webstreams ...)
* </li>
* <li>desc : boolean - flag for descending order (optional)</li> * <li>desc : boolean - flag for descending order (optional)</li>
* <li>conditions - array of hashes with structure: * <li>conditions - array of hashes with structure:
* <ul> * <ul>
@ -1247,13 +1250,10 @@ class GreenBox extends BasicStor{
*/ */
function doTransportAction($trtok, $action) function doTransportAction($trtok, $action)
{ {
// DUMMY
return 'pending';
/*
require_once"Transport.php"; require_once"Transport.php";
$tr =& new Transport($this); $tr =& new Transport($this);
return $tr->setTransportRState($action); $res = $tr->doTransportAction($trtok, $action);
*/ return $res;
} }
/* ------------------------ methods for ls-archive-format file transports */ /* ------------------------ methods for ls-archive-format file transports */

View file

@ -304,7 +304,10 @@ class LocStor extends BasicStor{
* </li> * </li>
* <li>limit : int - limit for result arrays (0 means unlimited)</li> * <li>limit : int - limit for result arrays (0 means unlimited)</li>
* <li>offset : int - starting point (0 means without offset)</li> * <li>offset : int - starting point (0 means without offset)</li>
* <li>orderby : string - metadata category for sorting (optional)</li> * <li>orderby : string - metadata category for sorting (optional)
* default sorting by dc:title (+ primary sorting by filetype -
* audioclips, playlists, webstreams ...)
* </li>
* <li>desc : boolean - flag for descending order (optional)</li> * <li>desc : boolean - flag for descending order (optional)</li>
* <li>conditions - array of hashes with structure: * <li>conditions - array of hashes with structure:
* <ul> * <ul>

View file

@ -161,67 +161,6 @@ class Transport
'expectedchsum', 'realchsum', 'title', 'errmsg' 'expectedchsum', 'realchsum', 'title', 'errmsg'
) as $k){ ) as $k){
$res[$k] = ( isset($trec->row[$k]) ? $trec->row[$k] : NULL ); $res[$k] = ( isset($trec->row[$k]) ? $trec->row[$k] : NULL );
/* merged:
// DUMMY
switch($trtok){
case'123456789abcdeff'; // upload/download
return array(
'state' => 'finished',
'direction' => 'up',
'trtype' => 'audioclip',
'expectedsize' => 1024,
'realsize' => 1024,
'expectedchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'realchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'title' => 'DUMMY !',
'errmsg' => '',
);
case'123456789abcdef2'; // upload/download
return array(
'state' => 'running',
'direction' => 'down',
'trtype' => 'playlist',
'expectedsize' => 1624,
'realsize' => 342,
'expectedchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'realchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'title' => 'DUMMY playlist - 2',
'errmsg' => '',
);
case'123456789abcdef3'; // upload/download
return array(
'state' => 'paused',
'direction' => 'up',
'trtype' => 'audioclip',
'expectedsize' => 1024,
'realsize' => 322,
'expectedchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'realchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'title' => 'kakaoscsiga - 3',
'errmsg' => '',
);
case'123456789abcdef4'; // upload/download
return array(
'state' => 'running',
'direction' => 'up',
'trtype' => 'playlist',
'expectedsize' => 233,
'realsize' => 23,
'expectedchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'realchsum' => '12dd9137a855cf600881dd6d3ffa7517',
'title' => 'ez egy playlist - 4',
'errmsg' => '',
);
case'123456789abcdefe'; // search
return array(
'state' => 'finished',
);
default:
return PEAR::raiseError(
"Transport::getTransportInfo:".
" invalid transport token ($trtok)"
);
*/
} }
return $res; return $res;
} }
@ -252,6 +191,33 @@ class Transport
return $state; return $state;
} }
/**
* Pause, resume or cancel transport
*
* @param trtok: string - transport token
* @param action: string - pause | resume | cancel
* @return string - resulting transport state
*/
function doTransportAction($trtok, $action)
{
$trec = $r = TransportRecord::recall($this, $trtok);
if(PEAR::isError($r)){ return $r; }
switch($action){
case'pause';
$newState = 'paused';
break;
case'resume';
$newState = 'waiting';
break;
case'cancel';
$newState = 'closed';
break;
default:
}
$res = $trec->setState($newState);
return $res;
}
/* ------------- special methods for audioClip/webstream object transport */ /* ------------- special methods for audioClip/webstream object transport */
/** /**
@ -722,6 +688,7 @@ class Transport
case'closed': // excluded in SQL query too, but let check it here case'closed': // excluded in SQL query too, but let check it here
case'failed': // -"- case'failed': // -"-
case'pending': case'pending':
case'paused':
return TRUE; return TRUE;
break; break;
case'waiting': case'waiting':
@ -1282,7 +1249,8 @@ class Transport
fname, localfile, expectedsum, expectedsize, url, fname, localfile, expectedsum, expectedsize, url,
uid, target uid, target
FROM {$this->transTable} FROM {$this->transTable}
WHERE $dirCond $targetCond $trtokCond state not in ('closed', 'failed') WHERE $dirCond $targetCond $trtokCond
state not in ('closed', 'failed', 'paused')
ORDER BY start DESC ORDER BY start DESC
"); ");
if(PEAR::isError($rows)){ return $rows; } if(PEAR::isError($rows)){ return $rows; }

View file

@ -2243,7 +2243,10 @@ class XR_LocStor extends LocStor{
* </li> * </li>
* <li>limit : int - limit for result arrays (0 means unlimited)</li> * <li>limit : int - limit for result arrays (0 means unlimited)</li>
* <li>offset : int - starting point (0 means without offset)</li> * <li>offset : int - starting point (0 means without offset)</li>
* <li>orderby : string - metadata category for sorting (optional)</li> * <li>orderby : string - metadata category for sorting (optional)
* default sorting by dc:title (+ primary sorting by filetype -
* audioclips, playlists, webstreams ...)
* </li>
* <li>desc : boolean - flag for descending order (optional)</li> * <li>desc : boolean - flag for descending order (optional)</li>
* <li>conditions : array of struct with fields: * <li>conditions : array of struct with fields:
* <ul> * <ul>
@ -3062,7 +3065,8 @@ class XR_LocStor extends LocStor{
* fields: * fields:
* <ul> * <ul>
* <li> sessid : string - session id </li> * <li> sessid : string - session id </li>
* <li> criteria: LS criteria format (see localSearch)</li> * <li> criteria : hash, LS criteria format - see searchMetadata method
* </li>
* </ul> * </ul>
* *
* On success, returns a XML-RPC struct with the following fields: * On success, returns a XML-RPC struct with the following fields:
@ -3300,7 +3304,7 @@ class XR_LocStor extends LocStor{
* </ul> * </ul>
* *
* On success, returns the same result as searchMetadata with filetype * On success, returns the same result as searchMetadata with filetype
* 'all' and no conditions, * 'all' and no conditions, ordered by filetype and dc:title
* i.e. XML-RPC array of structs with fields: * i.e. XML-RPC array of structs with fields:
* <ul> * <ul>
* <li>cnt : integer - number of inserted files</li> * <li>cnt : integer - number of inserted files</li>