Code formatting

This commit is contained in:
paul 2006-12-08 04:33:35 +00:00
parent 55688910d5
commit f98af0ace0

View file

@ -307,6 +307,7 @@ class Transport
*/ */
function upload2Hub($gunid, $withContent=TRUE, $pars=array()) function upload2Hub($gunid, $withContent=TRUE, $pars=array())
{ {
$this->trLog("upload2Hub start: ".strftime("%H:%M:%S"));
switch ($ftype = $this->gb->_getType($gunid)) { switch ($ftype = $this->gb->_getType($gunid)) {
case "audioclip": case "audioclip":
case "webstream": case "webstream":
@ -344,6 +345,7 @@ class Transport
} }
$this->startCronJobProcess($mdtrec->trtok); $this->startCronJobProcess($mdtrec->trtok);
break; break;
case "playlist": case "playlist":
$plid = $gunid; $plid = $gunid;
require_once("Playlist.php"); require_once("Playlist.php");
@ -356,13 +358,17 @@ class Transport
return $fname; return $fname;
} }
if ($withContent) { if ($withContent) {
$this->trLog("upload2Hub exportPlaylistOpen BEGIN: ".strftime("%H:%M:%S"));
$res = $this->gb->bsExportPlaylistOpen($plid); $res = $this->gb->bsExportPlaylistOpen($plid);
$this->trLog("upload2Hub exportPlaylistOpen END: ".strftime("%H:%M:%S"));
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
} }
$tmpn = tempnam($this->transDir, 'plExport_'); $tmpn = tempnam($this->transDir, 'plExport_');
$plfpath = "$tmpn.lspl"; $plfpath = "$tmpn.lspl";
$this->trLog("upload2Hub begin copy: ".strftime("%H:%M:%S"));
copy($res['fname'], $plfpath); copy($res['fname'], $plfpath);
$this->trLog("upload2Hub end copy: ".strftime("%H:%M:%S"));
$res = $this->gb->bsExportPlaylistClose($res['token']); $res = $this->gb->bsExportPlaylistClose($res['token']);
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
return $res; return $res;
@ -377,19 +383,16 @@ class Transport
$trtype = 'playlist'; $trtype = 'playlist';
} }
$trec = $this->_uploadGeneralFileToHub($plfpath, $trtype, $trec = $this->_uploadGeneralFileToHub($plfpath, $trtype,
array_merge(array('gunid'=>$plid,'fname'=>$fname,), $pars) array_merge(array('gunid'=>$plid,'fname'=>$fname,), $pars));
);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
return $trec; return $trec;
} }
break; break;
default: default:
return PEAR::raiseError( return PEAR::raiseError("Transport::upload2Hub: ftype not supported ($ftype)");
"Transport::upload2Hub:".
" ftype not supported ($ftype)"
);
} }
$this->startCronJobProcess($trec->trtok); $this->startCronJobProcess($trec->trtok);
$this->trLog("upload2Hub end: ".strftime("%H:%M:%S"));
return $trec->trtok; return $trec->trtok;
} }
@ -412,22 +415,9 @@ class Transport
*/ */
function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array()) function downloadFromHub($uid, $gunid, $withContent=TRUE, $pars=array())
{ {
# $this->trLog(var_export($gunid, TRUE));
$trtype = ($withContent ? 'playlistPkg' : 'unknown' ); $trtype = ($withContent ? 'playlistPkg' : 'unknown' );
$trec = TransportRecord::create($this, $trtype, 'down', $trec = TransportRecord::create($this, $trtype, 'down',
array_merge(array('gunid'=>$gunid, 'uid'=>$uid), $pars) array_merge(array('gunid'=>$gunid, 'uid'=>$uid), $pars));
/* merged !???
array(
'trtok' => '123456789abcdef2',
),
array(
'trtok' => '123456789abcdef3',
),
array(
'trtok' => '123456789abcdef4',
),
*/
);
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
return $trec; return $trec;
} }
@ -464,7 +454,6 @@ class Transport
return $r; return $r;
} }
$this->logoutFromArchive($r); $this->logoutFromArchive($r);
// ----------
$criteria['resultMode'] = $resultMode; $criteria['resultMode'] = $resultMode;
$localfile = tempnam($this->transDir, 'searchjob_'); $localfile = tempnam($this->transDir, 'searchjob_');
@chmod($localfile, 0660); @chmod($localfile, 0660);
@ -494,7 +483,6 @@ class Transport
if (PEAR::isError($trec)) { if (PEAR::isError($trec)) {
return $trec; return $trec;
} }
//echo"<pre>";print_r($trec);echo "</pre>";
$row = $trec->row; $row = $trec->row;
switch ($st = $trec->getState()) { switch ($st = $trec->getState()) {
case "failed": case "failed":