PL ORM changes, templates
This commit is contained in:
parent
2570698ba7
commit
fcea57f011
|
@ -636,8 +636,10 @@ class GreenBox extends BasicStor {
|
|||
}
|
||||
|
||||
$res = $pl->delAudioClip($pos);
|
||||
if($res === FALSE)
|
||||
return FALSE;
|
||||
|
||||
return $res;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,8 @@ class Playlist {
|
|||
*/
|
||||
public $md;
|
||||
|
||||
private $categories = array("dc:title" => "name", "dc:creator" => "creator", "dc:description" => "description", "dcterms:extent" => "length");
|
||||
//using propel's phpNames.
|
||||
private $categories = array("dc:title" => "DbName", "dc:creator" => "DbCreator", "dc:description" => "DbDescription", "dcterms:extent" => "length");
|
||||
|
||||
|
||||
public function __construct($p_gunid=NULL)
|
||||
|
@ -233,20 +234,19 @@ class Playlist {
|
|||
*/
|
||||
public function isAccessed($id=NULL)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if (is_null($id)) {
|
||||
return ($this->currentlyaccessing > 0);
|
||||
}
|
||||
$sql = "SELECT currentlyAccessing FROM ".$CC_CONFIG['playListTable']
|
||||
." WHERE id='$id'";
|
||||
$ca = $CC_DBC->getOne($sql);
|
||||
if (is_null($ca)) {
|
||||
|
||||
$pl = CcPlaylistQuery::create()->findPK($id);
|
||||
if (is_null($pl)) {
|
||||
return PEAR::raiseError(
|
||||
"StoredPlaylist::isAccessed: invalid id ($id)",
|
||||
GBERR_FOBJNEX
|
||||
);
|
||||
}
|
||||
return ($ca > 0);
|
||||
}
|
||||
|
||||
return ($pl->getDbCurrentlyaccessing() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -325,26 +325,40 @@ class Playlist {
|
|||
* @return array
|
||||
*/
|
||||
public function getContents() {
|
||||
|
||||
/*
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT *
|
||||
FROM cc_playlistcontents C JOIN cc_files F ON C.file_id = F.id
|
||||
WHERE C.playlist_id='{$this->getId()}' ORDER BY C.position";
|
||||
return $CC_DBC->getAll($sql);
|
||||
*/
|
||||
|
||||
$files;
|
||||
|
||||
$rows = CcPlaylistcontentsQuery::create()
|
||||
->joinWith('CcFiles')
|
||||
->orderByDbPosition()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->find();
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$files[] = $row->toArray(BasePeer::TYPE_PHPNAME, true, true);
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
public function getLength() {
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT SUM(cliplength) AS length FROM ".$CC_CONFIG['playListContentsTable']
|
||||
." WHERE playlist_id='{$this->getId()}' group by playlist_id";
|
||||
$res = $CC_DBC->getRow($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$res = CcPlaylistQuery::create()
|
||||
->findPK($this->id)
|
||||
->computeLength();
|
||||
|
||||
if(is_null($res))
|
||||
return '00:00:00.000000';
|
||||
|
||||
return $res['length'];
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -423,6 +437,9 @@ class Playlist {
|
|||
*/
|
||||
public function addAudioClip($ac_id, $p_position=NULL, $p_fadeIn=NULL, $p_fadeOut=NULL, $p_clipLength=NULL, $p_cuein=NULL, $p_cueout=NULL)
|
||||
{
|
||||
|
||||
$_SESSION['debug'] = "in add";
|
||||
|
||||
//get audio clip.
|
||||
$ac = StoredFile::Recall($ac_id);
|
||||
if (is_null($ac) || PEAR::isError($ac)) {
|
||||
|
@ -458,8 +475,6 @@ class Playlist {
|
|||
}
|
||||
$p_clipLength = self::secondsToPlaylistTime($clipLengthS);
|
||||
|
||||
$_SESSION['debug'] = "Playlist id: " .$this->id."</br>";
|
||||
|
||||
$res = $this->insertPlaylistElement($this->id, $ac_id, $p_position, $p_clipLength, $p_cuein, $p_cueout, $p_fadeIn, $p_fadeOut);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
|
@ -483,13 +498,13 @@ class Playlist {
|
|||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->find();
|
||||
->findOne();
|
||||
|
||||
if(is_null($row))
|
||||
return FALSE;
|
||||
|
||||
$row->delete();
|
||||
return TRUE;
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -503,26 +518,14 @@ class Playlist {
|
|||
*/
|
||||
public function moveAudioClip($oldPos, $newPos)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
if($newPos < 0 || $newPos >= $this->getNextPos() || $oldPos < 0 || $oldPos >= $this->getNextPos())
|
||||
return FALSE;
|
||||
|
||||
$oldPos = pg_escape_string($oldPos);
|
||||
$newPos = pg_escape_string($newPos);
|
||||
|
||||
$sql = "SELECT * FROM ".$CC_CONFIG['playListContentsTable']. " WHERE playlist_id='{$this->getId()}' AND position='{$oldPos}'";
|
||||
|
||||
$ac = $CC_DBC->getRow($sql);
|
||||
if (PEAR::isError($ac)) {
|
||||
return $ac;
|
||||
}
|
||||
|
||||
$res = $this->delAudioClip($oldPos);
|
||||
if($res !== TRUE)
|
||||
$row = $this->delAudioClip($oldPos);
|
||||
if($row === FALSE)
|
||||
return FALSE;
|
||||
|
||||
$res = $this->addAudioClip($ac['file_id'], $newPos, $ac['fadein'], $ac['fadeOut'], $ac['cliplength'], $ac['cuein'], $ac['cueout']);
|
||||
$res = $this->addAudioClip($row->getDbFileId(), $newPos, $row->getDbFadein(), $row->getDbFadeout(), $row->getDbCliplength(), $row->getDbCuein(), $row->getDbCueout());
|
||||
if($res !== TRUE)
|
||||
return FALSE;
|
||||
|
||||
|
@ -543,7 +546,6 @@ class Playlist {
|
|||
*/
|
||||
public function changeFadeInfo($pos, $fadeIn, $fadeOut)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$errArray= array();
|
||||
|
||||
if(is_null($pos) || $pos < 0 || $pos >= $this->getNextPos()) {
|
||||
|
@ -551,9 +553,12 @@ class Playlist {
|
|||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = $sql = "SELECT cliplength
|
||||
FROM cc_playlistcontents WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$clipLength = $CC_DBC->getOne($sql);
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->findOne();
|
||||
|
||||
$clipLength = $row->getDbCliplength();
|
||||
|
||||
if(!is_null($fadeIn) && !is_null($fadeOut)) {
|
||||
|
||||
|
@ -566,8 +571,8 @@ class Playlist {
|
|||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadein='{$fadeIn}', fadeout='{$fadeOut}' " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$row->setDbFadein($fadeIn);
|
||||
$row->setDbFadeout($fadeOut);
|
||||
}
|
||||
else if(!is_null($fadeIn)) {
|
||||
|
||||
|
@ -575,9 +580,8 @@ class Playlist {
|
|||
$errArray["error"]="Fade In can't be larger than overall playlength.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadein='{$fadeIn}' " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
else if(!is_null($fadeOut)){
|
||||
|
||||
|
@ -586,14 +590,7 @@ class Playlist {
|
|||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable']. " SET fadeout='{$fadeOut}' " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
}
|
||||
|
||||
$res = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
$errArray["error"] =$res->getMessage();
|
||||
return $errArray;
|
||||
$row->setDbFadeout($fadeOut);
|
||||
}
|
||||
|
||||
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||
|
@ -612,7 +609,6 @@ class Playlist {
|
|||
*/
|
||||
public function changeClipLength($pos, $cueIn, $cueOut)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$errArray= array();
|
||||
|
||||
if(is_null($cueIn) && is_null($cueOut)) {
|
||||
|
@ -624,17 +620,21 @@ class Playlist {
|
|||
$errArray["error"]="Invalid position.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFiles)
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($pos)
|
||||
->findOne();
|
||||
|
||||
$oldCueIn = $row->getDBCuein();
|
||||
$oldCueOut = $row->getDbCueout();
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
$sql = $sql = "SELECT length AS original_length, cuein, cueout, fadein, fadeout
|
||||
FROM cc_playlistcontents C JOIN cc_files F ON C.file_id = F.id
|
||||
WHERE C.playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$res = $CC_DBC->getRow($sql);
|
||||
$file = $row->getCcFiles();
|
||||
$origLength = $file->getDbLength();
|
||||
|
||||
$origLength = $res['original_length'];
|
||||
$oldCueIn = $res['cuein'];
|
||||
$oldCueOut = $res['cueout'];
|
||||
$fadeIn = $res['fadein'];
|
||||
$fadeOut = $res['fadeout'];
|
||||
|
||||
if(!is_null($cueIn) && !is_null($cueOut)){
|
||||
|
||||
|
@ -650,13 +650,10 @@ class Playlist {
|
|||
return $errArray;
|
||||
}
|
||||
|
||||
$cueIn = pg_escape_string($cueIn);
|
||||
$cueOut = pg_escape_string($cueOut);
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||
" SET cuein='{$cueIn}', cueout='{$cueOut}', ".
|
||||
"cliplength=(interval '{$cueOut}' - interval '{$cueIn}') " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength(Playlist::secondsToPlaylistTime(Playlist::playlistTimeToSeconds($cueOut)
|
||||
- Playlist::playlistTimeToSeconds($cueIn)));
|
||||
|
||||
}
|
||||
else if(!is_null($cueIn)) {
|
||||
|
@ -666,11 +663,9 @@ class Playlist {
|
|||
return $errArray;
|
||||
}
|
||||
|
||||
$cueIn = pg_escape_string($cueIn);
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||
" SET cuein='{$cueIn}', cliplength=(interval '{$oldCueOut}' - interval '{$cueIn}') " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength(Playlist::secondsToPlaylistTime(Playlist::playlistTimeToSeconds($oldCueOut)
|
||||
- Playlist::playlistTimeToSeconds($cueIn)));
|
||||
}
|
||||
else if(!is_null($cueOut)) {
|
||||
|
||||
|
@ -688,49 +683,25 @@ class Playlist {
|
|||
return $errArray;
|
||||
}
|
||||
|
||||
$cueOut = pg_escape_string($cueOut);
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||
" SET cueout='{$cueOut}', cliplength=(interval '{$cueOut}' - interval '{$oldCueIn}') " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength(Playlist::secondsToPlaylistTime(Playlist::playlistTimeToSeconds($cueOut)
|
||||
- Playlist::playlistTimeToSeconds($oldCueIn)));
|
||||
}
|
||||
|
||||
$res = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
$errArray["error"] =$res->getMessage();
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT cliplength FROM ".$CC_CONFIG['playListContentsTable']."
|
||||
WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
$cliplength = $CC_DBC->getOne($sql);
|
||||
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
if(Playlist::playlistTimeToSeconds($fadeIn) > Playlist::playlistTimeToSeconds($cliplength)){
|
||||
$fadeIn = $cliplength;
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||
" SET fadein='{$fadeIn}' " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
|
||||
$res = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
$errArray["error"] =$res->getMessage();
|
||||
return $errArray;
|
||||
}
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
if(Playlist::playlistTimeToSeconds($fadeOut) > Playlist::playlistTimeToSeconds($cliplength)){
|
||||
$fadeOut = $cliplength;
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListContentsTable'].
|
||||
" SET fadeout='{$fadeOut}' " .
|
||||
"WHERE playlist_id='{$this->getId()}' AND position='{$pos}'";
|
||||
|
||||
$res = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
$errArray["error"] =$res->getMessage();
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$row->setDbFadein($fadeOut);
|
||||
}
|
||||
|
||||
$row->save();
|
||||
|
||||
return array("cliplength"=>$cliplength, "cueIn"=>$cueIn, "cueOut"=>$cueOut, "length"=>$this->getLength(),
|
||||
"fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
|
||||
|
@ -758,37 +729,25 @@ class Playlist {
|
|||
|
||||
public function getPLMetaData($category)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$cat = $this->categories[$category];
|
||||
|
||||
if($cat === 'length') {
|
||||
return $this->getLength();
|
||||
}
|
||||
|
||||
$sql = "SELECT {$cat} AS mdata FROM ".$CC_CONFIG['playListTable'].
|
||||
" WHERE id='{$this->getId()}'";
|
||||
|
||||
$res = $CC_DBC->getOne($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
$row = CcPlaylistQuery::create()->findPK($this->id);
|
||||
$method = 'get' . $cat;
|
||||
return $row->$method();
|
||||
}
|
||||
|
||||
public function setPLMetaData($category, $value)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$cat = $this->categories[$category];
|
||||
|
||||
$sql = "UPDATE ".$CC_CONFIG['playListTable']. " SET {$cat}='{$value}'" .
|
||||
" WHERE id='{$this->getId()}'";
|
||||
|
||||
$res = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
$row = CcPlaylistQuery::create()->findPK($this->id);
|
||||
$method = 'set' . $cat;
|
||||
$row->$method($value);
|
||||
$row->save();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -803,46 +762,7 @@ class Playlist {
|
|||
*/
|
||||
public function export()
|
||||
{
|
||||
$plGunid = $this->gunid;
|
||||
$arr = $this->md->genPhpArray();
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
$plArr = array('els'=>array());
|
||||
// cycle over playlistElements inside playlist:
|
||||
foreach ($arr['children'] as $i => $plEl) {
|
||||
switch ($plEl['elementname']) {
|
||||
case "playlistElement": // process playlistElement
|
||||
$plElObj = new PlaylistElement($this, $plEl);
|
||||
$plInfo = $plElObj->analyze();
|
||||
$plArr['els'][] = $plInfo;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
$res = array(array('gunid'=>$plGunid, 'type'=>'playlist'));
|
||||
$dd = 0;
|
||||
$found = FALSE;
|
||||
foreach ($plArr['els'] as $el) {
|
||||
extract($el); // acLen, elOffset, acGunid, fadeIn, fadeOut, playlist
|
||||
switch ($el['type']) {
|
||||
case "playlist":
|
||||
$pl = StoredFile::RecallByGunid($acGunid);
|
||||
if (is_null($pl) || PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
$res2 = $pl->export();
|
||||
if (PEAR::isError($res2)) {
|
||||
return $res2;
|
||||
}
|
||||
$res = array_merge($res, $res2);
|
||||
break;
|
||||
default:
|
||||
$res[] = array('gunid'=>$acGunid, 'type'=>$el['type']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -887,51 +807,6 @@ class Playlist {
|
|||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cyclic-recursion checking
|
||||
*
|
||||
* @param string $insGunid
|
||||
* gunid of playlist being inserted
|
||||
* @return boolean
|
||||
* true if recursion is detected
|
||||
*/
|
||||
public function cyclicRecursion($insGunid)
|
||||
{
|
||||
if ($this->gunid == $insGunid) {
|
||||
return TRUE;
|
||||
}
|
||||
$pl = StoredFile::RecallByGunid($insGunid);
|
||||
if (is_null($pl) || PEAR::isError($pl)) {
|
||||
return $pl;
|
||||
}
|
||||
$arr = $pl->md->genPhpArray();
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
$els =& $arr['children'];
|
||||
if (!is_array($els)) {
|
||||
return FALSE;
|
||||
}
|
||||
foreach ($els as $i => $plEl) {
|
||||
if ($plEl['elementname'] != "playlistElement") {
|
||||
continue;
|
||||
}
|
||||
foreach ($plEl['children'] as $j => $elCh) {
|
||||
if ($elCh['elementname'] != "playlist") {
|
||||
continue;
|
||||
}
|
||||
$nextGunid = $elCh['attrs']['id'];
|
||||
$res = $this->cyclicRecursion($nextGunid);
|
||||
if ($res) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export playlist as simplified SMIL XML file.
|
||||
*
|
||||
|
@ -943,25 +818,7 @@ class Playlist {
|
|||
*/
|
||||
public function outputToSmil($toString=TRUE)
|
||||
{
|
||||
$plGunid = $this->gunid;
|
||||
$arr = $this->md->genPhpArray();
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
if ($toString) {
|
||||
$r = PlaylistTagExport::OutputToSmil($this, $arr);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $r;
|
||||
} else {
|
||||
return array(
|
||||
'type' => 'playlist',
|
||||
'gunid' => $plGunid,
|
||||
'src' => PL_URL_RELPATH."$plGunid.smil",
|
||||
'playlength' => $arr['attrs']['playlength'],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -976,26 +833,7 @@ class Playlist {
|
|||
*/
|
||||
public function outputToM3u($toString=TRUE)
|
||||
{
|
||||
$plGunid = $this->gunid;
|
||||
$arr = $this->md->genPhpArray();
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
if ($toString) {
|
||||
$r = PlaylistTagExport::OutputToM3u($this, $arr);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $r;
|
||||
} else {
|
||||
return array(
|
||||
'type' => 'playlist',
|
||||
'gunid' => $plGunid,
|
||||
'uri' => PL_URL_RELPATH."$plGunid.m3u",
|
||||
'playlength' => $arr['attrs']['playlength'],
|
||||
'title' => $arr['attrs']['title'],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1010,56 +848,10 @@ class Playlist {
|
|||
*/
|
||||
public function outputToRss($toString=TRUE)
|
||||
{
|
||||
$plGunid = $this->gunid;
|
||||
$arr = $this->md->genPhpArray();
|
||||
if (PEAR::isError($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
if ($toString) {
|
||||
$r = PlaylistTagExport::OutputToRss($this, $arr);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return $r;
|
||||
} else {
|
||||
return array(
|
||||
'type' => 'playlist',
|
||||
'gunid' => $plGunid,
|
||||
'src' => PL_URL_RELPATH."$plGunid.smil",
|
||||
'playlength' => $arr['attrs']['playlength'],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set values of auxiliary metadata
|
||||
*
|
||||
* @return mixed
|
||||
* true or error object
|
||||
*/
|
||||
private function setAuxMetadata()
|
||||
{
|
||||
// get info about playlist
|
||||
$plInfo = $this->getPlaylistInfo();
|
||||
if (PEAR::isError($plInfo)) {
|
||||
return $plInfo;
|
||||
}
|
||||
extract($plInfo); // 'plLen', 'parid', 'metaParid'
|
||||
// set gunid as id attr in playlist tag:
|
||||
$mid = $this->_getMidOrInsert('id', $parid, $this->gunid, 'A');
|
||||
if (PEAR::isError($mid)) {
|
||||
return $mid;
|
||||
}
|
||||
$r = $this->_setValueOrInsert(
|
||||
$mid, $this->gunid, $parid, 'id', 'A');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get audioClip length and title
|
||||
*
|
||||
|
@ -1098,90 +890,6 @@ class Playlist {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get info about playlist
|
||||
* @param $ac
|
||||
* audio clip from cc_files.
|
||||
*
|
||||
* @return array with fields:
|
||||
* <ul>
|
||||
* <li>plLen string - length of playlist in dcterms:extent format</li>
|
||||
* <li>parid int - metadata record id of playlist container</li>
|
||||
* <li>metaParid int - metadata record id of metadata container</li>
|
||||
* </ul>
|
||||
*/
|
||||
private function getPlaylistInfo($ac)
|
||||
{
|
||||
$parid = $this->getContainer('playlist');
|
||||
if (PEAR::isError($parid)) {
|
||||
return $parid;
|
||||
}
|
||||
// get playlist length and record id:
|
||||
$r = $this->md->getMetadataElement('playlength', $parid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
if (isset($r[0])) {
|
||||
$plLen = $r[0]['value'];
|
||||
} else {
|
||||
$r = $this->md->getMetadataElement('dcterms:extent');
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
if (isset($r[0])) {
|
||||
$plLen = $r[0]['value'];
|
||||
} else {
|
||||
$plLen = '00:00:00.000000';
|
||||
}
|
||||
}
|
||||
// get main playlist container
|
||||
$parid = $this->getContainer('playlist');
|
||||
if (PEAR::isError($parid)) {
|
||||
return $parid;
|
||||
}
|
||||
// get metadata container (optionally insert it)
|
||||
$metaParid = $this->getContainer('metadata', $parid, TRUE);
|
||||
if (PEAR::isError($metaParid)) {
|
||||
return $metaParid;
|
||||
}
|
||||
return compact('plLen', 'parid', 'metaParid');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get container record id, optionally insert new container
|
||||
*
|
||||
* @param string $containerName
|
||||
* @param int $parid
|
||||
* parent record id
|
||||
* @param boolean $insertIfNone - flag if insert may be done
|
||||
* if container wouldn't be found
|
||||
* @return int
|
||||
* metadata record id of container
|
||||
*/
|
||||
private function getContainer($containerName, $parid=NULL, $insertIfNone=FALSE)
|
||||
{
|
||||
$r = $this->md->getMetadataElement($containerName, $parid);
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
$id = $r[0]['mid'];
|
||||
if (!is_null($id)) {
|
||||
return $id;
|
||||
}
|
||||
if (!$insertIfNone || is_null($parid)) {
|
||||
return PEAR::raiseError(
|
||||
"Playlist::getContainer: can't find container ($containerName)"
|
||||
);
|
||||
}
|
||||
$id = $this->md->insertMetadataElement($parid, $containerName);
|
||||
if (PEAR::isError($id)) {
|
||||
return $id;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert a new playlist element.
|
||||
*
|
||||
|
|
|
@ -29,4 +29,20 @@ class CcPlaylist extends BaseCcPlaylist {
|
|||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
public function computeLength()
|
||||
{
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
$sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length'
|
||||
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
|
||||
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p1', $this->getDbId());
|
||||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
|
||||
} // CcPlaylist
|
||||
|
|
|
@ -53,7 +53,7 @@ class CcFilesTableMap extends TableMap {
|
|||
$this->addColumn('BIT_RATE', 'BitRate', 'VARCHAR', false, 32, null);
|
||||
$this->addColumn('SAMPLE_RATE', 'SampleRate', 'VARCHAR', false, 32, null);
|
||||
$this->addColumn('FORMAT', 'Format', 'VARCHAR', false, 128, null);
|
||||
$this->addColumn('LENGTH', 'Length', 'TIME', false, null, null);
|
||||
$this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null);
|
||||
$this->addColumn('ALBUM_TITLE', 'AlbumTitle', 'VARCHAR', false, 512, null);
|
||||
$this->addColumn('GENRE', 'Genre', 'VARCHAR', false, 64, null);
|
||||
$this->addColumn('COMMENTS', 'Comments', 'LONGVARCHAR', false, null, null);
|
||||
|
|
|
@ -578,7 +578,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getLength($format = '%X')
|
||||
public function getDbLength($format = '%X')
|
||||
{
|
||||
if ($this->length === null) {
|
||||
return null;
|
||||
|
@ -1312,7 +1312,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
* be treated as NULL for temporal objects.
|
||||
* @return CcFiles The current object (for fluent API support)
|
||||
*/
|
||||
public function setLength($v)
|
||||
public function setDbLength($v)
|
||||
{
|
||||
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
|
||||
// -- which is unexpected, to say the least.
|
||||
|
@ -1352,7 +1352,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
} // if either are not null
|
||||
|
||||
return $this;
|
||||
} // setLength()
|
||||
} // setDbLength()
|
||||
|
||||
/**
|
||||
* Set the value of [album_title] column.
|
||||
|
@ -2598,7 +2598,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return $this->getFormat();
|
||||
break;
|
||||
case 15:
|
||||
return $this->getLength();
|
||||
return $this->getDbLength();
|
||||
break;
|
||||
case 16:
|
||||
return $this->getAlbumTitle();
|
||||
|
@ -2750,7 +2750,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$keys[12] => $this->getBitRate(),
|
||||
$keys[13] => $this->getSampleRate(),
|
||||
$keys[14] => $this->getFormat(),
|
||||
$keys[15] => $this->getLength(),
|
||||
$keys[15] => $this->getDbLength(),
|
||||
$keys[16] => $this->getAlbumTitle(),
|
||||
$keys[17] => $this->getGenre(),
|
||||
$keys[18] => $this->getComments(),
|
||||
|
@ -2870,7 +2870,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->setFormat($value);
|
||||
break;
|
||||
case 15:
|
||||
$this->setLength($value);
|
||||
$this->setDbLength($value);
|
||||
break;
|
||||
case 16:
|
||||
$this->setAlbumTitle($value);
|
||||
|
@ -3022,7 +3022,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
if (array_key_exists($keys[12], $arr)) $this->setBitRate($arr[$keys[12]]);
|
||||
if (array_key_exists($keys[13], $arr)) $this->setSampleRate($arr[$keys[13]]);
|
||||
if (array_key_exists($keys[14], $arr)) $this->setFormat($arr[$keys[14]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setLength($arr[$keys[15]]);
|
||||
if (array_key_exists($keys[15], $arr)) $this->setDbLength($arr[$keys[15]]);
|
||||
if (array_key_exists($keys[16], $arr)) $this->setAlbumTitle($arr[$keys[16]]);
|
||||
if (array_key_exists($keys[17], $arr)) $this->setGenre($arr[$keys[17]]);
|
||||
if (array_key_exists($keys[18], $arr)) $this->setComments($arr[$keys[18]]);
|
||||
|
@ -3199,7 +3199,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$copyObj->setBitRate($this->bit_rate);
|
||||
$copyObj->setSampleRate($this->sample_rate);
|
||||
$copyObj->setFormat($this->format);
|
||||
$copyObj->setLength($this->length);
|
||||
$copyObj->setDbLength($this->length);
|
||||
$copyObj->setAlbumTitle($this->album_title);
|
||||
$copyObj->setGenre($this->genre);
|
||||
$copyObj->setComments($this->comments);
|
||||
|
|
|
@ -206,8 +206,8 @@ abstract class BaseCcFilesPeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Gunid', 'Name', 'Mime', 'Ftype', 'State', 'Currentlyaccessing', 'Editedby', 'Mtime', 'Md5', 'TrackTitle', 'ArtistName', 'BitRate', 'SampleRate', 'Format', 'Length', 'AlbumTitle', 'Genre', 'Comments', 'Year', 'TrackNumber', 'Channels', 'Url', 'Bpm', 'Rating', 'EncodedBy', 'DiscNumber', 'Mood', 'Label', 'Composer', 'Encoder', 'Checksum', 'Lyrics', 'Orchestra', 'Conductor', 'Lyricist', 'OriginalLyricist', 'RadioStationName', 'InfoUrl', 'ArtistUrl', 'AudioSourceUrl', 'RadioStationUrl', 'BuyThisUrl', 'IsrcNumber', 'CatalogNumber', 'OriginalArtist', 'Copyright', 'ReportDatetime', 'ReportLocation', 'ReportOrganization', 'Subject', 'Contributor', 'Language', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'trackTitle', 'artistName', 'bitRate', 'sampleRate', 'format', 'length', 'albumTitle', 'genre', 'comments', 'year', 'trackNumber', 'channels', 'url', 'bpm', 'rating', 'encodedBy', 'discNumber', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'originalLyricist', 'radioStationName', 'infoUrl', 'artistUrl', 'audioSourceUrl', 'radioStationUrl', 'buyThisUrl', 'isrcNumber', 'catalogNumber', 'originalArtist', 'copyright', 'reportDatetime', 'reportLocation', 'reportOrganization', 'subject', 'contributor', 'language', ),
|
||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Gunid', 'Name', 'Mime', 'Ftype', 'State', 'Currentlyaccessing', 'Editedby', 'Mtime', 'Md5', 'TrackTitle', 'ArtistName', 'BitRate', 'SampleRate', 'Format', 'DbLength', 'AlbumTitle', 'Genre', 'Comments', 'Year', 'TrackNumber', 'Channels', 'Url', 'Bpm', 'Rating', 'EncodedBy', 'DiscNumber', 'Mood', 'Label', 'Composer', 'Encoder', 'Checksum', 'Lyrics', 'Orchestra', 'Conductor', 'Lyricist', 'OriginalLyricist', 'RadioStationName', 'InfoUrl', 'ArtistUrl', 'AudioSourceUrl', 'RadioStationUrl', 'BuyThisUrl', 'IsrcNumber', 'CatalogNumber', 'OriginalArtist', 'Copyright', 'ReportDatetime', 'ReportLocation', 'ReportOrganization', 'Subject', 'Contributor', 'Language', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'trackTitle', 'artistName', 'bitRate', 'sampleRate', 'format', 'dbLength', 'albumTitle', 'genre', 'comments', 'year', 'trackNumber', 'channels', 'url', 'bpm', 'rating', 'encodedBy', 'discNumber', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'originalLyricist', 'radioStationName', 'infoUrl', 'artistUrl', 'audioSourceUrl', 'radioStationUrl', 'buyThisUrl', 'isrcNumber', 'catalogNumber', 'originalArtist', 'copyright', 'reportDatetime', 'reportLocation', 'reportOrganization', 'subject', 'contributor', 'language', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::NAME, self::MIME, self::FTYPE, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'NAME', 'MIME', 'FTYPE', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'MD5', 'TRACK_TITLE', 'ARTIST_NAME', 'BIT_RATE', 'SAMPLE_RATE', 'FORMAT', 'LENGTH', 'ALBUM_TITLE', 'GENRE', 'COMMENTS', 'YEAR', 'TRACK_NUMBER', 'CHANNELS', 'URL', 'BPM', 'RATING', 'ENCODED_BY', 'DISC_NUMBER', 'MOOD', 'LABEL', 'COMPOSER', 'ENCODER', 'CHECKSUM', 'LYRICS', 'ORCHESTRA', 'CONDUCTOR', 'LYRICIST', 'ORIGINAL_LYRICIST', 'RADIO_STATION_NAME', 'INFO_URL', 'ARTIST_URL', 'AUDIO_SOURCE_URL', 'RADIO_STATION_URL', 'BUY_THIS_URL', 'ISRC_NUMBER', 'CATALOG_NUMBER', 'ORIGINAL_ARTIST', 'COPYRIGHT', 'REPORT_DATETIME', 'REPORT_LOCATION', 'REPORT_ORGANIZATION', 'SUBJECT', 'CONTRIBUTOR', 'LANGUAGE', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'md5', 'track_title', 'artist_name', 'bit_rate', 'sample_rate', 'format', 'length', 'album_title', 'genre', 'comments', 'year', 'track_number', 'channels', 'url', 'bpm', 'rating', 'encoded_by', 'disc_number', 'mood', 'label', 'composer', 'encoder', 'checksum', 'lyrics', 'orchestra', 'conductor', 'lyricist', 'original_lyricist', 'radio_station_name', 'info_url', 'artist_url', 'audio_source_url', 'radio_station_url', 'buy_this_url', 'isrc_number', 'catalog_number', 'original_artist', 'copyright', 'report_datetime', 'report_location', 'report_organization', 'subject', 'contributor', 'language', ),
|
||||
|
@ -221,8 +221,8 @@ abstract class BaseCcFilesPeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Gunid' => 1, 'Name' => 2, 'Mime' => 3, 'Ftype' => 4, 'State' => 5, 'Currentlyaccessing' => 6, 'Editedby' => 7, 'Mtime' => 8, 'Md5' => 9, 'TrackTitle' => 10, 'ArtistName' => 11, 'BitRate' => 12, 'SampleRate' => 13, 'Format' => 14, 'Length' => 15, 'AlbumTitle' => 16, 'Genre' => 17, 'Comments' => 18, 'Year' => 19, 'TrackNumber' => 20, 'Channels' => 21, 'Url' => 22, 'Bpm' => 23, 'Rating' => 24, 'EncodedBy' => 25, 'DiscNumber' => 26, 'Mood' => 27, 'Label' => 28, 'Composer' => 29, 'Encoder' => 30, 'Checksum' => 31, 'Lyrics' => 32, 'Orchestra' => 33, 'Conductor' => 34, 'Lyricist' => 35, 'OriginalLyricist' => 36, 'RadioStationName' => 37, 'InfoUrl' => 38, 'ArtistUrl' => 39, 'AudioSourceUrl' => 40, 'RadioStationUrl' => 41, 'BuyThisUrl' => 42, 'IsrcNumber' => 43, 'CatalogNumber' => 44, 'OriginalArtist' => 45, 'Copyright' => 46, 'ReportDatetime' => 47, 'ReportLocation' => 48, 'ReportOrganization' => 49, 'Subject' => 50, 'Contributor' => 51, 'Language' => 52, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'state' => 5, 'currentlyaccessing' => 6, 'editedby' => 7, 'mtime' => 8, 'md5' => 9, 'trackTitle' => 10, 'artistName' => 11, 'bitRate' => 12, 'sampleRate' => 13, 'format' => 14, 'length' => 15, 'albumTitle' => 16, 'genre' => 17, 'comments' => 18, 'year' => 19, 'trackNumber' => 20, 'channels' => 21, 'url' => 22, 'bpm' => 23, 'rating' => 24, 'encodedBy' => 25, 'discNumber' => 26, 'mood' => 27, 'label' => 28, 'composer' => 29, 'encoder' => 30, 'checksum' => 31, 'lyrics' => 32, 'orchestra' => 33, 'conductor' => 34, 'lyricist' => 35, 'originalLyricist' => 36, 'radioStationName' => 37, 'infoUrl' => 38, 'artistUrl' => 39, 'audioSourceUrl' => 40, 'radioStationUrl' => 41, 'buyThisUrl' => 42, 'isrcNumber' => 43, 'catalogNumber' => 44, 'originalArtist' => 45, 'copyright' => 46, 'reportDatetime' => 47, 'reportLocation' => 48, 'reportOrganization' => 49, 'subject' => 50, 'contributor' => 51, 'language' => 52, ),
|
||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Gunid' => 1, 'Name' => 2, 'Mime' => 3, 'Ftype' => 4, 'State' => 5, 'Currentlyaccessing' => 6, 'Editedby' => 7, 'Mtime' => 8, 'Md5' => 9, 'TrackTitle' => 10, 'ArtistName' => 11, 'BitRate' => 12, 'SampleRate' => 13, 'Format' => 14, 'DbLength' => 15, 'AlbumTitle' => 16, 'Genre' => 17, 'Comments' => 18, 'Year' => 19, 'TrackNumber' => 20, 'Channels' => 21, 'Url' => 22, 'Bpm' => 23, 'Rating' => 24, 'EncodedBy' => 25, 'DiscNumber' => 26, 'Mood' => 27, 'Label' => 28, 'Composer' => 29, 'Encoder' => 30, 'Checksum' => 31, 'Lyrics' => 32, 'Orchestra' => 33, 'Conductor' => 34, 'Lyricist' => 35, 'OriginalLyricist' => 36, 'RadioStationName' => 37, 'InfoUrl' => 38, 'ArtistUrl' => 39, 'AudioSourceUrl' => 40, 'RadioStationUrl' => 41, 'BuyThisUrl' => 42, 'IsrcNumber' => 43, 'CatalogNumber' => 44, 'OriginalArtist' => 45, 'Copyright' => 46, 'ReportDatetime' => 47, 'ReportLocation' => 48, 'ReportOrganization' => 49, 'Subject' => 50, 'Contributor' => 51, 'Language' => 52, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'state' => 5, 'currentlyaccessing' => 6, 'editedby' => 7, 'mtime' => 8, 'md5' => 9, 'trackTitle' => 10, 'artistName' => 11, 'bitRate' => 12, 'sampleRate' => 13, 'format' => 14, 'dbLength' => 15, 'albumTitle' => 16, 'genre' => 17, 'comments' => 18, 'year' => 19, 'trackNumber' => 20, 'channels' => 21, 'url' => 22, 'bpm' => 23, 'rating' => 24, 'encodedBy' => 25, 'discNumber' => 26, 'mood' => 27, 'label' => 28, 'composer' => 29, 'encoder' => 30, 'checksum' => 31, 'lyrics' => 32, 'orchestra' => 33, 'conductor' => 34, 'lyricist' => 35, 'originalLyricist' => 36, 'radioStationName' => 37, 'infoUrl' => 38, 'artistUrl' => 39, 'audioSourceUrl' => 40, 'radioStationUrl' => 41, 'buyThisUrl' => 42, 'isrcNumber' => 43, 'catalogNumber' => 44, 'originalArtist' => 45, 'copyright' => 46, 'reportDatetime' => 47, 'reportLocation' => 48, 'reportOrganization' => 49, 'subject' => 50, 'contributor' => 51, 'language' => 52, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::GUNID => 1, self::NAME => 2, self::MIME => 3, self::FTYPE => 4, self::STATE => 5, self::CURRENTLYACCESSING => 6, self::EDITEDBY => 7, self::MTIME => 8, self::MD5 => 9, self::TRACK_TITLE => 10, self::ARTIST_NAME => 11, self::BIT_RATE => 12, self::SAMPLE_RATE => 13, self::FORMAT => 14, self::LENGTH => 15, self::ALBUM_TITLE => 16, self::GENRE => 17, self::COMMENTS => 18, self::YEAR => 19, self::TRACK_NUMBER => 20, self::CHANNELS => 21, self::URL => 22, self::BPM => 23, self::RATING => 24, self::ENCODED_BY => 25, self::DISC_NUMBER => 26, self::MOOD => 27, self::LABEL => 28, self::COMPOSER => 29, self::ENCODER => 30, self::CHECKSUM => 31, self::LYRICS => 32, self::ORCHESTRA => 33, self::CONDUCTOR => 34, self::LYRICIST => 35, self::ORIGINAL_LYRICIST => 36, self::RADIO_STATION_NAME => 37, self::INFO_URL => 38, self::ARTIST_URL => 39, self::AUDIO_SOURCE_URL => 40, self::RADIO_STATION_URL => 41, self::BUY_THIS_URL => 42, self::ISRC_NUMBER => 43, self::CATALOG_NUMBER => 44, self::ORIGINAL_ARTIST => 45, self::COPYRIGHT => 46, self::REPORT_DATETIME => 47, self::REPORT_LOCATION => 48, self::REPORT_ORGANIZATION => 49, self::SUBJECT => 50, self::CONTRIBUTOR => 51, self::LANGUAGE => 52, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'NAME' => 2, 'MIME' => 3, 'FTYPE' => 4, 'STATE' => 5, 'CURRENTLYACCESSING' => 6, 'EDITEDBY' => 7, 'MTIME' => 8, 'MD5' => 9, 'TRACK_TITLE' => 10, 'ARTIST_NAME' => 11, 'BIT_RATE' => 12, 'SAMPLE_RATE' => 13, 'FORMAT' => 14, 'LENGTH' => 15, 'ALBUM_TITLE' => 16, 'GENRE' => 17, 'COMMENTS' => 18, 'YEAR' => 19, 'TRACK_NUMBER' => 20, 'CHANNELS' => 21, 'URL' => 22, 'BPM' => 23, 'RATING' => 24, 'ENCODED_BY' => 25, 'DISC_NUMBER' => 26, 'MOOD' => 27, 'LABEL' => 28, 'COMPOSER' => 29, 'ENCODER' => 30, 'CHECKSUM' => 31, 'LYRICS' => 32, 'ORCHESTRA' => 33, 'CONDUCTOR' => 34, 'LYRICIST' => 35, 'ORIGINAL_LYRICIST' => 36, 'RADIO_STATION_NAME' => 37, 'INFO_URL' => 38, 'ARTIST_URL' => 39, 'AUDIO_SOURCE_URL' => 40, 'RADIO_STATION_URL' => 41, 'BUY_THIS_URL' => 42, 'ISRC_NUMBER' => 43, 'CATALOG_NUMBER' => 44, 'ORIGINAL_ARTIST' => 45, 'COPYRIGHT' => 46, 'REPORT_DATETIME' => 47, 'REPORT_LOCATION' => 48, 'REPORT_ORGANIZATION' => 49, 'SUBJECT' => 50, 'CONTRIBUTOR' => 51, 'LANGUAGE' => 52, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'state' => 5, 'currentlyaccessing' => 6, 'editedby' => 7, 'mtime' => 8, 'md5' => 9, 'track_title' => 10, 'artist_name' => 11, 'bit_rate' => 12, 'sample_rate' => 13, 'format' => 14, 'length' => 15, 'album_title' => 16, 'genre' => 17, 'comments' => 18, 'year' => 19, 'track_number' => 20, 'channels' => 21, 'url' => 22, 'bpm' => 23, 'rating' => 24, 'encoded_by' => 25, 'disc_number' => 26, 'mood' => 27, 'label' => 28, 'composer' => 29, 'encoder' => 30, 'checksum' => 31, 'lyrics' => 32, 'orchestra' => 33, 'conductor' => 34, 'lyricist' => 35, 'original_lyricist' => 36, 'radio_station_name' => 37, 'info_url' => 38, 'artist_url' => 39, 'audio_source_url' => 40, 'radio_station_url' => 41, 'buy_this_url' => 42, 'isrc_number' => 43, 'catalog_number' => 44, 'original_artist' => 45, 'copyright' => 46, 'report_datetime' => 47, 'report_location' => 48, 'report_organization' => 49, 'subject' => 50, 'contributor' => 51, 'language' => 52, ),
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* @method CcFilesQuery orderByBitRate($order = Criteria::ASC) Order by the bit_rate column
|
||||
* @method CcFilesQuery orderBySampleRate($order = Criteria::ASC) Order by the sample_rate column
|
||||
* @method CcFilesQuery orderByFormat($order = Criteria::ASC) Order by the format column
|
||||
* @method CcFilesQuery orderByLength($order = Criteria::ASC) Order by the length column
|
||||
* @method CcFilesQuery orderByDbLength($order = Criteria::ASC) Order by the length column
|
||||
* @method CcFilesQuery orderByAlbumTitle($order = Criteria::ASC) Order by the album_title column
|
||||
* @method CcFilesQuery orderByGenre($order = Criteria::ASC) Order by the genre column
|
||||
* @method CcFilesQuery orderByComments($order = Criteria::ASC) Order by the comments column
|
||||
|
@ -75,7 +75,7 @@
|
|||
* @method CcFilesQuery groupByBitRate() Group by the bit_rate column
|
||||
* @method CcFilesQuery groupBySampleRate() Group by the sample_rate column
|
||||
* @method CcFilesQuery groupByFormat() Group by the format column
|
||||
* @method CcFilesQuery groupByLength() Group by the length column
|
||||
* @method CcFilesQuery groupByDbLength() Group by the length column
|
||||
* @method CcFilesQuery groupByAlbumTitle() Group by the album_title column
|
||||
* @method CcFilesQuery groupByGenre() Group by the genre column
|
||||
* @method CcFilesQuery groupByComments() Group by the comments column
|
||||
|
@ -144,7 +144,7 @@
|
|||
* @method CcFiles findOneByBitRate(string $bit_rate) Return the first CcFiles filtered by the bit_rate column
|
||||
* @method CcFiles findOneBySampleRate(string $sample_rate) Return the first CcFiles filtered by the sample_rate column
|
||||
* @method CcFiles findOneByFormat(string $format) Return the first CcFiles filtered by the format column
|
||||
* @method CcFiles findOneByLength(string $length) Return the first CcFiles filtered by the length column
|
||||
* @method CcFiles findOneByDbLength(string $length) Return the first CcFiles filtered by the length column
|
||||
* @method CcFiles findOneByAlbumTitle(string $album_title) Return the first CcFiles filtered by the album_title column
|
||||
* @method CcFiles findOneByGenre(string $genre) Return the first CcFiles filtered by the genre column
|
||||
* @method CcFiles findOneByComments(string $comments) Return the first CcFiles filtered by the comments column
|
||||
|
@ -198,7 +198,7 @@
|
|||
* @method array findByBitRate(string $bit_rate) Return CcFiles objects filtered by the bit_rate column
|
||||
* @method array findBySampleRate(string $sample_rate) Return CcFiles objects filtered by the sample_rate column
|
||||
* @method array findByFormat(string $format) Return CcFiles objects filtered by the format column
|
||||
* @method array findByLength(string $length) Return CcFiles objects filtered by the length column
|
||||
* @method array findByDbLength(string $length) Return CcFiles objects filtered by the length column
|
||||
* @method array findByAlbumTitle(string $album_title) Return CcFiles objects filtered by the album_title column
|
||||
* @method array findByGenre(string $genre) Return CcFiles objects filtered by the genre column
|
||||
* @method array findByComments(string $comments) Return CcFiles objects filtered by the comments column
|
||||
|
@ -709,22 +709,22 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
|||
/**
|
||||
* Filter the query on the length column
|
||||
*
|
||||
* @param string|array $length The value to use as filter.
|
||||
* @param string|array $dbLength The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcFilesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLength($length = null, $comparison = null)
|
||||
public function filterByDbLength($dbLength = null, $comparison = null)
|
||||
{
|
||||
if (is_array($length)) {
|
||||
if (is_array($dbLength)) {
|
||||
$useMinMax = false;
|
||||
if (isset($length['min'])) {
|
||||
$this->addUsingAlias(CcFilesPeer::LENGTH, $length['min'], Criteria::GREATER_EQUAL);
|
||||
if (isset($dbLength['min'])) {
|
||||
$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($length['max'])) {
|
||||
$this->addUsingAlias(CcFilesPeer::LENGTH, $length['max'], Criteria::LESS_EQUAL);
|
||||
if (isset($dbLength['max'])) {
|
||||
$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
|
@ -734,7 +734,7 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
|||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcFilesPeer::LENGTH, $length, $comparison);
|
||||
return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<column name="bit_rate" phpName="BitRate" type="VARCHAR" size="32" required="false"/>
|
||||
<column name="sample_rate" phpName="SampleRate" type="VARCHAR" size="32" required="false"/>
|
||||
<column name="format" phpName="Format" type="VARCHAR" size="128" required="false"/>
|
||||
<column name="length" phpName="Length" type="TIME" required="false"/>
|
||||
<column name="length" phpName="DbLength" type="TIME" required="false"/>
|
||||
<column name="album_title" phpName="AlbumTitle" type="VARCHAR" size="512" required="false"/>
|
||||
<column name="genre" phpName="Genre" type="VARCHAR" size="64" required="false"/>
|
||||
<column name="comments" phpName="Comments" type="LONGVARCHAR" required="false"/>
|
||||
|
|
|
@ -3,6 +3,13 @@
|
|||
$path = dirname(__FILE__).'/../../3rd_party/php/pear';
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
|
||||
|
||||
require_once(dirname(__FILE__).'/../../3rd_party/php/propel/runtime/lib/Propel.php');
|
||||
// Initialize Propel with the runtime configuration
|
||||
Propel::init(dirname(__FILE__)."/../../backend/propel-db/build/conf/campcaster-conf.php");
|
||||
|
||||
// Add the generated 'classes' directory to the include path
|
||||
set_include_path(dirname(__FILE__)."/../../backend/propel-db/build/classes" . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
//require_once(dirname(__FILE__).'/../../conf.php');
|
||||
require_once('DB.php');
|
||||
require_once('PHPUnit.php');
|
||||
|
@ -33,6 +40,7 @@ class PlayListTests extends PHPUnit_TestCase {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
function testGBCreatePlaylist() {
|
||||
|
||||
$pl = new Playlist();
|
||||
|
@ -72,6 +80,7 @@ class PlayListTests extends PHPUnit_TestCase {
|
|||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function testGBSetPLMetaData() {
|
||||
$pl = new Playlist();
|
||||
|
@ -85,7 +94,7 @@ class PlayListTests extends PHPUnit_TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
function testGBGetPLMetaData() {
|
||||
$pl = new Playlist();
|
||||
$name = "Testing";
|
||||
|
@ -111,6 +120,7 @@ class PlayListTests extends PHPUnit_TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function testMoveAudioClip() {
|
||||
$pl = new Playlist();
|
||||
$pl_id = $pl->create("Move");
|
||||
|
@ -126,6 +136,8 @@ class PlayListTests extends PHPUnit_TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function testDeleteAudioClip() {
|
||||
$pl = new Playlist();
|
||||
$pl_id = $pl->create("Delete");
|
||||
|
|
|
@ -19,29 +19,29 @@
|
|||
<ul id="pl_sortable">
|
||||
{foreach from=$PL->getActiveArr($PL->activeId) key='pos' item='i'}
|
||||
<li class="pl_row" id="pl_{$pos}">
|
||||
<div class="pl_fade_in"><span>Fade in: </span><span class="pl_time">{$i.fadein}</span></div>
|
||||
<div class="pl_fade_in"><span>Fade in: </span><span class="pl_time">{$i.DbFadein}</span></div>
|
||||
<span class="pl_input">
|
||||
<input type="checkbox" class="checkbox" name="{$pos}"/>
|
||||
</span>
|
||||
<span class="pl_title">
|
||||
{$i.track_title}
|
||||
{$i.CcFiles.TrackTitle}
|
||||
</span>
|
||||
<span class="pl_artist">
|
||||
{$i.artist_name}
|
||||
{$i.CcFiles.ArtistName}
|
||||
</span>
|
||||
<span class="pl_length" >
|
||||
{$i.length}
|
||||
{$i.CcFiles.DbLength}
|
||||
</span>
|
||||
<span class="pl_cue_in pl_time">
|
||||
{$i.cuein}
|
||||
{$i.DbCuein}
|
||||
</span>
|
||||
<span class="pl_cue_out pl_time">
|
||||
{$i.cueout}
|
||||
{$i.DbCueout}
|
||||
</span>
|
||||
<span class="pl_playlength">
|
||||
{$i.cliplength}
|
||||
{$i.DbCliplength}
|
||||
</span>
|
||||
<div class="pl_fade_out"><span>Fade out: </span><span class="pl_time">{$i.fadeout}</span></div>
|
||||
<div class="pl_fade_out"><span>Fade out: </span><span class="pl_time">{$i.DbFadeout}</span></div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
{foreach from=$PL->getActiveArr($PL->activeId) key='pos' item='i'}
|
||||
<li class="pl_row" id="spl_{$pos}">
|
||||
<span class="spl_input"><input type="checkbox" class="checkbox" name="{$pos}"/></span>
|
||||
<span class="spl_title">{$i.track_title|truncate:12:"...":true}</span>
|
||||
<span class="spl_artist">{$i.artist_name|truncate:12:"...":true}</span>
|
||||
<span>{niceTime in=$i.cliplength}</span>
|
||||
<span class="spl_title">{$i.CcFiles.TrackTitle|truncate:12:"...":true}</span>
|
||||
<span class="spl_artist">{$i.CcFiles.ArtistName|truncate:12:"...":true}</span>
|
||||
<span>{niceTime in=$i.DbCliplength}</span>
|
||||
</li>
|
||||
{/foreach}
|
||||
|
||||
|
|
Loading…
Reference in New Issue