In BasicStor.php, converted many functions to STATIC because thats what they were. This in turn converted many other functions to STATIC in other files. Commented out functions that were not in use. Removed code that was already commented out. The Prefs class no longer requires the greenbox in its constructor. Changed the poorly named "upload2Hub" to "uploadToHub". Changed "uploadFileToHub" to "uploadFileAsync" (partly because the idea of a Hub no longer exists). Added public/private keywords to functions in Transport.php. Converted some comments mentioning LS to CC. DataEngine class no longer needs a Greenbox object to initialize it. Expanded LocStor::searchMetadata() to handle remote searches as well as local searches.

This commit is contained in:
paul 2007-03-05 13:54:55 +00:00
parent 2a8f05a748
commit 0cd289c48b
30 changed files with 766 additions and 1020 deletions

View file

@ -34,7 +34,7 @@ class Archive extends XR_LocStor {
if (PEAR::isError($owner)) { if (PEAR::isError($owner)) {
return $owner; return $owner;
} }
$res = $this->bsOpenPut($chsum, NULL, $owner); $res = BasicStor::bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -52,7 +52,7 @@ class Archive extends XR_LocStor {
*/ */
function uploadCheck($token) function uploadCheck($token)
{ {
return $this->bsCheckPut($token); return BasicStor::bsCheckPut($token);
} }
@ -69,7 +69,7 @@ class Archive extends XR_LocStor {
*/ */
function uploadClose($token, $trtype, $pars=array()) function uploadClose($token, $trtype, $pars=array())
{ {
$res = $this->bsClosePut($token); $res = BasicStor::bsClosePut($token);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -77,7 +77,7 @@ class Archive extends XR_LocStor {
switch ($trtype) { switch ($trtype) {
case "audioclip": case "audioclip":
$mdtoken = $pars['mdpdtoken']; $mdtoken = $pars['mdpdtoken'];
$res = $this->bsClosePut($mdtoken); $res = BasicStor::bsClosePut($mdtoken);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -128,7 +128,7 @@ class Archive extends XR_LocStor {
case "playlistPkg": case "playlistPkg":
$chsum = md5_file($fname); $chsum = md5_file($fname);
// importPlaylistOpen: // importPlaylistOpen:
$res = $this->bsOpenPut($chsum, NULL, $owner); $res = BasicStor::bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -225,14 +225,14 @@ class Archive extends XR_LocStor {
$res = $this->accessPlaylist($sessid, $gunid); $res = $this->accessPlaylist($sessid, $gunid);
break; break;
case "playlistPkg": case "playlistPkg":
$res = $this->bsExportPlaylistOpen($gunid); $res = BasicStor::bsExportPlaylistOpen($gunid);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_'); $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
$plfpath = "$tmpn.lspl"; $plfpath = "$tmpn.lspl";
copy($res['fname'], $plfpath); copy($res['fname'], $plfpath);
$res = $this->bsExportPlaylistClose($res['token']); $res = BasicStor::bsExportPlaylistClose($res['token']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -268,7 +268,7 @@ class Archive extends XR_LocStor {
case "metadata": case "metadata":
case "playlist": case "playlist":
case "playlistPkg": case "playlistPkg":
$title = $this->bsGetTitle(NULL, $gunid); $title = BasicStor::bsGetTitle(NULL, $gunid);
break; break;
case "searchjob": case "searchjob":
$title = 'searchjob'; $title = 'searchjob';

View file

@ -193,8 +193,8 @@ if (isset($_REQUEST['popup']) && is_array($_REQUEST['popup'])){
$uiBrowser->EXCHANGE->createBackupDownload(); $uiBrowser->EXCHANGE->createBackupDownload();
break; break;
case 'TR.confirmUpload2Hub': case 'TR.confirmUploadToHub':
$uiBrowser->TRANSFERS->upload2Hub($_REQUEST['id']); $uiBrowser->TRANSFERS->uploadToHub($_REQUEST['id']);
$Smarty->display('popup/TR.confirmTransfer.tpl'); $Smarty->display('popup/TR.confirmTransfer.tpl');
break; break;

View file

@ -202,8 +202,10 @@ switch ($_REQUEST['act']) {
break; break;
case "HUBSEARCH.newSearch": case "HUBSEARCH.newSearch":
$uiHandler->HUBSEARCH->newSearch($_REQUEST); $uiHandler->SEARCH->newSearch($_REQUEST, "remote");
break; break;
// $uiHandler->HUBSEARCH->newSearch($_REQUEST);
// break;
case "HUBSEARCH.reorder": case "HUBSEARCH.reorder":
$uiHandler->HUBSEARCH->reorder($_REQUEST['by']); $uiHandler->HUBSEARCH->reorder($_REQUEST['by']);

View file

@ -45,6 +45,6 @@ onClick="return contextmenu('{$i.id}'
{/if} {/if}
{/if} {/if}
, 'TR.upload2Hub' , 'TR.uploadToHub'
)" )"

View file

@ -50,5 +50,5 @@ onClick="return contextmenu('{$i.id}'
{/if} {/if}
{/if} {/if}
, 'TR.upload2Hub' , 'TR.uploadToHub'
)" )"

View file

@ -1,6 +1,6 @@
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
// www.jjam.de - Kontextmenü mit JavaScript - Version 15.12.2002 // www.jjam.de - Kontextmen<EFBFBD> mit JavaScript - Version 15.12.2002
// Browser detection // Browser detection
ie5 = (document.getElementById && document.all && document.styleSheets) ? 1 : 0; ie5 = (document.getElementById && document.all && document.styleSheets) ? 1 : 0;
@ -19,7 +19,7 @@ function contextmenu(param) {
var sp2 = "&nbsp;&nbsp;"; var sp2 = "&nbsp;&nbsp;";
var sp5 = sp2 + sp2 + "&nbsp;"; // Leerzeichen als Abstandshalter (flexibler und code-sparender als eine aufwendige Tabellenkonstruktion) ; var sp5 = sp2 + sp2 + "&nbsp;"; // Leerzeichen als Abstandshalter (flexibler und code-sparender als eine aufwendige Tabellenkonstruktion) ;
var oF = "onfocus = 'if (this.blur) this.blur()'"; // Um hässlichen Linkrahmen in einigen Browsern zu vermeiden; var oF = "onfocus = 'if (this.blur) this.blur()'"; // Um h<EFBFBD>sslichen Linkrahmen in einigen Browsern zu vermeiden;
var entry = new Array(); var entry = new Array();
//contextmenuStatus = 0; //contextmenuStatus = 0;
@ -130,8 +130,8 @@ function contextmenu(param) {
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=SUBJECTS.confirmRemoveSubj&"+param+"', 'confirmRemoveSubj', 400, 50)\" "+oF+">&nbsp;##Delete##&nbsp;</a></li>"; contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=SUBJECTS.confirmRemoveSubj&"+param+"', 'confirmRemoveSubj', 400, 50)\" "+oF+">&nbsp;##Delete##&nbsp;</a></li>";
break; break;
case "TR.upload2Hub": case "TR.uploadToHub":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=TR.confirmUpload2Hub&id="+param+"', 'confirmUpload2Hub', 400, 50)\" "+oF+">&nbsp;##Transfer to the hub##&nbsp;</a></li>"; contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href=\"javascript: popup('{$UI_BROWSER}?popup[]=TR.confirmUploadToHub&id="+param+"', 'confirmUploadToHub', 400, 50)\" "+oF+">&nbsp;##Transfer to the hub##&nbsp;</a></li>";
break; break;
case "TR.downloadFromHub": case "TR.downloadFromHub":

View file

@ -185,7 +185,7 @@ class uiHandler extends uiBase {
return FALSE; return FALSE;
} }
$result = $this->gb->bsSetMetadataBatch($storedFile->getId(), $metadata); $result = BasicStor::bsSetMetadataBatch($storedFile->getId(), $metadata);
$this->redirUrl = UI_BROWSER."?act=addFileMData&id=".$storedFile->getId(); $this->redirUrl = UI_BROWSER."?act=addFileMData&id=".$storedFile->getId();
if (UI_VERBOSE) { if (UI_VERBOSE) {

View file

@ -117,9 +117,20 @@ class uiSearch
} }
function newSearch(&$formdata) /**
* Enter description here...
*
* @param array $formdata
* The $_REQUEST array.
* @param string $p_host
* Can be "local" or "remote" depending on which
* storage server you want to search.
* @return void
*/
function newSearch(&$formdata, $p_host = "local")
{ {
$this->results = NULL; $this->results = NULL;
$this->criteria['host'] = $p_host;
$this->criteria['conditions'] = NULL; $this->criteria['conditions'] = NULL;
$this->criteria['offset'] = NULL; $this->criteria['offset'] = NULL;
$this->criteria['form'] = NULL; $this->criteria['form'] = NULL;
@ -128,7 +139,7 @@ class uiSearch
$this->criteria['limit'] = $formdata['limit']; $this->criteria['limit'] = $formdata['limit'];
$this->criteria['counter'] = 0; $this->criteria['counter'] = 0;
// $criteria['form'] is used for retransfer to form // $criteria['form'] is used for retransfer of the form
$this->criteria['form']['operator'] = $formdata['operator']; $this->criteria['form']['operator'] = $formdata['operator'];
$this->criteria['form']['filetype'] = $formdata['filetype']; $this->criteria['form']['filetype'] = $formdata['filetype'];
$this->criteria['form']['limit'] = $formdata['limit']; $this->criteria['form']['limit'] = $formdata['limit'];

View file

@ -153,7 +153,7 @@ class uiTransfers
} }
function upload2Hub($id) function uploadToHub($id)
{ {
$gunid = BasicStor::GunidFromId($id); $gunid = BasicStor::GunidFromId($id);
$type = BasicStor::GetType($gunid); $type = BasicStor::GetType($gunid);
@ -161,14 +161,14 @@ class uiTransfers
switch ($type) { switch ($type) {
case 'audioClip': case 'audioClip':
case 'audioclip': case 'audioclip':
$r = $this->Base->gb->upload2Hub($gunid); $r = $this->Base->gb->uploadToHub($gunid);
break; break;
case 'playlist': case 'playlist':
$this->Base->gb->upload2Hub($gunid); $this->Base->gb->uploadToHub($gunid);
break; break;
default: default:
// TODO: it is not implemented in gb, and this way maybe impossible // TODO: it is not implemented in gb, and this way maybe impossible
//$this->Base->gb->uploadFile2Hub($gunid); //$this->Base->gb->uploadFileAsync($gunid);
return false; return false;
} }
} }

View file

@ -20,8 +20,6 @@ $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
$bs = new BasicStor(); $bs = new BasicStor();
$stid = $bs->storId; $stid = $bs->storId;
#var_dump($stid); exit;
#$farr = $bs->bsListFolder($stid); var_dump($farr); exit;
function admDumpFolder(&$bs, $fid, $ind='') function admDumpFolder(&$bs, $fid, $ind='')
{ {
@ -47,7 +45,7 @@ function admDumpFolder(&$bs, $fid, $ind='')
$pars['name'] = "$name"; $pars['name'] = "$name";
switch ($type) { switch ($type) {
case "Folder": case "Folder":
$farr = $bs->bsListFolder($fid); $farr = BasicStor::bsListFolder($fid);
if (PEAR::isError($farr)) { if (PEAR::isError($farr)) {
echo $farr->getMessage(); echo $farr->getMessage();
exit; exit;

View file

@ -226,7 +226,7 @@ function camp_import_audio_file($p_filepath, $p_importMode = null, $p_testOnly =
"mime" => $metadata['dc:format'] "mime" => $metadata['dc:format']
); );
// $timeBegin = microtime(true); // $timeBegin = microtime(true);
$storedFile = $greenbox->bsPutFile($parentId, $values, $doCopyFiles); $storedFile = BasicStor::bsPutFile($parentId, $values, $doCopyFiles);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
import_err($storedFile, "Error in bsPutFile()"); import_err($storedFile, "Error in bsPutFile()");
echo var_export($metadata)."\n"; echo var_export($metadata)."\n";
@ -239,7 +239,7 @@ function camp_import_audio_file($p_filepath, $p_importMode = null, $p_testOnly =
// Note: the bsSetMetadataBatch() takes up .25 of a second // Note: the bsSetMetadataBatch() takes up .25 of a second
// on my 3Ghz computer. We should try to speed this up. // on my 3Ghz computer. We should try to speed this up.
// $timeBegin = microtime(true); // $timeBegin = microtime(true);
$r = $greenbox->bsSetMetadataBatch($id, $metadata); $r = BasicStor::bsSetMetadataBatch($id, $metadata);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
import_err($r, "Error in bsSetMetadataBatch()"); import_err($r, "Error in bsSetMetadataBatch()");
echo var_export($metadata)."\n"; echo var_export($metadata)."\n";

View file

@ -91,7 +91,7 @@ function ls_restore_restoreObject($obj, $parid, $reallyInsert=TRUE){
"gunid" => $obj['gunid'], "gunid" => $obj['gunid'],
"filetype" => strtolower($obj['type']) "filetype" => strtolower($obj['type'])
); );
$r = $bs->bsPutFile($parid, $values); $r = BasicStor::bsPutFile($parid, $values);
ls_restore_checkErr($r, __LINE__); ls_restore_checkErr($r, __LINE__);
} }
break; break;

View file

@ -948,7 +948,7 @@ const std::string doTransportActionActionParamName = "action";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the upload to hub method on the storage server * The name of the upload to hub method on the storage server
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
const std::string uploadToHubMethodName = "locstor.upload2Hub"; const std::string uploadToHubMethodName = "locstor.uploadToHub";
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The name of the session ID parameter in the input structure * The name of the session ID parameter in the input structure

View file

@ -75,7 +75,7 @@ class BasicStor {
* @return int|PEAR_Error * @return int|PEAR_Error
* ID of the StoredFile that was created. * ID of the StoredFile that was created.
*/ */
public function bsPutFile($p_parentId, $p_values, $p_copyMedia=TRUE) public static function bsPutFile($p_parentId, $p_values, $p_copyMedia=TRUE)
{ {
if (!isset($p_values['filetype']) || !isset($p_values['filename'])) { if (!isset($p_values['filetype']) || !isset($p_values['filename'])) {
return NULL; return NULL;
@ -111,7 +111,7 @@ class BasicStor {
* @param string $newName * @param string $newName
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
public function bsRenameFile($id, $newName) public static function bsRenameFile($id, $newName)
{ {
$parid = M2tree::GetParent($id); $parid = M2tree::GetParent($id);
switch (BasicStor::GetObjType($id)) { switch (BasicStor::GetObjType($id)) {
@ -145,7 +145,7 @@ class BasicStor {
* Destination folder local id * Destination folder local id
* @return boolean/PEAR_Error * @return boolean/PEAR_Error
*/ */
public function bsMoveFile($id, $did) public static function bsMoveFile($id, $did)
{ {
$parid = M2tree::GetParent($id); $parid = M2tree::GetParent($id);
if (BasicStor::GetObjType($did) !== 'Folder') { if (BasicStor::GetObjType($did) !== 'Folder') {
@ -180,7 +180,7 @@ class BasicStor {
* Destination folder local id * Destination folder local id
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
public function bsCopyFile($id, $did) public static function bsCopyFile($id, $did)
{ {
$parid = M2tree::GetParent($id); $parid = M2tree::GetParent($id);
if (BasicStor::GetObjType($did) !== 'Folder') { if (BasicStor::GetObjType($did) !== 'Folder') {
@ -220,7 +220,7 @@ class BasicStor {
* @return true|PEAR_Error * @return true|PEAR_Error
* @exception PEAR::error * @exception PEAR::error
*/ */
public function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file') public static function bsReplaceFile($id, $localFilePath, $metadataFilePath, $mdataLoc='file')
{ {
$storedFile = StoredFile::Recall($id); $storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) { if (is_null($storedFile) || PEAR::isError($storedFile)) {
@ -284,7 +284,7 @@ class BasicStor {
break; break;
default: default:
} }
$res = $this->bsMoveFile($id, $did); $res = BasicStor::bsMoveFile($id, $did);
return $res; return $res;
} }
@ -501,7 +501,7 @@ class BasicStor {
* array with strings: * array with strings:
* downloadable URL, download token, chsum, size, filename * downloadable URL, download token, chsum, size, filename
*/ */
public function bsOpenDownload($id, $part='media', $parent='0') public static function bsOpenDownload($id, $part='media', $parent='0')
{ {
$storedFile = StoredFile::Recall($id); $storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) { if (is_null($storedFile) || PEAR::isError($storedFile)) {
@ -549,7 +549,7 @@ class BasicStor {
* @return string * @return string
* gunid * gunid
*/ */
public function bsCloseDownload($token, $part='media') public static function bsCloseDownload($token, $part='media')
{ {
if (!BasicStor::bsCheckToken($token, 'download')) { if (!BasicStor::bsCheckToken($token, 'download')) {
return PEAR::raiseError( return PEAR::raiseError(
@ -580,7 +580,7 @@ class BasicStor {
* fname string: writable local filename * fname string: writable local filename
* token string: PUT token * token string: PUT token
*/ */
public function bsOpenPut($chsum, $gunid, $owner=NULL) public static function bsOpenPut($chsum, $gunid, $owner=NULL)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
if (!is_null($gunid)) { if (!is_null($gunid)) {
@ -622,7 +622,7 @@ class BasicStor {
* fname string, local path of the file having been put * fname string, local path of the file having been put
* owner int, local subject id - owner of token * owner int, local subject id - owner of token
*/ */
public function bsClosePut($token) public static function bsClosePut($token)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$token = StoredFile::NormalizeGunid($token); $token = StoredFile::NormalizeGunid($token);
@ -689,7 +689,7 @@ class BasicStor {
* realsum: string - checksum of uploaded file * realsum: string - checksum of uploaded file
* ) * )
*/ */
public function bsCheckPut($token) public static function bsCheckPut($token)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
if (!BasicStor::bsCheckToken($token, 'put')) { if (!BasicStor::bsCheckToken($token, 'put')) {
@ -787,14 +787,14 @@ class BasicStor {
* 'file'|'string' * 'file'|'string'
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
public function bsReplaceMetadata($id, $mdata, $mdataLoc='file') // public static function bsReplaceMetadata($id, $mdata, $mdataLoc='file')
{ // {
$storedFile = StoredFile::Recall($id); // $storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) { // if (is_null($storedFile) || PEAR::isError($storedFile)) {
return $storedFile; // return $storedFile;
} // }
return $storedFile->setMetadata($mdata, $mdataLoc); // return $storedFile->setMetadata($mdata, $mdataLoc);
} // }
/** /**
@ -804,7 +804,7 @@ class BasicStor {
* Virtual file's local id * Virtual file's local id
* @return string|PEAR_Error * @return string|PEAR_Error
*/ */
public function bsGetMetadata($id) public static function bsGetMetadata($id)
{ {
$storedFile = StoredFile::Recall($id); $storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) { if (is_null($storedFile) || PEAR::isError($storedFile)) {
@ -828,7 +828,7 @@ class BasicStor {
* xml:lang for default language * xml:lang for default language
* @return string|PEAR_Error * @return string|PEAR_Error
*/ */
public function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL) public static function bsGetTitle($id, $gunid=NULL, $lang=NULL, $deflang=NULL)
{ {
if (is_null($gunid)) { if (is_null($gunid)) {
$storedFile = StoredFile::Recall($id); $storedFile = StoredFile::Recall($id);
@ -886,7 +886,7 @@ class BasicStor {
* if an array is passed, an array is returned. * if an array is passed, an array is returned.
* @see Metadata::getMetadataValue * @see Metadata::getMetadataValue
*/ */
public function bsGetMetadataValue($id, $category = null) public static function bsGetMetadataValue($id, $category = null)
{ {
if (!is_numeric($id)) { if (!is_numeric($id)) {
return null; return null;
@ -928,7 +928,7 @@ class BasicStor {
* flag, if true, regenerate XML file * flag, if true, regenerate XML file
* @return boolean * @return boolean
*/ */
public function bsSetMetadataValue($id, $category, $value, public static function bsSetMetadataValue($id, $category, $value,
$lang=NULL, $mid=NULL, $container='metadata', $regen=TRUE) $lang=NULL, $mid=NULL, $container='metadata', $regen=TRUE)
{ {
if (!is_string($category) || is_array($value)) { if (!is_string($category) || is_array($value)) {
@ -994,7 +994,7 @@ class BasicStor {
* flag, if true, regenerate XML file * flag, if true, regenerate XML file
* @return boolean * @return boolean
*/ */
public function bsSetMetadataBatch( public static function bsSetMetadataBatch(
$id, $values, $lang=NULL, $container='metadata', $regen=TRUE) $id, $values, $lang=NULL, $container='metadata', $regen=TRUE)
{ {
if (!is_array($values)) { if (!is_array($values)) {
@ -1005,7 +1005,7 @@ class BasicStor {
return $storedFile; return $storedFile;
} }
foreach ($values as $category => $oneValue) { foreach ($values as $category => $oneValue) {
$res = $this->bsSetMetadataValue($storedFile, $category, $res = BasicStor::bsSetMetadataValue($storedFile, $category,
$oneValue, $lang, NULL, $container, FALSE); $oneValue, $lang, NULL, $container, FALSE);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
@ -1075,10 +1075,10 @@ class BasicStor {
* length: string - dcterms:extent in extent format * length: string - dcterms:extent in extent format
* @see DataEngine * @see DataEngine
*/ */
public function bsLocalSearch($criteria, $limit=0, $offset=0) public static function bsLocalSearch($criteria, $limit=0, $offset=0)
{ {
require_once("DataEngine.php"); require_once("DataEngine.php");
$de = new DataEngine($this); $de = new DataEngine();
$res = $de->localSearch($criteria, $limit, $offset); $res = $de->localSearch($criteria, $limit, $offset);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
@ -1104,10 +1104,10 @@ class BasicStor {
* cnt : integer - number of matching values * cnt : integer - number of matching values
* @see DataEngine * @see DataEngine
*/ */
public function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL) public static function bsBrowseCategory($category, $limit=0, $offset=0, $criteria=NULL)
{ {
require_once("DataEngine.php"); require_once("DataEngine.php");
$de = new DataEngine($this); $de = new DataEngine();
return $de->browseCategory($category, $limit, $offset, $criteria); return $de->browseCategory($category, $limit, $offset, $criteria);
} }
@ -1129,7 +1129,7 @@ class BasicStor {
* fname string: readable fname, * fname string: readable fname,
* token string: access token * token string: access token
*/ */
public function bsExportPlaylistOpen($plids, $type='lspl', $withContent=TRUE) public static function bsExportPlaylistOpen($plids, $type='lspl', $withContent=TRUE)
{ {
global $CC_CONFIG; global $CC_CONFIG;
require_once("Playlist.php"); require_once("Playlist.php");
@ -1237,7 +1237,7 @@ class BasicStor {
* Access token obtained from bsExportPlaylistOpen method call. * Access token obtained from bsExportPlaylistOpen method call.
* @return true/PEAR_Error * @return true/PEAR_Error
*/ */
public function bsExportPlaylistClose($token) public static function bsExportPlaylistClose($token)
{ {
$r = BasicStor::bsRelease($token, 'access'); $r = BasicStor::bsRelease($token, 'access');
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
@ -1297,7 +1297,7 @@ class BasicStor {
"gunid" => $plid, "gunid" => $plid,
"filetype" => "playlist" "filetype" => "playlist"
); );
$storedFile = $this->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
$res = $storedFile->getId(); $res = $storedFile->getId();
break; break;
case "smil": case "smil":
@ -1331,7 +1331,7 @@ class BasicStor {
/** /**
* Import playlist in LS Archive format * Import playlist in CC Archive format
* *
* @param int $parid * @param int $parid
* Destination folder local id * Destination folder local id
@ -1384,7 +1384,7 @@ class BasicStor {
if (!file_exists($metadata)) { if (!file_exists($metadata)) {
$metadata = NULL; $metadata = NULL;
} }
$exists = $this->bsExistsFile($gunid, NULL, TRUE); $exists = BasicStor::bsExistsFile($gunid, NULL, TRUE);
if( $exists ) { if( $exists ) {
$res = BasicStor::IdFromGunid($gunid); $res = BasicStor::IdFromGunid($gunid);
if (!PEAR::isError($res)) { if (!PEAR::isError($res)) {
@ -1399,7 +1399,7 @@ class BasicStor {
"gunid" => $gunid, "gunid" => $gunid,
"filetype" => "audioclip" "filetype" => "audioclip"
); );
$storedFile = $this->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
$res = $storedFile->getId(); $res = $storedFile->getId();
} }
@unlink("$tmpdc/{$it['rawMedia']}"); @unlink("$tmpdc/{$it['rawMedia']}");
@ -1444,7 +1444,7 @@ class BasicStor {
* @return array * @return array
* @todo THERE IS A BUG IN THIS FUNCTION * @todo THERE IS A BUG IN THIS FUNCTION
*/ */
public function bsListFolder($id) public static function bsListFolder($id)
{ {
if (BasicStor::GetObjType($id) !== 'Folder') { if (BasicStor::GetObjType($id) !== 'Folder') {
return PEAR::raiseError( return PEAR::raiseError(
@ -1489,7 +1489,7 @@ class BasicStor {
* Virtual file's local id * Virtual file's local id
* @return array * @return array
*/ */
public function bsAnalyzeFile($id) public static function bsAnalyzeFile($id)
{ {
$storedFile = StoredFile::Recall($id); $storedFile = StoredFile::Recall($id);
if (is_null($storedFile) || PEAR::isError($storedFile)) { if (is_null($storedFile) || PEAR::isError($storedFile)) {
@ -1569,7 +1569,7 @@ class BasicStor {
* select file by gunid (id is then ignored) * select file by gunid (id is then ignored)
* @return boolean * @return boolean
*/ */
public function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE) public static function bsExistsFile($id, $ftype=NULL, $byGunid=FALSE)
{ {
if ($byGunid) { if ($byGunid) {
$storedFile = StoredFile::RecallByGunid($id); $storedFile = StoredFile::RecallByGunid($id);
@ -1664,22 +1664,6 @@ class BasicStor {
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
//$pfid = BasicStor::bsCreateFolder($fid, 'public');
//if (PEAR::isError($pfid)) {
// return $pfid;
//}
//$res = Alib::AddPerm($uid, '_all', $pfid, 'A');
//if (PEAR::isError($res)) {
// return $res;
//}
//$allGrId = Subjects::GetSubjId($CC_CONFIG['AllGr']);
//if (PEAR::isError($allGrId)) {
// return $allGrId;
//}
//$res = Alib::AddPerm($allGrId, 'read', $pfid, 'A');
//if (PEAR::isError($res)) {
// return $res;
//}
} }
} }
return $uid; return $uid;
@ -1735,11 +1719,11 @@ class BasicStor {
* @param string $pass * @param string $pass
* @return boolean|sessionId|PEAR_Error * @return boolean|sessionId|PEAR_Error
*/ */
function login($login, $pass) // public static function login($login, $pass)
{ // {
$r = Alib::Login($login, $pass); // $r = Alib::Login($login, $pass);
return $r; // return $r;
} // }
/* ================================================== "protected" methods */ /* ================================================== "protected" methods */
@ -1909,26 +1893,6 @@ class BasicStor {
} }
/**
* Returns TRUE if gunid is free
* @return boolean|PEAR_Error
*/
// function _gunidIsFree($gunid)
// {
// $cnt = $CC_DBC->getOne("
// SELECT count(*) FROM {$this->filesTable}
// WHERE gunid=x'{$this->gunid}'::bigint
// ");
// if (PEAR::isError($cnt)) {
// return $cnt;
// }
// if ($cnt > 0) {
// return FALSE;
// }
// return TRUE;
// }
/** /**
* Set playlist edit flag * Set playlist edit flag
* *
@ -1943,7 +1907,7 @@ class BasicStor {
* @return boolean * @return boolean
* previous state * previous state
*/ */
public function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL) public static function setEditFlag($p_playlistId, $p_val=TRUE, $p_sessid=NULL, $p_subjid=NULL)
{ {
if (!is_null($p_sessid)) { if (!is_null($p_sessid)) {
$p_subjid = Alib::GetSessUserId($p_sessid); $p_subjid = Alib::GetSessUserId($p_sessid);
@ -1976,7 +1940,7 @@ class BasicStor {
* @return FALSE|int * @return FALSE|int
* ID of user editing it * ID of user editing it
*/ */
public function isEdited($p_playlistId) public static function isEdited($p_playlistId)
{ {
$storedFile = StoredFile::RecallByGunid($p_playlistId); $storedFile = StoredFile::RecallByGunid($p_playlistId);
if (is_null($storedFile) || PEAR::isError($storedFile)) { if (is_null($storedFile) || PEAR::isError($storedFile)) {
@ -2232,7 +2196,7 @@ class BasicStor {
"gunid" => $gunid, "gunid" => $gunid,
"filetype" => $type "filetype" => $type
); );
$r = $this->bsPutFile($rootHD, $values); $r = BasicStor::bsPutFile($rootHD, $values);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
} }
@ -2240,26 +2204,13 @@ class BasicStor {
//$res['results'][] = array('gunid' => $gunid, 'type' => $type); //$res['results'][] = array('gunid' => $gunid, 'type' => $type);
//$res['cnt']++; //$res['cnt']++;
} }
return $this->bsLocalSearch( return BasicStor::bsLocalSearch(
array('filetype'=>'all', 'conditions'=>array()) array('filetype'=>'all', 'conditions'=>array())
); );
//return $res; //return $res;
} }
/**
* dump
*
*/
// public function dump($id='', $indch=' ', $ind='', $format='{name}')
// {
// if ($id=='') {
// $id = $this->storId;
// }
// return parent::dump($id, $indch, $ind, $format);
// }
/** /**
* *
* *
@ -2275,17 +2226,6 @@ class BasicStor {
} }
/**
*
*
*/
public function debug($va)
{
echo"<pre>\n";
print_r($va);
}
/** /**
* deleteFiles * deleteFiles
* *

View file

@ -54,15 +54,18 @@ require_once("XML/Util.php");
* @see StoredFile * @see StoredFile
*/ */
class DataEngine { class DataEngine {
/**
* Array of allowed "file types".
*
* @var array
*/
var $filetypes;
/** /**
* Constructor * Constructor
*
* @param BasicStor $gb
*/ */
public function __construct(&$gb) public function __construct()
{ {
$this->gb =& $gb;
$this->filetypes = array( $this->filetypes = array(
'all'=>NULL, 'all'=>NULL,
'audioclip'=>'audioclip', 'audioclip'=>'audioclip',

View file

@ -34,7 +34,7 @@ class GreenBox extends BasicStor {
* ID of new folder * ID of new folder
* @exception PEAR::error * @exception PEAR::error
*/ */
public function createFolder($parid, $folderName, $sessid='') public static function createFolder($parid, $folderName, $sessid='')
{ {
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
return $res; return $res;
@ -62,12 +62,12 @@ class GreenBox extends BasicStor {
* @return int * @return int
* ID of the StoredFile that was created. * ID of the StoredFile that was created.
*/ */
public function putFile($p_parentId, $p_values, $p_sessionId='') public static function putFile($p_parentId, $p_values, $p_sessionId='')
{ {
if (($res = BasicStor::Authorize('write', $p_parentId, $p_sessionId)) !== TRUE) { if (($res = BasicStor::Authorize('write', $p_parentId, $p_sessionId)) !== TRUE) {
return $res; return $res;
} }
$storedFile = $this->bsPutFile($p_parentId, $p_values); $storedFile = BasicStor::bsPutFile($p_parentId, $p_values);
return $storedFile; return $storedFile;
} // fn putFile } // fn putFile
@ -90,7 +90,7 @@ class GreenBox extends BasicStor {
* @return int * @return int
* @exception PEAR::error * @exception PEAR::error
*/ */
public function storeWebstream($parid, $fileName, $mdataFileLP, $sessid='', public static function storeWebstream($parid, $fileName, $mdataFileLP, $sessid='',
$gunid=NULL, $url) $gunid=NULL, $url)
{ {
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
@ -105,12 +105,12 @@ class GreenBox extends BasicStor {
"gunid" => $gunid, "gunid" => $gunid,
"filetype" => "webstream" "filetype" => "webstream"
); );
$storedFile = $this->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
return $storedFile; return $storedFile;
} }
$oid = $storedFile->getId(); $oid = $storedFile->getId();
$r = $this->bsSetMetadataValue( $r = BasicStor::bsSetMetadataValue(
$oid, 'ls:url', $url, NULL, NULL, 'metadata'); $oid, 'ls:url', $url, NULL, NULL, 'metadata');
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
@ -119,49 +119,6 @@ class GreenBox extends BasicStor {
} // fn storeWebstream } // fn storeWebstream
/**
* Access stored file - increase access counter
*
* @param int $id
* virt.file's local id
* @param string $sessid
* session id
* @return string access token
*/
// function accessFile($id, $sessid='')
// {
// if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
// return $res;
// }
// $gunid = BasicStor::GunidFromId($id);
// $r = BasicStor::bsAccess(NULL, '', $gunid, 'access');
// if (PEAR::isError($r)) {
// return $r;
// }
// $token = $r['token'];
// return $token;
// } // fn accessFile
/**
* Release stored file - decrease access counter
*
* @param string $token
* access token
* @param string $sessid
* session id
* @return boolean
*/
// function releaseFile($token, $sessid='')
// {
// $r = BasicStor::bsRelease($token, 'access');
// if (PEAR::isError($r)) {
// return $r;
// }
// return FALSE;
// } // fn releaseFile
/** /**
* Analyze media file for internal metadata information * Analyze media file for internal metadata information
* *
@ -171,12 +128,12 @@ class GreenBox extends BasicStor {
* Session id * Session id
* @return array * @return array
*/ */
public function analyzeFile($id, $sessid='') public static function analyzeFile($id, $sessid='')
{ {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsAnalyzeFile($id); return BasicStor::bsAnalyzeFile($id);
} // fn analyzeFile } // fn analyzeFile
@ -190,13 +147,13 @@ class GreenBox extends BasicStor {
* Session id * Session id
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
public function renameFile($id, $newName, $sessid='') public static function renameFile($id, $newName, $sessid='')
{ {
$parid = M2tree::GetParent($id); $parid = M2tree::GetParent($id);
if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('write', $parid, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsRenameFile($id, $newName); return BasicStor::bsRenameFile($id, $newName);
} // fn renameFile } // fn renameFile
@ -211,13 +168,13 @@ class GreenBox extends BasicStor {
* session id * session id
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
public function moveFile($id, $did, $sessid='') public static function moveFile($id, $did, $sessid='')
{ {
$res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid); $res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid);
if ($res !== TRUE) { if ($res !== TRUE) {
return $res; return $res;
} }
return $this->bsMoveFile($id, $did); return BasicStor::bsMoveFile($id, $did);
} // fn moveFile } // fn moveFile
@ -232,13 +189,13 @@ class GreenBox extends BasicStor {
* session id * session id
* @return boolean|PEAR_Error * @return boolean|PEAR_Error
*/ */
public function copyFile($id, $did, $sessid='') public static function copyFile($id, $did, $sessid='')
{ {
$res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid); $res = BasicStor::Authorize(array('read', 'write'), array($id, $did), $sessid);
if($res !== TRUE) { if ($res !== TRUE) {
return $res; return $res;
} }
return $this->bsCopyFile($id, $did); return BasicStor::bsCopyFile($id, $did);
} // fn copyFile } // fn copyFile
@ -255,12 +212,12 @@ class GreenBox extends BasicStor {
* session id * session id
* @return TRUE|PEAR_Error * @return TRUE|PEAR_Error
*/ */
public function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='') public static function replaceFile($id, $mediaFileLP, $mdataFileLP, $sessid='')
{ {
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsReplaceFile($id, $mediaFileLP, $mdataFileLP); return BasicStor::bsReplaceFile($id, $mediaFileLP, $mdataFileLP);
} // fn replaceFile } // fn replaceFile
@ -286,28 +243,6 @@ class GreenBox extends BasicStor {
/* ------------------------------------------------------------- metadata */ /* ------------------------------------------------------------- metadata */
/**
* Replace metadata with new XML file or string
*
* @param int $id
* Virtual file's local id
* @param string $mdata
* XML string or local path of metadata XML file
* @param string $mdataLoc
* metadata location: 'file'|'string'
* @param string $sessid
* session id
* @return boolean|PEAR_Error
*/
// public function replaceMetadata($id, $mdata, $mdataLoc='file', $sessid='')
// {
// if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
// return $res;
// }
// return $this->bsReplaceMetadata($id, $mdata, $mdataLoc);
// } // fn replaceMetadata
/** /**
* Get metadata XML tree as string * Get metadata XML tree as string
* *
@ -318,12 +253,12 @@ class GreenBox extends BasicStor {
* @return string|PEAR_Error * @return string|PEAR_Error
* @todo rename this function to "getMetadata" * @todo rename this function to "getMetadata"
*/ */
public function getMetadata($id, $sessid='') public static function getMetadata($id, $sessid='')
{ {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsGetMetadata($id); return BasicStor::bsGetMetadata($id);
} }
@ -340,7 +275,7 @@ class GreenBox extends BasicStor {
* session ID * session ID
* @return array * @return array
*/ */
public function getMetadataArray($id, $sessid) public static function getMetadataArray($id, $sessid)
{ {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
@ -397,7 +332,7 @@ class GreenBox extends BasicStor {
* qualified name (e.g. xml:lang)</li> * qualified name (e.g. xml:lang)</li>
* </ul> * </ul>
*/ */
public function getMetadataValue($id, $category, $sessid='', public static function getMetadataValue($id, $category, $sessid='',
$lang=NULL, $deflang=NULL) $lang=NULL, $deflang=NULL)
{ {
if (!is_numeric($id)) { if (!is_numeric($id)) {
@ -406,7 +341,7 @@ class GreenBox extends BasicStor {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsGetMetadataValue($id, $category); return BasicStor::bsGetMetadataValue($id, $category);
} // fn getMetadataValue } // fn getMetadataValue
@ -427,12 +362,12 @@ class GreenBox extends BasicStor {
* (optional on unique elements) Metadata record id * (optional on unique elements) Metadata record id
* @return boolean * @return boolean
*/ */
public function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL) public static function setMetadataValue($id, $category, $sessid, $value, $lang=NULL, $mid=NULL)
{ {
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsSetMetadataValue($id, $category, $value, $lang, $mid); return BasicStor::bsSetMetadataValue($id, $category, $value, $lang, $mid);
} // fn setMetadataValue } // fn setMetadataValue
@ -489,11 +424,11 @@ class GreenBox extends BasicStor {
* </ul> * </ul>
* @see BasicStor::bsLocalSearch * @see BasicStor::bsLocalSearch
*/ */
public function localSearch($criteria, $sessid='') public static function localSearch($criteria, $sessid='')
{ {
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
return $this->bsLocalSearch($criteria, $limit, $offset); return BasicStor::bsLocalSearch($criteria, $limit, $offset);
} // fn localSearch } // fn localSearch
@ -511,7 +446,7 @@ class GreenBox extends BasicStor {
* cnt : integer - number of matching values * cnt : integer - number of matching values
* @see BasicStor::bsBrowseCategory * @see BasicStor::bsBrowseCategory
*/ */
public function browseCategory($category, $criteria = null, $sessid = '') public static function browseCategory($category, $criteria = null, $sessid = '')
{ {
$limit = 0; $limit = 0;
$offset = 0; $offset = 0;
@ -519,7 +454,7 @@ class GreenBox extends BasicStor {
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
} }
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria); $res = BasicStor::bsBrowseCategory($category, $limit, $offset, $criteria);
return $res; return $res;
} // fn browseCategory } // fn browseCategory
@ -558,7 +493,7 @@ class GreenBox extends BasicStor {
} }
// optionally move it to the destination folder: // optionally move it to the destination folder:
if($parid != $hdid && !is_null($parid)){ if($parid != $hdid && !is_null($parid)){
$r = $this->bsMoveFile($id, $parid); $r = BasicStor::bsMoveFile($id, $parid);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
} }
@ -567,22 +502,6 @@ class GreenBox extends BasicStor {
} // fn createPlaylist } // fn createPlaylist
/**
* Return playlist as XML string
*
* @param int $id
* local object id
* @param string $sessid
* session ID
* @return string
* XML
*/
// function getPlaylistXml($id, $sessid)
// {
// return $this->getMetadata($id, $sessid);
// } // fn getPlaylistXml
/** /**
* Return playlist as hierarchical PHP hash-array * Return playlist as hierarchical PHP hash-array
* *
@ -592,7 +511,7 @@ class GreenBox extends BasicStor {
* session ID * session ID
* @return array * @return array
*/ */
public function getPlaylistArray($id, $sessid) public static function getPlaylistArray($id, $sessid)
{ {
$gunid = BasicStor::GunidFromId($id); $gunid = BasicStor::GunidFromId($id);
$pl = StoredFile::Recall($id); $pl = StoredFile::Recall($id);
@ -614,7 +533,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* playlist access token * playlist access token
*/ */
public function lockPlaylistForEdit($id, $sessid) public static function lockPlaylistForEdit($id, $sessid)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$gunid = BasicStor::GunidFromId($id); $gunid = BasicStor::GunidFromId($id);
@ -638,7 +557,7 @@ class GreenBox extends BasicStor {
*/ */
public function releaseLockedPlaylist($token, $sessid) public function releaseLockedPlaylist($token, $sessid)
{ {
$gunid = $this->bsCloseDownload($token, 'metadata'); $gunid = BasicStor::bsCloseDownload($token, 'metadata');
if (PEAR::isError($gunid)) { if (PEAR::isError($gunid)) {
return $gunid; return $gunid;
} }
@ -675,7 +594,7 @@ class GreenBox extends BasicStor {
* pause between half-faded points in time format hh:mm:ss.ssssss * pause between half-faded points in time format hh:mm:ss.ssssss
* @return string, generated playlistElement gunid * @return string, generated playlistElement gunid
*/ */
public function addAudioClipToPlaylist($token, $acId, $sessid, public static function addAudioClipToPlaylist($token, $acId, $sessid,
$fadeIn=NULL, $fadeOut=NULL, $length=NULL, $pause=NULL) $fadeIn=NULL, $fadeOut=NULL, $length=NULL, $pause=NULL)
{ {
require_once("Playlist.php"); require_once("Playlist.php");
@ -690,13 +609,11 @@ class GreenBox extends BasicStor {
" ($type)" " ($type)"
); );
} }
// $res = $pl->addAudioClip($acId, $fadeIn, $fadeOut, NULL, $pause);
$res = $pl->addAudioClip($acId, $fadeIn, $fadeOut, NULL, $length); $res = $pl->addAudioClip($acId, $fadeIn, $fadeOut, NULL, $length);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
// recalculate offsets and total length: // recalculate offsets and total length:
// $r = $pl->recalculateTimes($pause);
$r = $pl->recalculateTimes(); $r = $pl->recalculateTimes();
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
@ -717,7 +634,7 @@ class GreenBox extends BasicStor {
* @return boolean * @return boolean
* @todo rename this function to "deleteAudioClipFromPlaylist" * @todo rename this function to "deleteAudioClipFromPlaylist"
*/ */
public function delAudioClipFromPlaylist($token, $plElGunid, $sessid) public static function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
{ {
require_once("Playlist.php"); require_once("Playlist.php");
$pl = StoredFile::RecallByToken($token); $pl = StoredFile::RecallByToken($token);
@ -752,7 +669,7 @@ class GreenBox extends BasicStor {
* session ID * session ID
* @return boolean * @return boolean
*/ */
public function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid) public static function changeFadeInfo($token, $plElGunid, $fadeIn, $fadeOut, $sessid)
{ {
require_once("Playlist.php"); require_once("Playlist.php");
$pl = StoredFile::RecallByToken($token); $pl = StoredFile::RecallByToken($token);
@ -788,7 +705,7 @@ class GreenBox extends BasicStor {
* session ID * session ID
* @return boolean * @return boolean
*/ */
public function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid) public static function moveAudioClipInPlaylist($token, $plElGunid, $newPos, $sessid)
{ {
require_once("Playlist.php"); require_once("Playlist.php");
$pl = StoredFile::RecallByToken($token); $pl = StoredFile::RecallByToken($token);
@ -818,7 +735,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* gunid of playlist * gunid of playlist
*/ */
public function revertEditedPlaylist($token, $sessid='') public static function revertEditedPlaylist($token, $sessid='')
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$lc = new LocStor($CC_DBC, $CC_CONFIG); $lc = new LocStor($CC_DBC, $CC_CONFIG);
@ -835,7 +752,7 @@ class GreenBox extends BasicStor {
* session ID * session ID
* @return boolean * @return boolean
*/ */
public function deletePlaylist($id, $sessid) public static function deletePlaylist($id, $sessid)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$gunid = BasicStor::GunidFromId($id); $gunid = BasicStor::GunidFromId($id);
@ -867,7 +784,7 @@ class GreenBox extends BasicStor {
* <li>duration string, total playlength of clip </li> * <li>duration string, total playlength of clip </li>
* </ul> * </ul>
*/ */
public function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0, public static function displayPlaylistClipAtOffset($sessid, $plid, $offset, $distance=0,
$lang=NULL, $deflang=NULL) $lang=NULL, $deflang=NULL)
{ {
require_once("Playlist.php"); require_once("Playlist.php");
@ -885,7 +802,7 @@ class GreenBox extends BasicStor {
return $id; return $id;
} }
if (!is_null($id)) { if (!is_null($id)) {
$res['title'] = $this->bsGetMetadataValue($id, "dc:title"); $res['title'] = BasicStor::bsGetMetadataValue($id, "dc:title");
} }
return $res; return $res;
} // fn displayPlaylistClipAtOffset } // fn displayPlaylistClipAtOffset
@ -909,9 +826,9 @@ class GreenBox extends BasicStor {
* fname string: readable fname, * fname string: readable fname,
* token string: access token * token string: access token
*/ */
public function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE) public static function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
{ {
return $this->bsExportPlaylistOpen($plids, $type, !$standalone); return BasicStor::bsExportPlaylistOpen($plids, $type, !$standalone);
} // fn exportPlaylistOpen } // fn exportPlaylistOpen
@ -923,14 +840,14 @@ class GreenBox extends BasicStor {
* method call * method call
* @return TRUE|PEAR_Error * @return TRUE|PEAR_Error
*/ */
public function exportPlaylistClose($token) public static function exportPlaylistClose($token)
{ {
return $this->bsExportPlaylistClose($token); return BasicStor::bsExportPlaylistClose($token);
} // fn exportPlaylistClose } // fn exportPlaylistClose
/** /**
* Open writable handle for import playlist in LS Archive format * Open writable handle for import playlist in CC Archive format
* *
* @param string $sessid * @param string $sessid
* session id * session id
@ -940,13 +857,13 @@ class GreenBox extends BasicStor {
* fname string: writable local filename * fname string: writable local filename
* token string: put token * token string: put token
*/ */
public function importPlaylistOpen($sessid, $chsum='') public static function importPlaylistOpen($sessid, $chsum='')
{ {
$userid = GreenBox::GetSessUserId($sessid); $userid = GreenBox::GetSessUserId($sessid);
if (PEAR::isError($userid)) { if (PEAR::isError($userid)) {
return $userid; return $userid;
} }
$r = $this->bsOpenPut($chsum, NULL, $userid); $r = BasicStor::bsOpenPut($chsum, NULL, $userid);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
} }
@ -964,7 +881,7 @@ class GreenBox extends BasicStor {
*/ */
public function importPlaylistClose($token) public function importPlaylistClose($token)
{ {
$arr = $this->bsClosePut($token); $arr = BasicStor::bsClosePut($token);
if (PEAR::isError($arr)) { if (PEAR::isError($arr)) {
return $arr; return $arr;
} }
@ -994,7 +911,7 @@ class GreenBox extends BasicStor {
* session ID * session ID
* @return boolean * @return boolean
*/ */
public function existsPlaylist($id, $sessid) public static function existsPlaylist($id, $sessid)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$gunid = BasicStor::GunidFromId($id); $gunid = BasicStor::GunidFromId($id);
@ -1015,7 +932,7 @@ class GreenBox extends BasicStor {
* @return TRUE|int * @return TRUE|int
* id of user editing it * id of user editing it
*/ */
public function playlistIsAvailable($id, $sessid) public static function playlistIsAvailable($id, $sessid)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$gunid = BasicStor::GunidFromId($id); $gunid = BasicStor::GunidFromId($id);
@ -1024,37 +941,6 @@ class GreenBox extends BasicStor {
} // fn playlistIsAvailable } // fn playlistIsAvailable
/* ---------------------------------------------- time conversion methods */
/**
* Convert playlist time value to float seconds
*
* @param string $plt
* playlist time value (HH:mm:ss.dddddd)
* @return int
* seconds
*/
// public function playlistTimeToSeconds($plt)
// {
// require_once("Playlist.php");
// return Playlist::playlistTimeToSeconds($plt);
// }
/**
* Convert float seconds value to playlist time format
*
* @param int $s0
* seconds
* @return string
* time in playlist time format (HH:mm:ss.dddddd)
*/
// public static function secondsToPlaylistTime($s0)
// {
// require_once("Playlist.php");
// return Playlist::secondsToPlaylistTime($s0);
// } // fn secondsToPlaylistTime
/* ------------------------------------------------------- render methods */ /* ------------------------------------------------------- render methods */
/** /**
* Render playlist to ogg file (open handle) * Render playlist to ogg file (open handle)
@ -1066,7 +952,7 @@ class GreenBox extends BasicStor {
* @return string $token * @return string $token
* render token * render token
*/ */
public function renderPlaylistToFileOpen($sessid, $plid) public static function renderPlaylistToFileOpen($sessid, $plid)
{ {
require_once("Renderer.php"); require_once("Renderer.php");
$r = Renderer::rnRender2FileOpen($this, $plid); $r = Renderer::rnRender2FileOpen($this, $plid);
@ -1086,7 +972,7 @@ class GreenBox extends BasicStor {
* status : string - susccess | working | fault * status : string - susccess | working | fault
* tmpfile : string - filepath to result temporary file * tmpfile : string - filepath to result temporary file
*/ */
public function renderPlaylistToFileCheck($token) public static function renderPlaylistToFileCheck($token)
{ {
require_once("Renderer.php"); require_once("Renderer.php");
$r = Renderer::rnRender2FileCheck($this, $token); $r = Renderer::rnRender2FileCheck($this, $token);
@ -1107,7 +993,7 @@ class GreenBox extends BasicStor {
* status : string - susccess | working | fault * status : string - susccess | working | fault
* tmpfile : string - filepath to result temporary file * tmpfile : string - filepath to result temporary file
*/ */
public function renderPlaylistToFileList($status='') public static function renderPlaylistToFileList($status='')
{ {
require_once("Renderer.php"); require_once("Renderer.php");
return Renderer::rnRender2FileList($this, $status); return Renderer::rnRender2FileList($this, $status);
@ -1122,7 +1008,7 @@ class GreenBox extends BasicStor {
* @return boolean * @return boolean
* status * status
*/ */
public function renderPlaylistToFileClose($token) public static function renderPlaylistToFileClose($token)
{ {
require_once("Renderer.php"); require_once("Renderer.php");
$r = Renderer::rnRender2FileClose($this, $token); $r = Renderer::rnRender2FileClose($this, $token);
@ -1143,7 +1029,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* render token * render token
*/ */
public function renderPlaylistToStorageOpen($sessid, $plid) public static function renderPlaylistToStorageOpen($sessid, $plid)
{ {
require_once("Renderer.php"); require_once("Renderer.php");
$owner = GreenBox::getSessUserId($sessid); $owner = GreenBox::getSessUserId($sessid);
@ -1167,7 +1053,7 @@ class GreenBox extends BasicStor {
* status : string - susccess | working | fault * status : string - susccess | working | fault
* gunid : string - gunid of result file * gunid : string - gunid of result file
*/ */
public function renderPlaylistToStorageCheck($token) public static function renderPlaylistToStorageCheck($token)
{ {
require_once("Renderer.php"); require_once("Renderer.php");
$r = Renderer::rnRender2StorageCheck($this, $token); $r = Renderer::rnRender2StorageCheck($this, $token);
@ -1188,7 +1074,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* render token * render token
*/ */
public function renderPlaylistToRSSOpen($sessid, $plid) public static function renderPlaylistToRSSOpen($sessid, $plid)
{ {
$token = '123456789abcdeff'; $token = '123456789abcdeff';
$fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; $fakeFile = $CC_CONFIG['accessDir']."/$token.rss";
@ -1206,7 +1092,7 @@ class GreenBox extends BasicStor {
* status : string - susccess | working | fault * status : string - susccess | working | fault
* tmpfile : string - filepath to result temporary file * tmpfile : string - filepath to result temporary file
*/ */
public function renderPlaylistToRSSCheck($token) public static function renderPlaylistToRSSCheck($token)
{ {
$fakeFile = $CC_CONFIG['accessDir']."/$token.rss"; $fakeFile = $CC_CONFIG['accessDir']."/$token.rss";
if ($token != '123456789abcdeff' || !file_exists($fakeFile)){ if ($token != '123456789abcdeff' || !file_exists($fakeFile)){
@ -1221,25 +1107,6 @@ class GreenBox extends BasicStor {
} // fn renderPlaylistToRSSCheck } // fn renderPlaylistToRSSCheck
/**
* Render playlist to RSS file (list results)
*
* @param string $status
* success | working | fault
* @return array of hasharray:
* status : string - susccess | working | fault
* tmpfile : string - filepath to result temporary file
*/
// function renderPlaylistToRSSList($status='')
// {
// $dummytokens = array ('123456789abcdeff');
// foreach ($dummytokens as $token) {
// $r[] = $this->renderPlaylistToRSSCheck($token);
// }
// return $r;
// } // fn renderPlaylistToRSSList
/** /**
* Render playlist to RSS file (close handle) * Render playlist to RSS file (close handle)
* *
@ -1248,7 +1115,7 @@ class GreenBox extends BasicStor {
* @return boolean * @return boolean
* status * status
*/ */
public function renderPlaylistToRSSClose($token) public static function renderPlaylistToRSSClose($token)
{ {
if ($token != '123456789abcdeff'){ if ($token != '123456789abcdeff'){
return PEAR::raiseError( return PEAR::raiseError(
@ -1273,7 +1140,7 @@ class GreenBox extends BasicStor {
* @return array * @return array
* token : string - backup token * token : string - backup token
*/ */
public function createBackupOpen($sessid, $criteria='') public static function createBackupOpen($sessid, $criteria='')
{ {
require_once("Backup.php"); require_once("Backup.php");
$bu = new Backup($this); $bu = new Backup($this);
@ -1295,7 +1162,7 @@ class GreenBox extends BasicStor {
* token : stirng - backup token * token : stirng - backup token
* url : string - access url * url : string - access url
*/ */
public function createBackupCheck($token) public static function createBackupCheck($token)
{ {
require_once("Backup.php"); require_once("Backup.php");
$bu = new Backup($this); $bu = new Backup($this);
@ -1318,7 +1185,7 @@ class GreenBox extends BasicStor {
* token : stirng - backup token * token : stirng - backup token
* url : string - access url * url : string - access url
*/ */
public function createBackupList($sessid, $stat='') public static function createBackupList($sessid, $stat='')
{ {
require_once("Backup.php"); require_once("Backup.php");
$bu = new Backup($this); $bu = new Backup($this);
@ -1337,7 +1204,7 @@ class GreenBox extends BasicStor {
* @return boolean * @return boolean
* status * status
*/ */
public function createBackupClose($token) public static function createBackupClose($token)
{ {
require_once("Backup.php"); require_once("Backup.php");
$bu = new Backup($this); $bu = new Backup($this);
@ -1359,7 +1226,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* restore token * restore token
*/ */
public function backupRestoreOpen($sessid, $filename) public static function backupRestoreOpen($sessid, $filename)
{ {
require_once('Restore.php'); require_once('Restore.php');
$rs = new Restore($this); $rs = new Restore($this);
@ -1381,7 +1248,7 @@ class GreenBox extends BasicStor {
* status: string - working | fault | success * status: string - working | fault | success
* faultString: string - description of fault * faultString: string - description of fault
*/ */
public function backupRestoreCheck($token) public static function backupRestoreCheck($token)
{ {
require_once('Restore.php'); require_once('Restore.php');
$rs = new Restore($this); $rs = new Restore($this);
@ -1400,7 +1267,7 @@ class GreenBox extends BasicStor {
* @return boolean * @return boolean
* is success * is success
*/ */
public function backupRestoreClose($token) { public static function backupRestoreClose($token) {
require_once('Restore.php'); require_once('Restore.php');
$rs = new Restore($this); $rs = new Restore($this);
if (PEAR::isError($rs)) { if (PEAR::isError($rs)) {
@ -1421,9 +1288,9 @@ class GreenBox extends BasicStor {
* @return string * @return string
* preference value * preference value
*/ */
public function loadPref($sessid, $key) public static function loadPref($sessid, $key)
{ {
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->loadPref($sessid, $key); $res = $pr->loadPref($sessid, $key);
return $res; return $res;
} // fn loadPref } // fn loadPref
@ -1440,9 +1307,9 @@ class GreenBox extends BasicStor {
* preference value * preference value
* @return boolean * @return boolean
*/ */
public function savePref($sessid, $key, $value) public static function savePref($sessid, $key, $value)
{ {
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->savePref($sessid, $key, $value); $res = $pr->savePref($sessid, $key, $value);
return $res; return $res;
} // fn savePref } // fn savePref
@ -1457,9 +1324,9 @@ class GreenBox extends BasicStor {
* preference key * preference key
* @return boolean * @return boolean
*/ */
public function delPref($sessid, $key) public static function delPref($sessid, $key)
{ {
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->delPref($sessid, $key); $res = $pr->delPref($sessid, $key);
return $res; return $res;
} // fn delPref } // fn delPref
@ -1477,9 +1344,9 @@ class GreenBox extends BasicStor {
* @return string * @return string
* preference value * preference value
*/ */
public function loadGroupPref($sessid, $group, $key) public static function loadGroupPref($sessid, $group, $key)
{ {
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->loadGroupPref($sessid, $group, $key); $res = $pr->loadGroupPref($sessid, $group, $key);
return $res; return $res;
} // fn loadGroupPref } // fn loadGroupPref
@ -1498,9 +1365,9 @@ class GreenBox extends BasicStor {
* preference value * preference value
* @return boolean * @return boolean
*/ */
public function saveGroupPref($sessid, $group, $key, $value) public static function saveGroupPref($sessid, $group, $key, $value)
{ {
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->saveGroupPref($sessid, $group, $key, $value); $res = $pr->saveGroupPref($sessid, $group, $key, $value);
return $res; return $res;
} // fn saveGroupPref } // fn saveGroupPref
@ -1517,9 +1384,9 @@ class GreenBox extends BasicStor {
* preference key * preference key
* @return boolean * @return boolean
*/ */
public function delGroupPref($sessid, $group, $key) public static function delGroupPref($sessid, $group, $key)
{ {
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->delGroupPref($sessid, $group, $key); $res = $pr->delGroupPref($sessid, $group, $key);
return $res; return $res;
} // fn delGroupPref } // fn delGroupPref
@ -1560,7 +1427,7 @@ class GreenBox extends BasicStor {
* @return boolean * @return boolean
* previous state * previous state
*/ */
public function turnOnOffTransports($sessid, $onOff=NULL) public static function turnOnOffTransports($sessid, $onOff=NULL)
{ {
require_once("Transport.php"); require_once("Transport.php");
$tr = new Transport($this); $tr = new Transport($this);
@ -1578,7 +1445,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* resulting transport state * resulting transport state
*/ */
public function doTransportAction($trtok, $action) public static function doTransportAction($trtok, $action)
{ {
require_once("Transport.php"); require_once("Transport.php");
$tr = new Transport($this); $tr = new Transport($this);
@ -1597,12 +1464,12 @@ class GreenBox extends BasicStor {
* @return string * @return string
* transport token * transport token
*/ */
public function uploadFile2Hub($filePath) public static function uploadFileAsync($filePath)
{ {
require_once("Transport.php"); require_once("Transport.php");
$tr = new Transport($this); $tr = new Transport($this);
return $tr->uploadFile2Hub($filePath); return $tr->uploadFileAsync($filePath);
} // fn uploadFile2Hub } // fn uploadFileAsync
/** /**
@ -1612,7 +1479,7 @@ class GreenBox extends BasicStor {
* trtok: string transport token * trtok: string transport token
* ... ? * ... ?
*/ */
public function getHubInitiatedTransfers() public static function getHubInitiatedTransfers()
{ {
require_once("Transport.php"); require_once("Transport.php");
$tr = new Transport($this); $tr = new Transport($this);
@ -1629,7 +1496,7 @@ class GreenBox extends BasicStor {
* @return string * @return string
* transport token * transport token
*/ */
public function startHubInitiatedTransfer($trtok) public static function startHubInitiatedTransfer($trtok)
{ {
require_once("Transport.php"); require_once("Transport.php");
$tr = new Transport($this); $tr = new Transport($this);
@ -1651,12 +1518,12 @@ class GreenBox extends BasicStor {
* transport token * transport token
* @todo rename this function "uploadToHub" * @todo rename this function "uploadToHub"
*/ */
public function upload2Hub($gunid, $withContent=FALSE) public static function uploadToHub($gunid, $withContent=FALSE)
{ {
require_once("Transport.php"); require_once("Transport.php");
$tr = new Transport($this); $tr = new Transport($this);
return $tr->upload2Hub($gunid, $withContent); return $tr->uploadToHub($gunid, $withContent);
} // fn upload2Hub } // fn uploadToHub
/** /**
@ -1733,7 +1600,7 @@ class GreenBox extends BasicStor {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
$listArr = $this->bsListFolder($id); $listArr = BasicStor::bsListFolder($id);
return $listArr; return $listArr;
} // fn listFolder } // fn listFolder
@ -1766,7 +1633,7 @@ class GreenBox extends BasicStor {
public function existsFile($sessid, $gunid, $ftype=NULL) public function existsFile($sessid, $gunid, $ftype=NULL)
{ {
$id = BasicStor::IdFromGunid($gunid); $id = BasicStor::IdFromGunid($gunid);
$ex = $this->bsExistsFile($id, $ftype); $ex = BasicStor::bsExistsFile($id, $ftype);
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }

View file

@ -1,5 +1,6 @@
<?php <?php
require_once("BasicStor.php"); require_once("BasicStor.php");
require_once("Transport.php");
/** /**
* LocStor class * LocStor class
@ -114,11 +115,11 @@ class LocStor extends BasicStor {
if ($fname == '') { if ($fname == '') {
$fname = "newFile"; $fname = "newFile";
} }
$res = $this->bsRenameFile($oid, $fname); $res = BasicStor::bsRenameFile($oid, $fname);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
return $this->bsOpenPut($chsum, $storedFile->gunid); return BasicStor::bsOpenPut($chsum, $storedFile->gunid);
} }
@ -135,7 +136,7 @@ class LocStor extends BasicStor {
if (is_null($storedFile) || PEAR::isError($storedFile)) { if (is_null($storedFile) || PEAR::isError($storedFile)) {
return $storedFile; return $storedFile;
} }
$arr = $this->bsClosePut($token); $arr = BasicStor::bsClosePut($token);
if (PEAR::isError($arr)) { if (PEAR::isError($arr)) {
$storedFile->delete(); $storedFile->delete();
return $arr; return $arr;
@ -166,7 +167,7 @@ class LocStor extends BasicStor {
*/ */
protected function uploadCheck($token) protected function uploadCheck($token)
{ {
return $this->bsCheckPut($token); return BasicStor::bsCheckPut($token);
} }
@ -202,7 +203,7 @@ class LocStor extends BasicStor {
return $storedFile; return $storedFile;
} }
$oid = $storedFile->getId(); $oid = $storedFile->getId();
$r = $this-> bsSetMetadataValue( $r = BasicStor::bsSetMetadataValue(
$oid, 'ls:url', $url, NULL, NULL, 'metadata'); $oid, 'ls:url', $url, NULL, NULL, 'metadata');
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
@ -281,7 +282,7 @@ class LocStor extends BasicStor {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
return $this->bsOpenDownload($id); return BasicStor::bsOpenDownload($id);
} }
@ -295,7 +296,7 @@ class LocStor extends BasicStor {
*/ */
protected function downloadRawAudioDataClose($token) protected function downloadRawAudioDataClose($token)
{ {
return $this->bsCloseDownload($token); return BasicStor::bsCloseDownload($token);
} }
@ -323,8 +324,8 @@ class LocStor extends BasicStor {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
$res = $this->bsOpenDownload($id, 'metadata'); $res = BasicStor::bsOpenDownload($id, 'metadata');
#unset($res['filename']); //unset($res['filename']);
return $res; return $res;
} }
@ -339,7 +340,7 @@ class LocStor extends BasicStor {
*/ */
protected function downloadMetadataClose($token) protected function downloadMetadataClose($token)
{ {
return $this->bsCloseDownload($token, 'metadata'); return BasicStor::bsCloseDownload($token, 'metadata');
} }
@ -359,7 +360,7 @@ class LocStor extends BasicStor {
if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $storedFile->getId(), $sessid)) !== TRUE) {
return $res; return $res;
} }
$md = $this->bsGetMetadata($storedFile->getId()); $md = BasicStor::bsGetMetadata($storedFile->getId());
if (PEAR::isError($md)) { if (PEAR::isError($md)) {
return $md; return $md;
} }
@ -372,8 +373,9 @@ class LocStor extends BasicStor {
/** /**
* Search in metadata database * Search in metadata database
* *
* @param string $sessid * @param string $p_sessid
* @param array $criteria * Session ID
* @param array $p_criteria
* with following structure:<br> * with following structure:<br>
* <ul> * <ul>
* <li>filetype - string, type of searched files, * <li>filetype - string, type of searched files,
@ -405,6 +407,10 @@ class LocStor extends BasicStor {
* </ul> * </ul>
* </li> * </li>
* </ul> * </ul>
*
* @param boolean $p_searchRemote
* Set this to true if you want to search the remote storage.
*
* @return array of hashes, fields: * @return array of hashes, fields:
* <ul> * <ul>
* <li>cnt : integer - number of matching gunids * <li>cnt : integer - number of matching gunids
@ -422,14 +428,37 @@ class LocStor extends BasicStor {
* </ul> * </ul>
* @see BasicStor::localSearch * @see BasicStor::localSearch
*/ */
protected function searchMetadata($sessid, $criteria) protected function searchMetadata($p_sessid, $p_criteria, $p_searchRemote = false)
{ {
if (($res = BasicStor::Authorize('read', $this->storId, $sessid)) !== TRUE) { if (!$p_searchRemote) {
// Local search
$res = BasicStor::Authorize('read', $this->storId, $p_sessid);
if ($res !== TRUE) {
return $res; return $res;
} }
$criteria['resultMode'] = 'xmlrpc'; $p_criteria['resultMode'] = 'xmlrpc';
$res = $this->localSearch($criteria, $sessid); $res = $this->localSearch($p_criteria, $p_sessid);
return $res; return $res;
} else {
// Remote search
$p_criteria['resultMode'] = 'php';
$transport = new Transport($this);
$loginSessionId = $transport->loginToArchive();
if (PEAR::isError($loginSessionId)) {
switch (intval($loginSessionId->getCode())) {
case 802:
return PEAR::raiseError("Can't login to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
case TRERR_XR_FAIL:
return PEAR::raiseError("Can't connect to Hub ({$r->getMessage()})", TRERR_XR_FAIL);
}
return $loginSessionId;
}
$results = $transport->xmlrpcCall("locstor.searchMetadata",
array("sessid" => $loginSessionId,
"criteria" => $p_criteria));
$transport->logoutFromArchive($loginSessionId);
return $results;
}
} }
@ -443,7 +472,7 @@ class LocStor extends BasicStor {
{ {
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
$res = $this->bsLocalSearch($criteria, $limit, $offset); $res = BasicStor::bsLocalSearch($criteria, $limit, $offset);
return $res; return $res;
} }
@ -467,7 +496,7 @@ class LocStor extends BasicStor {
{ {
$limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0); $limit = intval(isset($criteria['limit']) ? $criteria['limit'] : 0);
$offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0); $offset = intval(isset($criteria['offset']) ? $criteria['offset'] : 0);
$res = $this->bsBrowseCategory($category, $limit, $offset, $criteria); $res = BasicStor::bsBrowseCategory($category, $limit, $offset, $criteria);
return $res; return $res;
} }
@ -519,7 +548,7 @@ class LocStor extends BasicStor {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
$ex = $this->bsExistsFile($id, $ftype); $ex = BasicStor::bsExistsFile($id, $ftype);
return $ex; return $ex;
} }
@ -627,7 +656,7 @@ class LocStor extends BasicStor {
if ($fname == '') { if ($fname == '') {
$fname = "newFile.xml"; $fname = "newFile.xml";
} }
$res = $this->bsRenameFile($oid, $fname); $res = BasicStor::bsRenameFile($oid, $fname);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -678,7 +707,7 @@ class LocStor extends BasicStor {
if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('write', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
$res = $this->bsOpenDownload($id, 'metadata'); $res = BasicStor::bsOpenDownload($id, 'metadata');
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -705,7 +734,7 @@ class LocStor extends BasicStor {
*/ */
protected function savePlaylist($sessid, $playlistToken, $newPlaylist) protected function savePlaylist($sessid, $playlistToken, $newPlaylist)
{ {
$playlistId = $this->bsCloseDownload($playlistToken, 'metadata'); $playlistId = BasicStor::bsCloseDownload($playlistToken, 'metadata');
if (PEAR::isError($playlistId)) { if (PEAR::isError($playlistId)) {
return $playlistId; return $playlistId;
} }
@ -737,7 +766,7 @@ class LocStor extends BasicStor {
*/ */
public function revertEditedPlaylist($playlistToken, $sessid='') public function revertEditedPlaylist($playlistToken, $sessid='')
{ {
$gunid = $this->bsCloseDownload($playlistToken, 'metadata'); $gunid = BasicStor::bsCloseDownload($playlistToken, 'metadata');
if (PEAR::isError($gunid)) { if (PEAR::isError($gunid)) {
return $gunid; return $gunid;
} }
@ -843,8 +872,7 @@ class LocStor extends BasicStor {
if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) { if (($res = BasicStor::Authorize('read', $id, $sessid)) !== TRUE) {
return $res; return $res;
} }
$res = $this->bsOpenDownload($id, 'metadata', $parent); $res = BasicStor::bsOpenDownload($id, 'metadata', $parent);
#unset($res['filename']);
return $res; return $res;
} }
@ -864,14 +892,14 @@ class LocStor extends BasicStor {
public function releasePlaylist($sessid, $playlistToken, $recursive=FALSE) public function releasePlaylist($sessid, $playlistToken, $recursive=FALSE)
{ {
if ($recursive) { if ($recursive) {
require_once"AccessRecur.php"; require_once("AccessRecur.php");
$r = AccessRecur::releasePlaylist($this, $sessid, $playlistToken); $r = AccessRecur::releasePlaylist($this, $sessid, $playlistToken);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
} }
return $r; return $r;
} }
return $this->bsCloseDownload($playlistToken, 'metadata'); return BasicStor::bsCloseDownload($playlistToken, 'metadata');
} }
@ -894,7 +922,7 @@ class LocStor extends BasicStor {
*/ */
protected function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE) protected function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
{ {
$res = $this->bsExportPlaylistOpen($plids, $type, !$standalone); $res = BasicStor::bsExportPlaylistOpen($plids, $type, !$standalone);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -918,12 +946,12 @@ class LocStor extends BasicStor {
*/ */
protected function exportPlaylistClose($token) protected function exportPlaylistClose($token)
{ {
return $this->bsExportPlaylistClose($token); return BasicStor::bsExportPlaylistClose($token);
} }
/** /**
* Open writable handle for import playlist in LS Archive format * Open writable handle for import playlist in CC Archive format
* *
* @param string $sessid * @param string $sessid
* session id * session id
@ -939,7 +967,7 @@ class LocStor extends BasicStor {
if (PEAR::isError($userid)) { if (PEAR::isError($userid)) {
return $userid; return $userid;
} }
$r = $this->bsOpenPut($chsum, NULL, $userid); $r = BasicStor::bsOpenPut($chsum, NULL, $userid);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
} }
@ -957,7 +985,7 @@ class LocStor extends BasicStor {
*/ */
protected function importPlaylistClose($token) protected function importPlaylistClose($token)
{ {
$arr = $this->bsClosePut($token); $arr = BasicStor::bsClosePut($token);
if (PEAR::isError($arr)) { if (PEAR::isError($arr)) {
return $arr; return $arr;
} }
@ -1320,7 +1348,7 @@ class LocStor extends BasicStor {
if (PEAR::isError($userid)) { if (PEAR::isError($userid)) {
return $userid; return $userid;
} }
$r = $this->bsOpenPut($chsum, NULL, $userid); $r = BasicStor::bsOpenPut($chsum, NULL, $userid);
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
return $r; return $r;
} }
@ -1339,7 +1367,7 @@ class LocStor extends BasicStor {
* restore token * restore token
*/ */
protected function restoreBackupClosePut($sessid, $token) { protected function restoreBackupClosePut($sessid, $token) {
$arr = $this->bsClosePut($token); $arr = BasicStor::bsClosePut($token);
if (PEAR::isError($arr)) { if (PEAR::isError($arr)) {
return $arr; return $arr;
} }
@ -1419,13 +1447,13 @@ class LocStor extends BasicStor {
* url string: writable URL * url string: writable URL
* token string: PUT token * token string: PUT token
*/ */
function uploadOpen($sessid, $chsum) protected function uploadOpen($sessid, $chsum)
{ {
$owner = Alib::GetSessUserId($sessid); $owner = Alib::GetSessUserId($sessid);
if (PEAR::isError($owner)) { if (PEAR::isError($owner)) {
return $owner; return $owner;
} }
$res = $this->bsOpenPut($chsum, NULL, $owner); $res = BasicStor::bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -1444,9 +1472,9 @@ class LocStor extends BasicStor {
* transport parameters * transport parameters
* @return mixed * @return mixed
*/ */
function uploadClose($token, $trtype, $pars=array()) protected function uploadClose($token, $trtype, $pars=array())
{ {
$res = $this->bsClosePut($token); $res = BasicStor::bsClosePut($token);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -1454,7 +1482,7 @@ class LocStor extends BasicStor {
switch ($trtype) { switch ($trtype) {
case "audioclip": case "audioclip":
$mdtoken = $pars['mdpdtoken']; $mdtoken = $pars['mdpdtoken'];
$res = $this->bsClosePut($mdtoken); $res = BasicStor::bsClosePut($mdtoken);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -1473,7 +1501,7 @@ class LocStor extends BasicStor {
"gunid" => $pars['gunid'], "gunid" => $pars['gunid'],
"filetype" => "audioclip" "filetype" => "audioclip"
); );
$storedFile = $this->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
return $storedFile; return $storedFile;
} }
@ -1495,7 +1523,7 @@ class LocStor extends BasicStor {
"gunid" => $pars['gunid'], "gunid" => $pars['gunid'],
"filetype" => "playlist" "filetype" => "playlist"
); );
$storedFile = $this->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
return $storedFile; return $storedFile;
} }
@ -1505,7 +1533,7 @@ class LocStor extends BasicStor {
case "playlistPkg": case "playlistPkg":
$chsum = md5_file($fname); $chsum = md5_file($fname);
// importPlaylistOpen: // importPlaylistOpen:
$res = $this->bsOpenPut($chsum, NULL, $owner); $res = BasicStor::bsOpenPut($chsum, NULL, $owner);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -1565,7 +1593,7 @@ class LocStor extends BasicStor {
* url string: writable URL * url string: writable URL
* token string: PUT token * token string: PUT token
*/ */
function downloadOpen($sessid, $trtype, $pars=array()) protected function downloadOpen($sessid, $trtype, $pars=array())
{ {
global $CC_CONFIG; global $CC_CONFIG;
switch ($trtype) { switch ($trtype) {
@ -1575,7 +1603,7 @@ class LocStor extends BasicStor {
case "playlist": case "playlist":
case "playlistPkg": case "playlistPkg":
if (!isset($pars['gunid'])) { if (!isset($pars['gunid'])) {
return PEAR::raiseError("Archive::downloadOpen: gunid not set"); return PEAR::raiseError("LocStor::downloadOpen: gunid not set");
} }
break; break;
} }
@ -1589,7 +1617,6 @@ class LocStor extends BasicStor {
// required with content: // required with content:
$trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ? $trtype = ( ($trtype2 == 'playlist') && ($trtype == 'playlistPkg') ?
'playlistPkg' : $trtype2); 'playlistPkg' : $trtype2);
//return PEAR::raiseError("Archive::downloadOpen: TT=$trtype TT2=$trtype2 G=$gunid");
} }
switch ($trtype) { switch ($trtype) {
case "audioclip": case "audioclip":
@ -1602,14 +1629,14 @@ class LocStor extends BasicStor {
$res = $this->accessPlaylist($sessid, $gunid); $res = $this->accessPlaylist($sessid, $gunid);
break; break;
case "playlistPkg": case "playlistPkg":
$res = $this->bsExportPlaylistOpen($gunid); $res = BasicStor::bsExportPlaylistOpen($gunid);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_'); $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
$plfpath = "$tmpn.lspl"; $plfpath = "$tmpn.lspl";
copy($res['fname'], $plfpath); copy($res['fname'], $plfpath);
$res = $this->bsExportPlaylistClose($res['token']); $res = BasicStor::bsExportPlaylistClose($res['token']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -1635,7 +1662,7 @@ class LocStor extends BasicStor {
$res = array(); $res = array();
break; break;
default: default:
return PEAR::raiseError("Archive::downloadOpen: NotImpl ($trtype)"); return PEAR::raiseError("LocStor::downloadOpen: NotImpl ($trtype)");
} }
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
@ -1645,7 +1672,7 @@ class LocStor extends BasicStor {
case "metadata": case "metadata":
case "playlist": case "playlist":
case "playlistPkg": case "playlistPkg":
$title = $this->bsGetTitle(NULL, $gunid); $title = BasicStor::bsGetTitle(NULL, $gunid);
break; break;
case "searchjob": case "searchjob":
$title = 'searchjob'; $title = 'searchjob';
@ -1673,7 +1700,7 @@ class LocStor extends BasicStor {
* url string: writable URL * url string: writable URL
* token string: PUT token * token string: PUT token
*/ */
function downloadClose($token, $trtype) protected function downloadClose($token, $trtype)
{ {
switch ($trtype) { switch ($trtype) {
case "audioclip": case "audioclip":
@ -1709,7 +1736,7 @@ class LocStor extends BasicStor {
case "file": case "file":
return array(); return array();
default: default:
return PEAR::raiseError("Archive::downloadClose: NotImpl ($trtype)"); return PEAR::raiseError("LocStor::downloadClose: NotImpl ($trtype)");
} }
} }
@ -1725,9 +1752,9 @@ class LocStor extends BasicStor {
* 'up' | 'down' * 'up' | 'down'
* @param array $pars * @param array $pars
* transport parameters * transport parameters
* @return mixed * @return TransportRecord|PEAR_Error
*/ */
function prepareHubInitiatedTransfer( protected function prepareHubInitiatedTransfer(
$target, $trtype='file', $direction='up',$pars=array()) $target, $trtype='file', $direction='up',$pars=array())
{ {
$tr = new Transport($this); $tr = new Transport($this);
@ -1749,9 +1776,10 @@ class LocStor extends BasicStor {
* 'up' | 'down' * 'up' | 'down'
* @param string $trtok * @param string $trtok
* transport token * transport token
* @return mixed * @return array|PEAR_Error
* array of transportRecords as hasharrays
*/ */
function listHubInitiatedTransfers( protected function listHubInitiatedTransfers(
$target=NULL, $direction=NULL, $trtok=NULL) $target=NULL, $direction=NULL, $trtok=NULL)
{ {
$tr = new Transport($this); $tr = new Transport($this);
@ -1771,7 +1799,7 @@ class LocStor extends BasicStor {
* transport state * transport state
* @return TransportRecord|PEAR_Error * @return TransportRecord|PEAR_Error
*/ */
function setHubInitiatedTransfer($target, $trtok, $state) protected function setHubInitiatedTransfer($target, $trtok, $state)
{ {
$tr = new Transport($this); $tr = new Transport($this);
$trec = TransportRecord::recall($tr, $trtok); $trec = TransportRecord::recall($tr, $trtok);

View file

@ -54,7 +54,7 @@ class Playlist extends StoredFile {
return $pl; return $pl;
} }
$fname = ($fname == '' || is_null($fname) ? "newFile.xml" : $fname ); $fname = ($fname == '' || is_null($fname) ? "newFile.xml" : $fname );
$res = $gb->bsRenameFile($oid, $fname); $res = BasicStor::bsRenameFile($oid, $fname);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -1606,8 +1606,8 @@ class PlaylistAudioClipExport
if (PEAR::isError($RADext)) { if (PEAR::isError($RADext)) {
return $RADext; return $RADext;
} }
$title = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:title'); $title = BasicStor::bsGetMetadataValue($ac->getId(), 'dc:title');
$desc = $pl->gb->bsGetMetadataValue($ac->getId(), 'dc:description'); $desc = BasicStor::bsGetMetadataValue($ac->getId(), 'dc:description');
return array( return array(
'type' => 'audioclip', 'type' => 'audioclip',
'gunid' => $gunid, 'gunid' => $gunid,

View file

@ -18,17 +18,11 @@ require_once("GreenBox.php");
/* ================== Prefs ================== */ /* ================== Prefs ================== */
class Prefs { class Prefs {
public $gb;
/** /**
* Constructor * Constructor
*
* @param GreenBox $gb
* GreenBox object reference
*/ */
public function __construct(&$gb) public function __construct()
{ {
$this->gb =& $gb;
} }

View file

@ -227,7 +227,7 @@ class Renderer
} }
$mdata = ''; $mdata = '';
foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) { foreach (array('dc:title', 'dcterms:extent', 'dc:creator', 'dc:description') as $item) {
$val = $gb->bsGetMetadataValue($id, $item); $val = BasicStor::bsGetMetadataValue($id, $item);
$mdata .= " <$item>$val</$item>\n"; $mdata .= " <$item>$val</$item>\n";
} }
$mdata = "<audioClip>\n <metadata>\n$mdata </metadata>\n</audioClip>\n"; $mdata = "<audioClip>\n <metadata>\n$mdata </metadata>\n</audioClip>\n";
@ -238,7 +238,7 @@ class Renderer
"metadata" => $mdata, "metadata" => $mdata,
"filetype" => "audioclip" "filetype" => "audioclip"
); );
$storedFile = $gb->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
return $storedFile; return $storedFile;
} }

View file

@ -186,13 +186,6 @@ function camp_get_audio_metadata($p_filename, $p_testonly = false)
array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), array('path'=>"['ogg']['comments']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"), array('path'=>"['tags']['vorbiscomment']['tracknumber']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
), ),
// 'ls:genre' => array(
// array('path'=>"['id3v1']", 'dataPath'=>"['genre']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['TCON'][0]", 'dataPath'=>"['data']", 'encPath'=>"['encoding']"),
// array('path'=>"['id3v2']['comments']['content_type']", 'dataPath'=>"[0]", 'ignoreEnc'=>TRUE),
// array('path'=>"['ogg']['comments']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// array('path'=>"['tags']['vorbiscomment']['genre']", 'dataPath'=>"[0]", 'encPath'=>"['encoding']"),
// ),
'ls:channels' => array( 'ls:channels' => array(
array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE), array('path'=>"['audio']['channels']", 'ignoreEnc'=>TRUE),
), ),

View file

@ -155,7 +155,7 @@ class Transport
* errmsg: string - error message for failed transports * errmsg: string - error message for failed transports
* ... ? * ... ?
*/ */
function getTransportInfo($trtok) public function getTransportInfo($trtok)
{ {
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
@ -170,7 +170,7 @@ class Transport
} }
if ( ($trec->row['direction'] == 'down') && file_exists($trec->row['localfile']) ){ if ( ($trec->row['direction'] == 'down') && file_exists($trec->row['localfile']) ){
$res['realsize'] = filesize($trec->row['localfile']); $res['realsize'] = filesize($trec->row['localfile']);
$res['realsum'] = $this->_chsum($trec->row['localfile']); $res['realsum'] = md5_file($trec->row['localfile']);
} }
if ( ($trec->row['direction'] == 'up') ){ if ( ($trec->row['direction'] == 'up') ){
$check = $this->uploadCheck($trec->row['pdtoken']); $check = $this->uploadCheck($trec->row['pdtoken']);
@ -199,10 +199,10 @@ class Transport
* @return boolea * @return boolea
* previous state * previous state
*/ */
function turnOnOffTransports($sessid, $onOff=NULL) public function turnOnOffTransports($sessid, $onOff=NULL)
{ {
require_once('Prefs.php'); require_once('Prefs.php');
$pr = new Prefs($this->gb); $pr = new Prefs();
$group = 'StationPrefs'; $group = 'StationPrefs';
$key = 'TransportsDenied'; $key = 'TransportsDenied';
$res = $pr->loadGroupPref($sessid, $group, $key); $res = $pr->loadGroupPref($sessid, $group, $key);
@ -235,7 +235,7 @@ class Transport
* @return string * @return string
* resulting transport state * resulting transport state
*/ */
function doTransportAction($trtok, $action) public function doTransportAction($trtok, $action)
{ {
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
@ -275,8 +275,8 @@ class Transport
/* ------------- special methods for audioClip/webstream object transport */ /* ------------- special methods for audioClip/webstream object transport */
/** /**
* Start upload of audioClip/webstream/playlist from local storageServer * Start upload of audioClip/webstream/playlist from local storage
* to hub. * to remote storage.
* *
* @param string $gunid * @param string $gunid
* global unique id of object being transported * global unique id of object being transported
@ -287,10 +287,10 @@ class Transport
* @return string * @return string
* transport token * transport token
*/ */
function upload2Hub($gunid, $withContent=TRUE, $pars=array()) public function uploadToHub($gunid, $withContent=TRUE, $pars=array())
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$this->trLog("upload2Hub start: ".strftime("%H:%M:%S")); $this->trLog("uploadToHub start: ".strftime("%H:%M:%S"));
switch ($ftype = BasicStor::GetType($gunid)) { switch ($ftype = BasicStor::GetType($gunid)) {
case "audioclip": case "audioclip":
case "webstream": case "webstream":
@ -341,18 +341,18 @@ class Transport
return $fname; return $fname;
} }
if ($withContent) { if ($withContent) {
$this->trLog("upload2Hub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S")); $this->trLog("uploadToHub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S"));
$res = $this->gb->bsExportPlaylistOpen($plid); $res = BasicStor::bsExportPlaylistOpen($plid);
$this->trLog("upload2Hub exportPlaylistOpen END: ".strftime("%H:%M:%S")); $this->trLog("uploadToHub exportPlaylistOpen END: ".strftime("%H:%M:%S"));
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
$tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_'); $tmpn = tempnam($CC_CONFIG['transDir'], 'plExport_');
$plfpath = "$tmpn.lspl"; $plfpath = "$tmpn.lspl";
$this->trLog("upload2Hub begin copy: ".strftime("%H:%M:%S")); $this->trLog("uploadToHub begin copy: ".strftime("%H:%M:%S"));
copy($res['fname'], $plfpath); copy($res['fname'], $plfpath);
$this->trLog("upload2Hub end copy: ".strftime("%H:%M:%S")); $this->trLog("uploadToHub end copy: ".strftime("%H:%M:%S"));
$res = $this->gb->bsExportPlaylistClose($res['token']); $res = BasicStor::bsExportPlaylistClose($res['token']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
@ -372,10 +372,10 @@ class Transport
} }
break; break;
default: default:
return PEAR::raiseError("Transport::upload2Hub: ftype not supported ($ftype)"); return PEAR::raiseError("Transport::uploadToHub: ftype not supported ($ftype)");
} }
$this->startCronJobProcess($trec->trtok); $this->startCronJobProcess($trec->trtok);
$this->trLog("upload2Hub end: ".strftime("%H:%M:%S")); $this->trLog("uploadToHub end: ".strftime("%H:%M:%S"));
return $trec->trtok; return $trec->trtok;
} }
@ -396,7 +396,7 @@ class Transport
* @return string * @return string
* transport token * transport token
*/ */
function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array()) public function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array())
{ {
$trtype = ($withContent ? 'playlistPkg' : 'unknown' ); $trtype = ($withContent ? 'playlistPkg' : 'unknown' );
$trec = TransportRecord::create($this, $trtype, 'down', $trec = TransportRecord::create($this, $trtype, 'down',
@ -414,7 +414,7 @@ class Transport
* Start search job on network hub * Start search job on network hub
* *
* @param array $criteria * @param array $criteria
* LS criteria format (see localSearch) * CC criteria format (see localSearch)
* @param string $resultMode * @param string $resultMode
* 'php' | 'xmlrpc' * 'php' | 'xmlrpc'
* @param array $pars * @param array $pars
@ -422,7 +422,7 @@ class Transport
* @return string * @return string
* transport token * transport token
*/ */
function globalSearch($criteria, $resultMode='php', $pars=array()) public function globalSearch($criteria, $resultMode='php', $pars=array())
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
// testing of hub availability and hub account configuration. // testing of hub availability and hub account configuration.
@ -459,9 +459,9 @@ class Transport
* @param boolean $andClose * @param boolean $andClose
* if TRUE, close transport token * if TRUE, close transport token
* @return array * @return array
* LS search result format (see localSearch) * CC search result format (see localSearch)
*/ */
function getSearchResults($trtok, $andClose=TRUE) public function getSearchResults($trtok, $andClose=TRUE)
{ {
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
@ -517,10 +517,10 @@ class Transport
} }
/* ------------------------ methods for ls-archive-format file transports */ /* ------------------------ methods for cc-archive-format file transports */
/** /**
* Open async file transfer from local storageServer to network hub, * Open async file transfer from local storageServer to network hub,
* file should be ls-archive-format file. * file should be cc-archive-format file.
* *
* @param string $filePath * @param string $filePath
* local path to uploaded file * local path to uploaded file
@ -529,11 +529,11 @@ class Transport
* @return string * @return string
* transport token * transport token
*/ */
function uploadFile2Hub($filePath, $pars=array()) public function uploadFileAsync($filePath, $pars=array())
{ {
if (!file_exists($filePath)) { if (!file_exists($filePath)) {
return PEAR::raiseError( return PEAR::raiseError(
"Transport::uploadFile2Hub: file not found ($filePath)" "Transport::uploadFileAsync: file not found ($filePath)"
); );
} }
$trec = $this->_uploadGeneralFileToHub($filePath, 'file', $pars); $trec = $this->_uploadGeneralFileToHub($filePath, 'file', $pars);
@ -547,7 +547,7 @@ class Transport
/** /**
* Open async file transfer from network hub to local storageServer, * Open async file transfer from network hub to local storageServer,
* file should be ls-archive-format file. * file should be cc-archive-format file.
* *
* @param string $url * @param string $url
* readable url * readable url
@ -561,7 +561,7 @@ class Transport
* trtok: string - transport token * trtok: string - transport token
* localfile: string - filepath of downloaded file * localfile: string - filepath of downloaded file
*/ */
function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array()) public function downloadFileFromHub($url, $chsum=NULL, $size=NULL, $pars=array())
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$tmpn = tempnam($CC_CONFIG['transDir'], 'HITrans_'); $tmpn = tempnam($CC_CONFIG['transDir'], 'HITrans_');
@ -588,7 +588,7 @@ class Transport
* array of structs/hasharrays with fields: * array of structs/hasharrays with fields:
* trtok: string transport token * trtok: string transport token
*/ */
function getHubInitiatedTransfers() public function getHubInitiatedTransfers()
{ {
$ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers', $ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers',
array('target' => HOSTNAME)); array('target' => HOSTNAME));
@ -614,7 +614,7 @@ class Transport
* @return string * @return string
* transport token * transport token
*/ */
function startHubInitiatedTransfer($uid, $rtrtok) public function startHubInitiatedTransfer($uid, $rtrtok)
{ {
$ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers', $ret = $this->xmlrpcCall('locstor.listHubInitiatedTransfers',
array( array(
@ -640,7 +640,7 @@ class Transport
case "audioclip": case "audioclip":
case "playlist": case "playlist":
case "playlistPkg": case "playlistPkg":
$trtok = $this->upload2Hub($gunid, TRUE, $trtok = $this->uploadToHub($gunid, TRUE,
array('rtrtok'=>$rtrtok)); array('rtrtok'=>$rtrtok));
if (PEAR::isError($trtok)) { if (PEAR::isError($trtok)) {
return $trtok; return $trtok;
@ -713,7 +713,7 @@ class Transport
* @return string * @return string
* sessid or error * sessid or error
*/ */
function loginToArchive() public function loginToArchive()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$res = $this->xmlrpcCall('locstor.login', $res = $this->xmlrpcCall('locstor.login',
@ -736,7 +736,7 @@ class Transport
* @return string * @return string
* Bye or error * Bye or error
*/ */
function logoutFromArchive($sessid) public function logoutFromArchive($sessid)
{ {
$res = $this->xmlrpcCall('locstor.logout', $res = $this->xmlrpcCall('locstor.logout',
array('sessid'=>$sessid)); array('sessid'=>$sessid));
@ -754,7 +754,7 @@ class Transport
* @return boolean * @return boolean
* TRUE * TRUE
*/ */
function cronMain($direction=NULL) public function cronMain($direction=NULL)
{ {
global $CC_CONFIG; global $CC_CONFIG;
if (is_null($direction)) { if (is_null($direction)) {
@ -799,7 +799,7 @@ class Transport
* @return boolean * @return boolean
* status * status
*/ */
function startCronJobProcess($trtok) public function startCronJobProcess($trtok)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
if (TR_LOG_LEVEL > 2) { if (TR_LOG_LEVEL > 2) {
@ -830,7 +830,7 @@ class Transport
* @return mixed * @return mixed
* inherited from called method * inherited from called method
*/ */
function cronCallMethod($trtok) public function cronCallMethod($trtok)
{ {
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
@ -847,16 +847,16 @@ class Transport
'closed'=>'closed'); 'closed'=>'closed');
$directions = array('up'=>'upload', 'down'=>'download'); $directions = array('up'=>'upload', 'down'=>'download');
// method name construction: // method name construction:
$mname = "cron"; $methodName = "cron";
if (isset($directions[$row['direction']])) { if (isset($directions[$row['direction']])) {
$mname .= ucfirst($directions[$row['direction']]); $methodName .= ucfirst($directions[$row['direction']]);
} else { } else {
return PEAR::raiseError( return PEAR::raiseError(
"Transport::cronCallMethod: invalid direction ({$row['direction']})" "Transport::cronCallMethod: invalid direction ({$row['direction']})"
); );
} }
if (isset($states[$state])) { if (isset($states[$state])) {
$mname .= ucfirst($states[$state]); $methodName .= ucfirst($states[$state]);
} else { } else {
return PEAR::raiseError( return PEAR::raiseError(
"Transport::cronCallMethod: invalid state ({$state})" "Transport::cronCallMethod: invalid state ({$state})"
@ -871,7 +871,7 @@ class Transport
return TRUE; return TRUE;
case 'waiting': case 'waiting':
require_once('Prefs.php'); require_once('Prefs.php');
$pr = new Prefs($this->gb); $pr = new Prefs();
$group = 'StationPrefs'; $group = 'StationPrefs';
$key = 'TransportsDenied'; $key = 'TransportsDenied';
$res = $pr->loadGroupPref(NULL/*sessid*/, $group, $key); $res = $pr->loadGroupPref(NULL/*sessid*/, $group, $key);
@ -891,7 +891,7 @@ class Transport
} }
// NO break here! // NO break here!
default: default:
if (method_exists($this, $mname)) { if (method_exists($this, $methodName)) {
// lock the job: // lock the job:
$pid = getmypid(); $pid = getmypid();
$r = $trec->setLock(TRUE, $pid); $r = $trec->setLock(TRUE, $pid);
@ -915,15 +915,15 @@ class Transport
$asessid = $r; $asessid = $r;
// method call: // method call:
if (TR_LOG_LEVEL > 2) { if (TR_LOG_LEVEL > 2) {
$this->trLog("cronCallMethod($pid): $mname($trtok) >"); $this->trLog("cronCallMethod($pid): $methodName($trtok) >");
} }
$ret = call_user_func(array($this, $mname), $row, $asessid); $ret = call_user_func(array($this, $methodName), $row, $asessid);
if (PEAR::isError($ret)) { if (PEAR::isError($ret)) {
$trec->setLock(FALSE); $trec->setLock(FALSE);
return $this->_failFatal($ret, $trec); return $this->_failFatal($ret, $trec);
} }
if (TR_LOG_LEVEL > 2) { if (TR_LOG_LEVEL > 2) {
$this->trLog("cronCallMethod($pid): $mname($trtok) <"); $this->trLog("cronCallMethod($pid): $methodName($trtok) <");
} }
// unlock the job: // unlock the job:
$r = $trec->setLock(FALSE); $r = $trec->setLock(FALSE);
@ -938,7 +938,7 @@ class Transport
return $ret; return $ret;
} else { } else {
return PEAR::raiseError( return PEAR::raiseError(
"Transport::cronCallMethod: unknown method ($mname)" "Transport::cronCallMethod: unknown method ($methodName)"
); );
} }
} }
@ -955,7 +955,7 @@ class Transport
* @return mixed * @return mixed
* boolean TRUE or error object * boolean TRUE or error object
*/ */
function cronUploadInit($row, $asessid) public function cronUploadInit($row, $asessid)
{ {
$trtok = $row['trtok']; $trtok = $row['trtok'];
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
@ -989,7 +989,7 @@ class Transport
* @return mixed * @return mixed
* boolean TRUE or error object * boolean TRUE or error object
*/ */
function cronDownloadInit($row, $asessid) public function cronDownloadInit($row, $asessid)
{ {
global $CC_CONFIG; global $CC_CONFIG;
$trtok = $row['trtok']; $trtok = $row['trtok'];
@ -1061,7 +1061,7 @@ class Transport
* @return mixed * @return mixed
* boolean TRUE or error object * boolean TRUE or error object
*/ */
function cronUploadWaiting($row, $asessid) public function cronUploadWaiting($row, $asessid)
{ {
$trtok = $row['trtok']; $trtok = $row['trtok'];
$check = $this->uploadCheck($row['pdtoken']); $check = $this->uploadCheck($row['pdtoken']);
@ -1165,7 +1165,7 @@ class Transport
* @return mixed * @return mixed
* boolean TRUE or error object * boolean TRUE or error object
*/ */
function cronDownloadWaiting($row, $asessid) public function cronDownloadWaiting($row, $asessid)
{ {
$trtok = $row['trtok']; $trtok = $row['trtok'];
// wget the file // wget the file
@ -1212,7 +1212,7 @@ class Transport
return $r; return $r;
} }
} elseif ($size >= $row['expectedsize']) { } elseif ($size >= $row['expectedsize']) {
$chsum = $this->_chsum($row['localfile']); $chsum = md5_file($row['localfile']);
if ($chsum == $row['expectedsum']) { if ($chsum == $row['expectedsum']) {
// mark download as finished // mark download as finished
$r = $trec->setState('finished', $r = $trec->setState('finished',
@ -1240,11 +1240,10 @@ class Transport
* @param array $row * @param array $row
* row from getTransport results * row from getTransport results
* @param string $asessid * @param string $asessid
* session id (from network hub) * session id from remote storage
* @return mixed * @return TRUE|PEAR_Error
* boolean TRUE or error object
*/ */
function cronUploadFinished($row, $asessid) public function cronUploadFinished($row, $asessid)
{ {
global $CC_CONFIG; global $CC_CONFIG;
$trtok = $row['trtok']; $trtok = $row['trtok'];
@ -1353,7 +1352,7 @@ class Transport
* @return mixed * @return mixed
* boolean TRUE or error object * boolean TRUE or error object
*/ */
function cronDownloadFinished($row, $asessid) public function cronDownloadFinished($row, $asessid)
{ {
$trtok = $row['trtok']; $trtok = $row['trtok'];
$trec = TransportRecord::recall($this, $trtok); $trec = TransportRecord::recall($this, $trtok);
@ -1396,7 +1395,7 @@ class Transport
"gunid" => $row['gunid'], "gunid" => $row['gunid'],
"filetype" => "audioclip" "filetype" => "audioclip"
); );
$storedFile = $this->gb->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
$mdtrec->setLock(FALSE); $mdtrec->setLock(FALSE);
return $storedFile; return $storedFile;
@ -1433,8 +1432,8 @@ class Transport
break; break;
case "metadata": case "metadata":
case "searchjob": case "searchjob":
return TRUE; // don't close - getSearchResults should close it // don't close - getSearchResults should close it
break; return TRUE;
} }
$ret = $this->xmlrpcCall('locstor.downloadClose', $ret = $this->xmlrpcCall('locstor.downloadClose',
array( array(
@ -1456,7 +1455,7 @@ class Transport
"gunid" => $row['gunid'], "gunid" => $row['gunid'],
"filetype" => "playlist" "filetype" => "playlist"
); );
$storedFile = $this->gb->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
return $storedFile; return $storedFile;
} }
@ -1513,11 +1512,11 @@ class Transport
* transport type * transport type
* @param array $pars * @param array $pars
* default parameters (optional, internal use) * default parameters (optional, internal use)
* @return object - transportRecord instance * @return TransportRecord
*/ */
function _uploadGeneralFileToHub($fpath, $trtype, $pars=array()) private function _uploadGeneralFileToHub($fpath, $trtype, $pars=array())
{ {
$chsum = $this->_chsum($fpath); $chsum = md5_file($fpath);
$size = filesize($fpath); $size = filesize($fpath);
$trec = TransportRecord::create($this, $trtype, 'up', $trec = TransportRecord::create($this, $trtype, 'up',
array_merge(array( array_merge(array(
@ -1538,7 +1537,7 @@ class Transport
* @return string * @return string
* transport token * transport token
*/ */
function _createTransportToken() public function _createTransportToken()
{ {
$ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : ''); $ip = (isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '');
$initString = microtime().$ip.rand()."org.mdlf.campcaster"; $initString = microtime().$ip.rand()."org.mdlf.campcaster";
@ -1560,7 +1559,7 @@ class Transport
* @return array * @return array
* array of transportRecords (as hasharrays) * array of transportRecords (as hasharrays)
*/ */
function getTransports($direction=NULL, $target=NULL, $trtok=NULL) public function getTransports($direction=NULL, $target=NULL, $trtok=NULL)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
switch ($direction) { switch ($direction) {
@ -1614,7 +1613,7 @@ class Transport
* @return array * @return array
* hash: chsum, size, url * hash: chsum, size, url
*/ */
function uploadCheck($pdtoken) public function uploadCheck($pdtoken)
{ {
$ret = $this->xmlrpcCall('locstor.uploadCheck', $ret = $this->xmlrpcCall('locstor.uploadCheck',
array('token'=>$pdtoken)); array('token'=>$pdtoken));
@ -1628,7 +1627,7 @@ class Transport
* @return string * @return string
* network hub response or error object * network hub response or error object
*/ */
function pingToArchive() public function pingToArchive()
{ {
$res = $this->xmlrpcCall('locstor.ping', $res = $this->xmlrpcCall('locstor.ping',
array('par'=>'ping_'.date('H:i:s'))); array('par'=>'ping_'.date('H:i:s')));
@ -1646,7 +1645,7 @@ class Transport
* @return mixed * @return mixed
* response * response
*/ */
function xmlrpcCall($method, $pars=array()) public function xmlrpcCall($method, $pars=array())
{ {
global $CC_CONFIG; global $CC_CONFIG;
$xrp = XML_RPC_encode($pars); $xrp = XML_RPC_encode($pars);
@ -1655,13 +1654,11 @@ class Transport
$CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort'] $CC_CONFIG['archiveUrlHost'], $CC_CONFIG['archiveUrlPort']
); );
$f = new XML_RPC_Message($method, array($xrp)); $f = new XML_RPC_Message($method, array($xrp));
$r = $c->send($f); $r = $c->send($f, 30);
if (!$r) { if (!$r) {
return PEAR::raiseError("XML-RPC request failed", TRERR_XR_FAIL); return PEAR::raiseError("XML-RPC request failed", TRERR_XR_FAIL);
} elseif ($r->faultCode() > 0) { } elseif ($r->faultCode() > 0) {
return PEAR::raiseError($r->faultString(), $r->faultCode()); return PEAR::raiseError($r->faultString(), $r->faultCode());
// return PEAR::raiseError($r->faultString().
// " (code ".$r->faultCode().")", TRERR_XR_FAIL);
} else { } else {
$v = $r->value(); $v = $r->value();
return XML_RPC_decode($v); return XML_RPC_decode($v);
@ -1669,20 +1666,6 @@ class Transport
} }
/**
* Checksum of local file
*
* @param string $fpath
* local filepath
* @return string
* checksum
*/
function _chsum($fpath)
{
return md5_file($fpath);
}
/** /**
* Check exception and eventually mark transport as failed * Check exception and eventually mark transport as failed
* *
@ -1692,7 +1675,7 @@ class Transport
* transport record object * transport record object
* @return unknown * @return unknown
*/ */
function _failFatal($res, $trec) private function _failFatal($res, $trec)
{ {
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
switch ($res->getCode()) { switch ($res->getCode()) {
@ -1717,7 +1700,7 @@ class Transport
* if true, delete non-closed jobs too * if true, delete non-closed jobs too
* @return boolean true or error * @return boolean true or error
*/ */
function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE) public function _cleanUp($interval='1 minute'/*'1 hour'*/, $forced=FALSE)
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$cond = ($forced ? '' : " AND state='closed' AND lock = 'N'"); $cond = ($forced ? '' : " AND state='closed' AND lock = 'N'");
@ -1743,7 +1726,7 @@ class Transport
* @return mixed * @return mixed
* void or error object * void or error object
*/ */
function trLogPear($txt, $eo, $row=NULL) public function trLogPear($txt, $eo, $row=NULL)
{ {
$msg = $txt.$eo->getMessage()." ".$eo->getUserInfo(). $msg = $txt.$eo->getMessage()." ".$eo->getUserInfo().
" [".$eo->getCode()."]"; " [".$eo->getCode()."]";
@ -1766,7 +1749,7 @@ class Transport
* @return mixed * @return mixed
* void or error object * void or error object
*/ */
function trLog($msg) public function trLog($msg)
{ {
global $CC_CONFIG; global $CC_CONFIG;
$logfile = $CC_CONFIG['transDir']."/activity.log"; $logfile = $CC_CONFIG['transDir']."/activity.log";
@ -1789,93 +1772,12 @@ class Transport
* @return mixed * @return mixed
* void or error object * void or error object
*/ */
function resetData() public function resetData()
{ {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
return $CC_DBC->query("DELETE FROM ".$CC_CONFIG['transTable']); return $CC_DBC->query("DELETE FROM ".$CC_CONFIG['transTable']);
} }
/**
* Install method<br>
*
* direction: up | down
* state: init | pending | waiting | finished | closed | failed | paused
* trtype: audioclip | playlist | playlistPkg | searchjob | metadata | file
*
*/
// function install()
// {
// global $CC_CONFIG, $CC_DBC;
// $r = $CC_DBC->query("CREATE TABLE {$this->transTable} (
// id int not null, -- primary key
// trtok char(16) not null, -- transport token
// direction varchar(128) not null, -- direction: up|down
// state varchar(128) not null, -- state
// trtype varchar(128) not null, -- transport type
// lock char(1) not null default 'N',-- running lock
// target varchar(255) default NULL, -- target system,
// -- if NULL => predefined set
// rtrtok char(16) default NULL, -- remote hub's transport token
// mdtrtok char(16), -- metadata transport token
// gunid bigint, -- global unique id
// pdtoken bigint, -- put/download token from archive
// url varchar(255), -- url on remote side
// localfile varchar(255), -- pathname of local part
// fname varchar(255), -- mnemonic filename
// title varchar(255), -- dc:title mdata value (or filename ...)
// expectedsum char(32), -- expected file checksum
// realsum char(32), -- checksum of transported part
// expectedsize int, -- expected filesize in bytes
// realsize int, -- filesize of transported part
// uid int, -- local user id of transport owner
// errmsg varchar(255), -- error message string for failed tr.
// start timestamp, -- starttime
// ts timestamp -- mtime
// )");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// $r = $CC_DBC->createSequence("{$this->transTable}_id_seq");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// $r = $CC_DBC->query("CREATE UNIQUE INDEX {$this->transTable}_id_idx
// ON {$this->transTable} (id)");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// $r = $CC_DBC->query("CREATE UNIQUE INDEX {$this->transTable}_trtok_idx
// ON {$this->transTable} (trtok)");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// $r = $CC_DBC->query("CREATE UNIQUE INDEX {$this->transTable}_token_idx
// ON {$this->transTable} (pdtoken)");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// $r = $CC_DBC->query("CREATE INDEX {$this->transTable}_gunid_idx
// ON {$this->transTable} (gunid)");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// $r = $CC_DBC->query("CREATE INDEX {$this->transTable}_state_idx
// ON {$this->transTable} (state)");
// if (PEAR::isError($r)) {
// echo $r->getMessage()." ".$r->getUserInfo();
// }
// }
/**
* Uninstall method
*/
// function uninstall()
// {
// global $CC_CONFIG, $CC_DBC;
// $CC_DBC->query("DROP TABLE {$this->transTable}");
// $CC_DBC->dropSequence("{$this->transTable}_id_seq");
// }
} }
?> ?>

View file

@ -394,7 +394,7 @@ class TransportRecord
case "playlist": case "playlist":
case "playlistPkg": case "playlistPkg":
case "metadata": case "metadata":
$title = $this->gb->bsGetTitle(NULL, $this->row['gunid']); $title = BasicStor::bsGetTitle(NULL, $this->row['gunid']);
if (is_null($title)) { if (is_null($title)) {
$title = $defStr; $title = $defStr;
} }

View file

@ -26,16 +26,13 @@ for ($i = 0; $i < $cnt; $i++, sleep(1)) {
if (PEAR::isError($r)) { if (PEAR::isError($r)) {
$tr->trLogPear("transportCronJob($pid): ($trtok): ", $r); $tr->trLogPear("transportCronJob($pid): ($trtok): ", $r);
} else { } else {
# $tr->trLog("X transportCronJob: ".var_export($r, TRUE));
if ($r !== TRUE) { if ($r !== TRUE) {
$tr->trLog("transportCronJob($pid): ($trtok): nonTRUE returned"); $tr->trLog("transportCronJob($pid): ($trtok): nonTRUE returned");
} }
} }
#if(!$r) exit(1);
#sleep(2);
} }
if (TR_LOG_LEVEL>1) { if (TR_LOG_LEVEL > 1) {
$tr->trLog("transportCronJob($pid) end ($trtok)"); $tr->trLog("transportCronJob($pid) end ($trtok)");
} }
exit(0); exit(0);

View file

@ -47,7 +47,7 @@ $values = array(
"gunid" => $gunid, "gunid" => $gunid,
"filetype" => "audioclip" "filetype" => "audioclip"
); );
$storedFile = $gb->bsPutFile($parid, $values); $storedFile = BasicStor::bsPutFile($parid, $values);
if (PEAR::isError($storedFile)) { if (PEAR::isError($storedFile)) {
if ($storedFile->getCode()!=GBERR_GUNID) { if ($storedFile->getCode()!=GBERR_GUNID) {
echo "ERROR: ".$storedFile->getMessage()."\n"; echo "ERROR: ".$storedFile->getMessage()."\n";
@ -84,7 +84,7 @@ var_export($r); echo"\n";
/* ========== UPLOAD ========== */ /* ========== UPLOAD ========== */
echo "# UPLOAD test:\n"; echo "# UPLOAD test:\n";
echo"# uploadAudioClip2Hub: "; echo"# uploadAudioClip2Hub: ";
$r = $gb->upload2Hub($gunid); $r = $gb->uploadToHub($gunid);
if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); } if(PEAR::isError($r)){ echo "ERROR: ".$r->getMessage()."/".$r->getUserInfo()."\n"; exit(1); }
var_export($r); echo"\n"; var_export($r); echo"\n";
$trtok = $r; $trtok = $r;

View file

@ -1319,7 +1319,7 @@ class XR_LocStor extends LocStor {
/* ------------------------------------------------------ import playlist */ /* ------------------------------------------------------ import playlist */
/** /**
* Open writable URL for import playlist in LS Archive format * Open writable URL for import playlist in CC Archive format
* *
* The XML-RPC name of this method is "locstor.importPlaylistOpen". * The XML-RPC name of this method is "locstor.importPlaylistOpen".
* *
@ -1370,7 +1370,7 @@ class XR_LocStor extends LocStor {
} }
/** /**
* Open writable URL for import playlist in LS Archive format * Open writable URL for import playlist in CC Archive format
* *
* The XML-RPC name of this method is "locstor.importPlaylistClose". * The XML-RPC name of this method is "locstor.importPlaylistClose".
* *
@ -2455,8 +2455,7 @@ class XR_LocStor extends LocStor {
" ".$res->getUserInfo() " ".$res->getUserInfo()
); );
} }
# return new XML_RPC_Response(XML_RPC_encode($res)); $xv = new XML_RPC_Value();
$xv = new XML_RPC_Value;
$xv->addStruct(array( $xv->addStruct(array(
'cnt' => XML_RPC_encode($res['cnt']), 'cnt' => XML_RPC_encode($res['cnt']),
'results' => 'results' =>
@ -2570,7 +2569,7 @@ class XR_LocStor extends LocStor {
return $r; return $r;
} }
require_once(dirname(__FILE__).'/../Prefs.php'); require_once(dirname(__FILE__).'/../Prefs.php');
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->loadPref($r['sessid'], $r['key']); $res = $pr->loadPref($r['sessid'], $r['key']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
@ -2623,7 +2622,7 @@ class XR_LocStor extends LocStor {
return $r; return $r;
} }
require_once(dirname(__FILE__).'/../Prefs.php'); require_once(dirname(__FILE__).'/../Prefs.php');
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->savePref($r['sessid'], $r['key'], $r['value']); $res = $pr->savePref($r['sessid'], $r['key'], $r['value']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
@ -2675,7 +2674,7 @@ class XR_LocStor extends LocStor {
return $r; return $r;
} }
require_once(dirname(__FILE__).'/../Prefs.php'); require_once(dirname(__FILE__).'/../Prefs.php');
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->delPref($r['sessid'], $r['key']); $res = $pr->delPref($r['sessid'], $r['key']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
@ -2729,7 +2728,7 @@ class XR_LocStor extends LocStor {
return $r; return $r;
} }
require_once(dirname(__FILE__).'/../Prefs.php'); require_once(dirname(__FILE__).'/../Prefs.php');
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->loadGroupPref($r['sessid'], $r['group'], $r['key']); $res = $pr->loadGroupPref($r['sessid'], $r['group'], $r['key']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
@ -2787,7 +2786,7 @@ class XR_LocStor extends LocStor {
return $r; return $r;
} }
require_once(dirname(__FILE__).'/../Prefs.php'); require_once(dirname(__FILE__).'/../Prefs.php');
$pr = new Prefs($this); $pr = new Prefs();
$res = $pr->saveGroupPref($r['sessid'], $r['group'], $r['key'], $r['value']); $res = $pr->saveGroupPref($r['sessid'], $r['group'], $r['key'], $r['value']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
@ -2966,12 +2965,12 @@ class XR_LocStor extends LocStor {
return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res))); return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res)));
} }
/* ------------------------ methods for ls-archive-format file transports */ /* ------------------------ methods for cc-archive-format file transports */
/** /**
* Open async file transfer from local storageServer to network hub, * Open async file transfer from local storageServer to network hub,
* file should be ls-archive-format file. * file should be cc-archive-format file.
* *
* The XML-RPC name of this method is "locstor.uploadFile2Hub". * The XML-RPC name of this method is "locstor.uploadFileAsync".
* *
* The input parameters are an XML-RPC struct with the following * The input parameters are an XML-RPC struct with the following
* fields: * fields:
@ -2991,7 +2990,7 @@ class XR_LocStor extends LocStor {
* <li> 3 - Incorrect parameters passed to method: * <li> 3 - Incorrect parameters passed to method:
* Wanted ... , got ... at param </li> * Wanted ... , got ... at param </li>
* <li> 801 - wrong 1st parameter, struct expected.</li> * <li> 801 - wrong 1st parameter, struct expected.</li>
* <li> 805 - xr_uploadFile2Hub: * <li> 805 - xr_uploadFileAsync:
* &lt;message from lower layer&gt; </li> * &lt;message from lower layer&gt; </li>
* <li> 848 - invalid session id.</li> * <li> 848 - invalid session id.</li>
* <li> 872 - invalid tranport token.</li> * <li> 872 - invalid tranport token.</li>
@ -2999,9 +2998,9 @@ class XR_LocStor extends LocStor {
* *
* @param XML_RPC_Message $input * @param XML_RPC_Message $input
* @return XML_RPC_Response * @return XML_RPC_Response
* @see Transport::uploadFile2Hub * @see Transport::uploadFileAsync
*/ */
public function xr_uploadFile2Hub($input) public function xr_uploadFileAsync($input)
{ {
list($ok, $r) = XR_LocStor::xr_getParams($input); list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) { if (!$ok) {
@ -3009,13 +3008,12 @@ class XR_LocStor extends LocStor {
} }
require_once('../Transport.php'); require_once('../Transport.php');
$tr = new Transport($this); $tr = new Transport($this);
$res = $tr->uploadFile2Hub($r['filePath']); // local files on XML-RPC :( $res = $tr->uploadFileAsync($r['filePath']);
// there should be something as uploadFile2storageServer
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
$ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 );
return new XML_RPC_Response(0, $ec, return new XML_RPC_Response(0, $ec,
"xr_uploadFile2Hub: ".$res->getMessage()." ".$res->getUserInfo() "xr_uploadFileAsync: ".$res->getMessage()." ".$res->getUserInfo()
); );
} }
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
@ -3134,7 +3132,7 @@ class XR_LocStor extends LocStor {
/** /**
* Start upload of audioclip or playlist from local storageServer to hub * Start upload of audioclip or playlist from local storageServer to hub
* *
* The XML-RPC name of this method is "locstor.upload2Hub". * The XML-RPC name of this method is "locstor.uploadToHub".
* *
* The input parameters are an XML-RPC struct with the following * The input parameters are an XML-RPC struct with the following
* fields: * fields:
@ -3155,7 +3153,7 @@ class XR_LocStor extends LocStor {
* <li> 3 - Incorrect parameters passed to method: * <li> 3 - Incorrect parameters passed to method:
* Wanted ... , got ... at param </li> * Wanted ... , got ... at param </li>
* <li> 801 - wrong 1st parameter, struct expected.</li> * <li> 801 - wrong 1st parameter, struct expected.</li>
* <li> 805 - xr_upload2Hub: * <li> 805 - xr_uploadToHub:
* &lt;message from lower layer&gt; </li> * &lt;message from lower layer&gt; </li>
* <li> 848 - invalid session id.</li> * <li> 848 - invalid session id.</li>
* <li> 872 - invalid tranport token.</li> * <li> 872 - invalid tranport token.</li>
@ -3163,9 +3161,9 @@ class XR_LocStor extends LocStor {
* *
* @param XML_RPC_Message $input * @param XML_RPC_Message $input
* @return XML_RPC_Response * @return XML_RPC_Response
* @see Transport::upload2Hub * @see Transport::uploadToHub
*/ */
public function xr_upload2Hub($input) public function xr_uploadToHub($input)
{ {
list($ok, $r) = XR_LocStor::xr_getParams($input); list($ok, $r) = XR_LocStor::xr_getParams($input);
if (!$ok) { if (!$ok) {
@ -3173,12 +3171,12 @@ class XR_LocStor extends LocStor {
} }
require_once('../Transport.php'); require_once('../Transport.php');
$tr = new Transport($this); $tr = new Transport($this);
$res = $tr->upload2Hub($r['gunid']); $res = $tr->uploadToHub($r['gunid']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
$ec0 = intval($res->getCode()); $ec0 = intval($res->getCode());
$ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 );
return new XML_RPC_Response(0, $ec, return new XML_RPC_Response(0, $ec,
"xr_upload2Hub: ".$res->getMessage()." ".$res->getUserInfo() "xr_uploadToHub: ".$res->getMessage()." ".$res->getUserInfo()
); );
} }
return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res))); return new XML_RPC_Response(XML_RPC_encode(array('trtok'=>$res)));
@ -3248,7 +3246,7 @@ class XR_LocStor extends LocStor {
* fields: * fields:
* <ul> * <ul>
* <li> sessid : string - session id </li> * <li> sessid : string - session id </li>
* <li> criteria : hash, LS criteria format - see searchMetadata method * <li> criteria : hash, CC criteria format - see searchMetadata method
* </li> * </li>
* </ul> * </ul>
* *
@ -3562,7 +3560,7 @@ class XR_LocStor extends LocStor {
if (!$ok) { if (!$ok) {
return $r; return $r;
} }
$res = $this->bsOpenPut(); $res = BasicStor::bsOpenPut();
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return new XML_RPC_Response(0, 805, return new XML_RPC_Response(0, 805,
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
@ -3584,7 +3582,7 @@ class XR_LocStor extends LocStor {
if (!$ok) { if (!$ok) {
return $r; return $r;
} }
$res = $this->bsClosePut($r['token'], $r['chsum']); $res = BasicStor::bsClosePut($r['token'], $r['chsum']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return new XML_RPC_Response(0, 805, return new XML_RPC_Response(0, 805,
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo() "xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()

View file

@ -90,7 +90,7 @@ switch ($ftype) {
readfile($realFname); readfile($realFname);
break; break;
case "webstream": case "webstream":
$url = $locStor->bsGetMetadataValue($lid, 'ls:url'); $url = BasicStor::bsGetMetadataValue($lid, 'ls:url');
if (empty($url)) { if (empty($url)) {
http_error(500, "Unable to get ls:url value"); http_error(500, "Unable to get ls:url value");
} }
@ -99,7 +99,7 @@ switch ($ftype) {
// echo "$txt\n"; // echo "$txt\n";
break; break;
case "playlist"; case "playlist";
// $md = $locStor->bsGetMetadata($ac->getId(), $sessid); // $md = BasicStor::bsGetMetadata($ac->getId(), $sessid);
$md = $locStor->getAudioClip($sessid, $gunid); $md = $locStor->getAudioClip($sessid, $gunid);
// header("Content-type: text/xml"); // header("Content-type: text/xml");
header("Content-type: application/smil"); header("Content-type: application/smil");

View file

@ -65,36 +65,70 @@ $locStor = new XR_LocStor();
$methods = array( $methods = array(
'test' => 'Tests toupper and checks sessid, params: teststring, sessid.', 'test' => 'Tests toupper and checks sessid, params: teststring, sessid.',
'ping' => 'Echo request',
'getVersion' => 'Dummy function for connection testing.', 'getVersion' => 'Dummy function for connection testing.',
'authenticate' => 'Checks authentication.', 'authenticate' => 'Checks authentication.',
'login' => 'Login to storage.', 'login' => 'Login to storage.',
'logout' => 'Logout from storage.', 'logout' => 'Logout from storage.',
// Search functions
'searchMetadata' => 'Search through the metadata of stored'.
' files, return all matching audio clip ids.',
'browseCategory' => 'Return values of specified metadata category.',
'globalSearch' => 'Start search job on remote storage',
'getSearchResults' => 'Get results from search job on remote storage',
// Get files from local storage
'existsAudioClip' => 'Checks if an Audio clip with the specified '. 'existsAudioClip' => 'Checks if an Audio clip with the specified '.
'id is stored in local storage.', 'id is stored in local storage.',
'downloadRawAudioDataOpen' => 'Create and return downloadable URL for audio file',
'downloadRawAudioDataClose' => 'Discard downloadable URL for audio file',
'downloadMetadataOpen' => 'Create and return downloadable URL for metadata',
'downloadMetadataClose' => 'Discard downloadable URL for metadata',
'accessRawAudioData' => 'Get access to raw audio data.',
'releaseRawAudioData' => 'Release access to raw audio data.',
'getAudioClip' => 'Return the contents of an Audio clip.',
// Put files into local storage
'storeAudioClipOpen' => 'Open channel to store a new audio clip '. 'storeAudioClipOpen' => 'Open channel to store a new audio clip '.
'or replace an existing one.', 'or replace an existing one.',
'storeAudioClipClose' => 'Close channel to store a new audio clip'. 'storeAudioClipClose' => 'Close channel to store a new audio clip'.
' or replace an existing one.', ' or replace an existing one.',
'downloadRawAudioDataOpen'=> 'Create and return downloadable URL'. 'storeWebstream' => 'Store audio stream identified by URL',
'for audio file',
'downloadRawAudioDataClose'=>'Discard downloadable URL for audio file',
'downloadMetadataOpen' => 'Create and return downloadable URL'.
'for metadata',
'downloadMetadataClose' => 'Discard downloadable URL for metadata',
'openPut' => 'openPut', 'openPut' => 'openPut',
'closePut' => 'closePut', 'closePut' => 'closePut',
// Modify files in local storage
'deleteAudioClip' => 'Delete an existing Audio clip.', 'deleteAudioClip' => 'Delete an existing Audio clip.',
'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '. 'updateAudioClipMetadata' => 'Update the metadata of an Audio clip '.
'stored in Local storage.', 'stored in Local storage.',
'searchMetadata' => 'Search through the metadata of stored '.
'files, return all matching clip ids.',
'browseCategory' =>'Return values of specified metadata category.',
'accessRawAudioData' => 'Get access to raw audio data.',
'releaseRawAudioData' => 'Release access to raw audio data.',
'getAudioClip' => 'Return the contents of an Audio clip.',
'resetStorage' => 'Reset storageServer for debugging.', 'resetStorage' => 'Reset storageServer for debugging.',
'storeWebstream' => 'Store audio stream identified by URL',
// Functions to get/set status of transfers
'getTransportInfo' => 'Common "check" method and info getter for transports',
'turnOnOffTransports' => 'Turn transports on/off, optionaly return current state',
'doTransportAction' => 'Pause, resume or cancel transport',
'getHubInitiatedTransfers' => 'Get list of prepared transfers initiated by hub',
'listHubInitiatedTransfers' => 'List hub initiated transfers',
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
// Send files to remote storage server
'uploadFileAsync' => 'Open async file transfer from local storage to remote storage',
'uploadToHub' => 'Start upload of audioclip or playlist from local storage to remote storage',
'uploadOpen' => 'Open file-layer upload',
'uploadCheck' => 'Check the checksum of uploaded file',
'uploadClose' => 'Close file-layer upload',
// Get files from a remote storage server and put them into local storage
'startHubInitiatedTransfer' => 'Start of download initiated by remote storage',
'downloadFromHub' => 'Start download of audioclip or playlist from remote to local storage',
'downloadOpen' => 'Open file-layer download',
'downloadClose' => 'Close file-layer download',
'prepareHubInitiatedTransfer' => 'Prepare remote initiated transfer',
// Playlist functions
'createPlaylist' => 'Create a new Playlist metafile.', 'createPlaylist' => 'Create a new Playlist metafile.',
'editPlaylist' => 'Open a Playlist metafile for editing.', 'editPlaylist' => 'Open a Playlist metafile for editing.',
'savePlaylist' => 'Save a Playlist metafile.', 'savePlaylist' => 'Save a Playlist metafile.',
@ -113,50 +147,29 @@ $methods = array(
'renderPlaylistToFileOpen' => 'Render playlist to ogg file (open handle)', 'renderPlaylistToFileOpen' => 'Render playlist to ogg file (open handle)',
'renderPlaylistToFileCheck' => 'Render playlist to ogg file (check results)', 'renderPlaylistToFileCheck' => 'Render playlist to ogg file (check results)',
'renderPlaylistToFileClose' => 'Render playlist to ogg file (close handle)', 'renderPlaylistToFileClose' => 'Render playlist to ogg file (close handle)',
'renderPlaylistToStorageOpen' => 'Render playlist to storage media clip (open handle)', 'renderPlaylistToStorageOpen' => 'Render playlist to storage media clip (open handle)',
'renderPlaylistToStorageCheck' => 'Render playlist to storage media clip (check results)', 'renderPlaylistToStorageCheck' => 'Render playlist to storage media clip (check results)',
'renderPlaylistToRSSOpen' => 'Render playlist to RSS file (open handle)', 'renderPlaylistToRSSOpen' => 'Render playlist to RSS file (open handle)',
'renderPlaylistToRSSCheck' => 'Render playlist to RSS file (check results)', 'renderPlaylistToRSSCheck' => 'Render playlist to RSS file (check results)',
'renderPlaylistToRSSClose' => 'Render playlist to RSS file (close handle)', 'renderPlaylistToRSSClose' => 'Render playlist to RSS file (close handle)',
// Backup functions
'createBackupOpen' => 'Create backup of storage (open handle)', 'createBackupOpen' => 'Create backup of storage (open handle)',
'createBackupCheck' => 'Create backup of storage (check results)', 'createBackupCheck' => 'Create backup of storage (check results)',
'createBackupClose' => 'Create backup of storage (close handle)', 'createBackupClose' => 'Create backup of storage (close handle)',
// Restore functions
'restoreBackupOpen' => 'Restore a backup file (open handle)', 'restoreBackupOpen' => 'Restore a backup file (open handle)',
'restoreBackupClosePut' => 'Restore a backup file (close PUT handle)', 'restoreBackupClosePut' => 'Restore a backup file (close PUT handle)',
'restoreBackupCheck' => 'Restore a backup file (check results)', 'restoreBackupCheck' => 'Restore a backup file (check results)',
'restoreBackupClose' => 'Restore a backup file (close handle)', 'restoreBackupClose' => 'Restore a backup file (close handle)',
// Preferences functions
'loadPref' => 'Load user preference value.', 'loadPref' => 'Load user preference value.',
'savePref' => 'Save user preference value.', 'savePref' => 'Save user preference value.',
'delPref' => 'Delete user preference record.', 'delPref' => 'Delete user preference record.',
'loadGroupPref' => 'Read group preference record.', 'loadGroupPref' => 'Read group preference record.',
'saveGroupPref' => 'Delete user preference record.', 'saveGroupPref' => 'Delete user preference record.',
'getTransportInfo' => 'Common "check" method and info getter for transports',
'turnOnOffTransports' => 'Turn transports on/off, optionaly return current state',
'doTransportAction' => 'Pause, resume or cancel transport',
'uploadFile2Hub' => 'Open async file transfer from local storageServer to network hub',
'getHubInitiatedTransfers' => 'Get list of prepared transfers initiated by hub',
'startHubInitiatedTransfer' => 'Start of download initiated by hub',
'upload2Hub' => 'Start upload of audioclip or playlist from local storageServer to hub',
'downloadFromHub' => 'Start download of audioclip or playlist from hub to local storageServer',
'globalSearch' => 'Start search job on network hub',
'getSearchResults' => 'Get results from search job on network hub',
'uploadOpen' => 'Open file-layer upload',
'uploadCheck' => 'Check the checksum of uploaded file',
'uploadClose' => 'Close file-layer upload',
'downloadOpen' => 'Open file-layer download',
// 'downloadCheck' => 'Check the checksum of downloaded file',
'downloadClose' => 'Close file-layer download',
'prepareHubInitiatedTransfer' => 'Prepare hub initiated transfer',
'listHubInitiatedTransfers' => 'List hub initiated transfers',
'setHubInitiatedTransfer' => 'Set state of hub initiated transfers',
'ping' => 'Echo request',
); );
$defs = array(); $defs = array();

View file

@ -183,13 +183,13 @@ $infos = array(
'p'=>array('sessid', 'onOff'), 'r'=>array('state')), 'p'=>array('sessid', 'onOff'), 'r'=>array('state')),
"doTransportAction" => array('m'=>"locstor.doTransportAction", "doTransportAction" => array('m'=>"locstor.doTransportAction",
'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')), 'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')),
"uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub", "uploadFileAsync" => array('m'=>"locstor.uploadFileAsync",
'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')), 'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')),
"getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers", "getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers",
'p'=>array('sessid'), 'r'=>array()), 'p'=>array('sessid'), 'r'=>array()),
"startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer", "startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer",
'p'=>array('trtok'), 'r'=>array()), 'p'=>array('trtok'), 'r'=>array()),
"upload2Hub" => array('m'=>"locstor.upload2Hub", "uploadToHub" => array('m'=>"locstor.uploadToHub",
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
"downloadFromHub" => array('m'=>"locstor.downloadFromHub", "downloadFromHub" => array('m'=>"locstor.downloadFromHub",
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),

View file

@ -174,13 +174,13 @@ $methodDefs = array(
'p'=>array('sessid', 'onOff'), 'r'=>array('state')), 'p'=>array('sessid', 'onOff'), 'r'=>array('state')),
"doTransportAction" => array('m'=>"locstor.doTransportAction", "doTransportAction" => array('m'=>"locstor.doTransportAction",
'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')), 'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')),
"uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub", "uploadFileAsync" => array('m'=>"locstor.uploadFileAsync",
'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')), 'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')),
"getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers", "getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers",
'p'=>array('sessid'), 'r'=>array()), 'p'=>array('sessid'), 'r'=>array()),
"startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer", "startHubInitiatedTransfer" => array('m'=>"locstor.startHubInitiatedTransfer",
'p'=>array('trtok'), 'r'=>array()), 'p'=>array('trtok'), 'r'=>array()),
"upload2Hub" => array('m'=>"locstor.upload2Hub", "uploadToHub" => array('m'=>"locstor.uploadToHub",
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),
"downloadFromHub" => array('m'=>"locstor.downloadFromHub", "downloadFromHub" => array('m'=>"locstor.downloadFromHub",
'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')), 'p'=>array('sessid', 'gunid'), 'r'=>array('trtok')),