Fix for changing file names to match class names. Changing various function names to be more obvious and consistent. Get rid of unneeded data copying ( = = someFunction()).
This commit is contained in:
parent
b0cbbd4d58
commit
ad9ab95c05
1 changed files with 22 additions and 20 deletions
|
@ -16,13 +16,11 @@ define('GBERR_GUNID', 53);
|
||||||
define('GBERR_BGERR', 54);
|
define('GBERR_BGERR', 54);
|
||||||
define('GBERR_NOTIMPL', 69);
|
define('GBERR_NOTIMPL', 69);
|
||||||
|
|
||||||
require_once(dirname(__FILE__)."/../../alib/var/alib.php");
|
require_once(dirname(__FILE__)."/../../alib/var/Alib.php");
|
||||||
require_once("StoredFile.php");
|
require_once("StoredFile.php");
|
||||||
require_once("Transport.php");
|
require_once("Transport.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BasicStor class
|
|
||||||
*
|
|
||||||
* Core of Campcaster file storage module
|
* Core of Campcaster file storage module
|
||||||
*
|
*
|
||||||
* @author Tomas Hlava <th@red2head.com>
|
* @author Tomas Hlava <th@red2head.com>
|
||||||
|
@ -870,7 +868,7 @@ class BasicStor extends Alib {
|
||||||
if ($this->dbc->isError($ac)) {
|
if ($this->dbc->isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
return $ac->getMetaData();
|
return $ac->getMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -893,10 +891,10 @@ class BasicStor extends Alib {
|
||||||
if (is_null($gunid)) {
|
if (is_null($gunid)) {
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($this, $id);
|
||||||
} else {
|
} else {
|
||||||
$ac = $r = StoredFile::recallByGunid($this, $gunid);
|
$ac = StoredFile::recallByGunid($this, $gunid);
|
||||||
}
|
}
|
||||||
if ($this->dbc->isError($r)) {
|
if ($this->dbc->isError($ac)) {
|
||||||
return $r;
|
return $ac;
|
||||||
}
|
}
|
||||||
$r = $ac->md->getMetadataValue('dc:title', $lang, $deflang);
|
$r = $ac->md->getMetadataValue('dc:title', $lang, $deflang);
|
||||||
if ($this->dbc->isError($r)) {
|
if ($this->dbc->isError($r)) {
|
||||||
|
@ -937,27 +935,31 @@ class BasicStor extends Alib {
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* Virtual file's local id
|
* Virtual file's local id
|
||||||
* @param string|array $category
|
* @param string|array|null $category
|
||||||
* metadata element name, or array of metadata element names
|
* metadata element name, or array of metadata element names,
|
||||||
|
* if null is passed, all metadata values for the given ID will
|
||||||
|
* be fetched.
|
||||||
* @return string|array
|
* @return string|array
|
||||||
* If a string is passed in for $category, a string is returned,
|
* If a string is passed in for $category, a string is returned,
|
||||||
* 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)
|
public function bsGetMetadataValue($id, $category = null)
|
||||||
{
|
{
|
||||||
$ac = StoredFile::recall($this, $id);
|
$ac = StoredFile::recall($this, $id);
|
||||||
if ($this->dbc->isError($ac)) {
|
if ($this->dbc->isError($ac)) {
|
||||||
return $ac;
|
return $ac;
|
||||||
}
|
}
|
||||||
if (!is_array($category)) {
|
if (is_null($category)) {
|
||||||
return $ac->md->getMetadataValue($category);
|
return $ac->md->getAllMetadata();
|
||||||
} else {
|
} elseif (is_array($category)) {
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach ($category as $tmpCat) {
|
foreach ($category as $tmpCat) {
|
||||||
$values[$tmpCat] = $ac->md->getMetadataValue($tmpCat);
|
$values[$tmpCat] = $ac->md->getMetadataValue($tmpCat);
|
||||||
}
|
}
|
||||||
return $values;
|
return $values;
|
||||||
|
} else {
|
||||||
|
return $ac->md->getMetadataValue($category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,8 +1018,8 @@ class BasicStor extends Alib {
|
||||||
{
|
{
|
||||||
if (!preg_match("|^\d{2}:\d{2}:\d{2}.\d{6}$|", $v)) {
|
if (!preg_match("|^\d{2}:\d{2}:\d{2}.\d{6}$|", $v)) {
|
||||||
require_once("Playlist.php");
|
require_once("Playlist.php");
|
||||||
$s = Playlist::_plTimeToSecs($v);
|
$s = Playlist::playlistTimeToSeconds($v);
|
||||||
$t = Playlist::_secsToPlTime($s);
|
$t = Playlist::secondsToPlaylistTime($s);
|
||||||
return $t;
|
return $t;
|
||||||
}
|
}
|
||||||
return $v;
|
return $v;
|
||||||
|
@ -1223,10 +1225,10 @@ class BasicStor extends Alib {
|
||||||
$ac = $r = LsPlaylist::recallByGunid($this, $it['gunid']);
|
$ac = $r = LsPlaylist::recallByGunid($this, $it['gunid']);
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case"smil":
|
case"smil":
|
||||||
$string = $r = $ac->output2Smil();
|
$string = $r = $ac->outputToSmil();
|
||||||
break;
|
break;
|
||||||
case"m3u":
|
case"m3u":
|
||||||
$string = $r = $ac->output2m3u();
|
$string = $r = $ac->outputToM3u();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$string = $r = $ac->md->genXmlDoc();
|
$string = $r = $ac->md->genXmlDoc();
|
||||||
|
@ -1490,9 +1492,9 @@ class BasicStor extends Alib {
|
||||||
unset($listArr[$i]);
|
unset($listArr[$i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$listArr[$i]['type'] = $r = $this->_getType($gunid);
|
$listArr[$i]['type'] = $this->_getType($gunid);
|
||||||
if ($this->dbc->isError($r)) {
|
if ($this->dbc->isError($listArr[$i]['type'])) {
|
||||||
return $r;
|
return $listArr[$i]['type'];
|
||||||
}
|
}
|
||||||
$listArr[$i]['gunid'] = $gunid;
|
$listArr[$i]['gunid'] = $gunid;
|
||||||
if (StoredFIle::_getState($gunid) == 'incomplete') {
|
if (StoredFIle::_getState($gunid) == 'incomplete') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue