Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
denise 2012-07-27 14:32:39 -04:00
commit 2083d04107
13 changed files with 311 additions and 156 deletions

View File

@ -98,27 +98,39 @@ class AudiopreviewController extends Zend_Controller_Action
$pl = new Application_Model_Playlist($playlistID);
$result = Array();
foreach ($pl->getContents(true) as $track) {
$elementMap = array( 'element_title' => isset($track['track_title'])?$track['track_title']:"",
'element_artist' => isset($track['artist_name'])?$track['artist_name']:"",
'element_id' => isset($track['id'])?$track['id']:"",
'element_position' => isset($track['position'])?$track['position']:"",
);
$fileExtension = pathinfo($track['path'], PATHINFO_EXTENSION);
if (strtolower($fileExtension) === 'mp3') {
$elementMap['element_mp3'] = $track['item_id'];
} else if (strtolower($fileExtension) === 'ogg') {
$elementMap['element_oga'] = $track['item_id'];
} else {
//the media was neither mp3 or ogg
foreach ($pl->getContents(true) as $ele) {
if ($ele['type'] == 2) {
// if element is a block expand and add
$bl = new Application_Model_Block($ele['item_id']);
if ($bl->isStatic()) {
foreach ($bl->getContents(true) as $track) {
$result[] = $this->createElementMap($track);
}
}
}else{
$result[] = $this->createElementMap($ele);
}
$result[] = $elementMap;
}
$this->_helper->json($result);
}
function createElementMap($track){
$elementMap = array( 'element_title' => isset($track['track_title'])?$track['track_title']:"",
'element_artist' => isset($track['artist_name'])?$track['artist_name']:"",
'element_id' => isset($track['id'])?$track['id']:"",
'element_position' => isset($track['position'])?$track['position']:"",
);
$fileExtension = pathinfo($track['path'], PATHINFO_EXTENSION);
if (strtolower($fileExtension) === 'mp3') {
$elementMap['element_mp3'] = $track['item_id'];
} else if (strtolower($fileExtension) === 'ogg') {
$elementMap['element_oga'] = $track['item_id'];
} else {
//the media was neither mp3 or ogg
}
return $elementMap;
}
/**
* Simply sets up the view to play the required show track.

View File

@ -189,7 +189,7 @@ class Application_Model_Block
*/
public function getContents($filterFiles=false)
{
Logging::log("Getting contents for playlist {$this->id}");
Logging::log("Getting contents for block {$this->id}");
$files = array();
$sql = <<<"EOT"
@ -197,13 +197,11 @@ class Application_Model_Block
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_blockcontents AS pc
LEFT JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.block_id = {$this->id};
EOT;
Logging::debug($sql);
$con = Propel::getConnection();
$rows = $con->query($sql)->fetchAll();
$offset = 0;
foreach ($rows as &$row) {
Logging::log($row);
$clipSec = Application_Common_DateHelper::playlistTimeToSeconds($row['length']);
$offset += $clipSec;

View File

@ -172,22 +172,26 @@ class Application_Model_Playlist
$rows = $query->find($this->con);
*/
$sql = <<<"EOT"
(SELECT * FROM
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.id as item_id, (ws.name || ': ' || ws.url) as title, ws.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
JOIN cc_webstream AS ws on pc.file_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1));
JOIN cc_webstream AS ws on pc.stream_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1)
UNION ALL
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
JOIN cc_block AS bl on pc.block_id=bl.id
JOIN cc_subjs as sbj ON bl.creator_id=sbj.id WHERE pc.playlist_id = {$this->id} AND pc.type = 2)) as temp
ORDER BY temp.position);
EOT;
Logging::debug($sql);
$con = Propel::getConnection();
$rows = $con->query($sql)->fetchAll();
$offset = 0;
foreach ($rows as &$row) {
Logging::log($row);
$clipSec = Application_Common_DateHelper::playlistTimeToSeconds($row['length']);
$offset += $clipSec;
$offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
@ -255,17 +259,26 @@ EOT;
return $this->pl->getDbLength();
}
private function insertPlaylistElement($info, $type)
private function insertPlaylistElement($info)
{
$row = new CcPlaylistcontents();
$row->setDbPlaylistId($this->id);
$row->setDbFileId($info["id"]);
$row->setDbPosition($info["pos"]);
$row->setDbCliplength($info["cliplength"]);
$row->setDbCuein($info["cuein"]);
$row->setDbCueout($info["cueout"]);
$row->setDbFadein($info["fadein"]);
$row->setDbFadeout($info["fadeout"]);
if ($info["ftype"] == "audioclip") {
$row->setDbFileId($info["id"]);
$type = 0;
} else if ($info["ftype"] == "stream") {
$row->setDbStreamId($info["id"]);
$type = 1;
} else if ($info["ftype"] == "block") {
$row->setDbBlockId($info["id"]);
$type = 2;
}
$row->setDbType($type);
$row->save($this->con);
// above save result update on cc_playlist table on length column.
@ -299,6 +312,7 @@ EOT;
$entry["pos"] = $pos;
$entry["cliplength"] = $obj->getDbLength();
$entry["cueout"] = $obj->getDbLength();
$entry["ftype"] = $objType;
}
return $entry;
} else {
@ -380,9 +394,9 @@ EOT;
Logging::log("at position {$pos}");
foreach ($p_items as $ac) {
$res = $this->insertPlaylistElement($this->buildEntry($ac, $pos), 0);
$res = $this->insertPlaylistElement($this->buildEntry($ac, $pos));
$pos = $pos + 1;
Logging::log("Adding audio file {$ac}");
Logging::log("Adding $ac[1] $ac[0]");
}

View File

@ -75,40 +75,39 @@ class Application_Model_Schedule
global $CC_CONFIG;
$con = Propel::getConnection();
$sql = 'Select ft.artist_name, ft.track_title, st.starts as starts, st.ends as ends, st.media_item_played as media_item_played, si.ends as show_ends
FROM cc_schedule st LEFT JOIN cc_files ft ON st.file_id = ft.id LEFT JOIN cc_show_instances si on st.instance_id = si.id
WHERE ';
/* Alternate SQL...merge conflict and I'm not sure which on is right.... -MK
$sql = 'Select ft.artist_name, ft.track_title, st.starts as starts, st.ends as ends, st.media_item_played as media_item_played, si.ends as show_ends
FROM cc_schedule st LEFT JOIN cc_files ft ON st.file_id = ft.id
WHERE ';
*/
if (isset($p_previousShowID)) {
if (isset($p_nextShowID) || isset($p_currentShowID))
$sql .= '(';
$sql .= 'st.instance_id = '.$p_previousShowID;
$sql = "SELECT %%columns%% st.starts as starts, st.ends as ends, st.media_item_played as media_item_played, si.ends as show_ends
FROM cc_schedule st JOIN %%tables%% LEFT JOIN cc_show_instances si ON st.instance_id = si.id
WHERE ";
$fileColumns = "ft.artist_name, ft.track_title, ";
$streamColumns = "ws.login as artist_name, ws.name as track_title, ";
$fileJoin = "cc_files ft ON st.file_id = ft.id";
$streamJoin = "cc_webstream ws ON st.stream_id = ws.id";
$predicateArr = array();
if (isset($p_previousShowID)) {
$predicateArr[] = 'st.instance_id = '.$p_previousShowID;
}
if (isset($p_currentShowID)) {
$predicateArr[] = 'st.instance_id = '.$p_currentShowID;
}
if (isset($p_nextShowID)) {
$predicateArr[] = 'st.instance_id = '.$p_nextShowID;
}
if ($p_currentShowID != null) {
if ($p_previousShowID != null)
$sql .= ' OR ';
else if($p_nextShowID != null)
$sql .= '(';
$sql .= 'st.instance_id = '.$p_currentShowID;
}
if ($p_nextShowID != null) {
if ($p_previousShowID != null || $p_currentShowID != null)
$sql .= ' OR ';
$sql .= 'st.instance_id = '.$p_nextShowID;
if($p_previousShowID != null || $p_currentShowID != null)
$sql .= ')';
} else if($p_previousShowID != null && $p_currentShowID != null)
$sql .= ')';
$sql .= " (".implode(" OR ", $predicateArr).") ";
$sql .= ' AND st.playout_status > 0 ORDER BY st.starts';
$filesSql = str_replace("%%columns%%", $fileColumns, $sql);
$filesSql = str_replace("%%tables%%", $fileJoin, $filesSql);
$streamSql = str_replace("%%columns%%", $streamColumns, $sql);
$streamSql = str_replace("%%tables%%", $streamJoin, $streamSql);
$sql = "SELECT * FROM (($filesSql) UNION ($streamSql)) AS unioned ORDER BY starts";
$rows = $con->query($sql)->fetchAll();
$numberOfRows = count($rows);
@ -117,42 +116,44 @@ class Application_Model_Schedule
$results['next'] = null;
$timeNowAsMillis = strtotime($p_timeNow);
for ($i = 0; $i < $numberOfRows; ++$i) {
for ($i = 0; $i < $numberOfRows; ++$i) {
// if the show is overbooked, then update the track end time to the end of the show time.
if ($rows[$i]['ends'] > $rows[$i]["show_ends"]) {
$rows[$i]['ends'] = $rows[$i]["show_ends"];
}
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) >= $timeNowAsMillis)) {
if ($i - 1 >= 0) {
$results['previous'] = array("name"=>$rows[$i-1]["artist_name"]." - ".$rows[$i-1]["track_title"],
"starts"=>$rows[$i-1]["starts"],
"ends"=>$rows[$i-1]["ends"],
"type"=>'track');
}
$results['current'] = array("name"=>$rows[$i]["artist_name"]." - ".$rows[$i]["track_title"],
"starts"=>$rows[$i]["starts"],
"ends"=> (($rows[$i]["ends"] > $rows[$i]["show_ends"]) ? $rows[$i]["show_ends"]: $rows[$i]["ends"]),
"media_item_played"=>$rows[$i]["media_item_played"],
"record"=>0,
"type"=>'track');
if ( isset($rows[$i+1])) {
$results['next'] = array("name"=>$rows[$i+1]["artist_name"]." - ".$rows[$i+1]["track_title"],
"starts"=>$rows[$i+1]["starts"],
"ends"=>$rows[$i+1]["ends"],
"type"=>'track');
}
break;
}
if (strtotime($rows[$i]['ends']) < $timeNowAsMillis ) {
$previousIndex = $i;
}
if (strtotime($rows[$i]['starts']) > $timeNowAsMillis) {
$results['next'] = array("name"=>$rows[$i]["artist_name"]." - ".$rows[$i]["track_title"],
"starts"=>$rows[$i]["starts"],
"ends"=>$rows[$i]["ends"],
"type"=>'track');
break;
}
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) >= $timeNowAsMillis)) {
if ($i - 1 >= 0) {
$results['previous'] = array("name"=>$rows[$i-1]["artist_name"]." - ".$rows[$i-1]["track_title"],
"starts"=>$rows[$i-1]["starts"],
"ends"=>$rows[$i-1]["ends"],
"type"=>'track');
}
$results['current'] = array("name"=>$rows[$i]["artist_name"]." - ".$rows[$i]["track_title"],
"starts"=>$rows[$i]["starts"],
"ends"=> (($rows[$i]["ends"] > $rows[$i]["show_ends"]) ? $rows[$i]["show_ends"]: $rows[$i]["ends"]),
"media_item_played"=>$rows[$i]["media_item_played"],
"record"=>0,
"type"=>'track');
if ( isset($rows[$i+1])) {
$results['next'] = array("name"=>$rows[$i+1]["artist_name"]." - ".$rows[$i+1]["track_title"],
"starts"=>$rows[$i+1]["starts"],
"ends"=>$rows[$i+1]["ends"],
"type"=>'track');
}
break;
}
if (strtotime($rows[$i]['ends']) < $timeNowAsMillis ) {
$previousIndex = $i;
}
if (strtotime($rows[$i]['starts']) > $timeNowAsMillis) {
$results['next'] = array("name"=>$rows[$i]["artist_name"]." - ".$rows[$i]["track_title"],
"starts"=>$rows[$i]["starts"],
"ends"=>$rows[$i]["ends"],
"type"=>'track');
break;
}
}
//If we didn't find a a current show because the time didn't fit we may still have
//found a previous show so use it.
@ -275,7 +276,6 @@ class Application_Model_Schedule
%%join%%
--JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)
RIGHT JOIN cc_show_instances AS si ON (si.id = sched.instance_id))
JOIN cc_show AS showt ON (showt.id = si.show_id)
)
@ -289,14 +289,13 @@ class Application_Model_Schedule
$templateSql .= " AND show_id IN (".implode(",", $p_shows).")";
}
$templateSql .= " ORDER BY si.starts, sched.starts";
$filesSql = str_replace("%%columns%%",
"ft.track_title AS file_track_title, ft.artist_name AS file_artist_name,
ft.album_title AS file_album_title, ft.length AS file_length, ft.file_exists AS file_exists",
$templateSql);
$filesSql= str_replace("%%join%%",
"cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)",
"cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)
RIGHT JOIN cc_show_instances AS si ON (si.id = sched.instance_id))",
$filesSql);
$streamSql = str_replace("%%columns%%",
@ -304,10 +303,11 @@ class Application_Model_Schedule
ws.description AS file_album_title, ws.length AS file_length, 't'::BOOL AS file_exists",
$templateSql);
$streamSql = str_replace("%%join%%",
"cc_schedule AS sched JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)",
"cc_schedule AS sched JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)
JOIN cc_show_instances AS si ON (si.id = sched.instance_id))",
$streamSql);
$sql = "($filesSql) UNION ($streamSql)";
$sql = "SELECT * FROM (($filesSql) UNION ($streamSql)) as temp ORDER BY si_starts, sched_starts";
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
return $rows;

View File

@ -147,9 +147,53 @@ class Application_Model_Scheduler
$files[] = $data;
}
} else if ($type === "playlist") {
$pl = new Application_Model_Playlist($id);
$contents = $pl->getContents();
foreach ($contents as $plItem) {
if ($plItem['type'] == 0){
$data["id"] = $plItem['item_id'];
$data["cliplength"] = $plItem['length'];
$data["cuein"] = $plItem['cuein'];
$data["cueout"] = $plItem['cueout'];
$data["fadein"] = $plItem['fadein'];
$data["fadeout"] = $plItem['fadeout'];
$data["type"] = 0;
$files[] = $data;
} else if ($plItem['type'] == 2) {
// if it's a block
$bl = new Application_Model_Block($plItem['item_id']);
if ($bl->isStatic()) {
foreach ($bl->getContents() as $track) {
$data["id"] = $track['item_id'];
$data["cliplength"] = $track['length'];
$data["cuein"] = $track['cuein'];
$data["cueout"] = $track['cueout'];
$data["fadein"] = $track['fadein'];
$data["fadeout"] = $track['fadeout'];
$data["type"] = 0;
$files[] = $data;
}
} else {
$dynamicFiles = $bl->getListOfFilesUnderLimit();
foreach ($dynamicFiles as $fileId=>$f) {
$file = CcFilesQuery::create()->findPk($fileId);
if (isset($file) && $file->getDbFileExists()) {
$data["id"] = $file->getDbId();
$data["cliplength"] = $file->getDbLength();
$data["cuein"] = "00:00:00";
$data["cueout"] = "00:00:00";
$data["fadein"] = "00:00:00";
$data["fadeout"] = "00:00:00";
$data["type"] = 0;
$files[] = $data;
}
}
}
}
}
// find if the playslit is static or dynamic
$c = new Criteria();
/*$c = new Criteria();
$c->add(CcPlaylistPeer::ID, $id);
$pl = CcPlaylistPeer::doSelect($c);
$playlistType = $pl[0]->getDbType();
@ -166,11 +210,11 @@ class Application_Model_Scheduler
if (is_null($contents)) {
throw new Exception("A selected Playlist does not exist!");
}
}*/
foreach ($contents as $fileId => $plItem) {
/*foreach ($contents as $fileId => $plItem) {
$data = $this->fileInfo;
if ($playlistType == "static"){
if ($plItem['type'] == 0){
$file = $plItem->getCcFiles($this->con);
if (isset($file) && $file->getDbFileExists()) {
$data["id"] = $plItem->getDbFileId();
@ -189,7 +233,7 @@ class Application_Model_Scheduler
}
}
$files[] = $data;
}
}*/
} else if ($type == "stream") {
//need to return
$stream = CcWebstreamQuery::create()->findPK($id, $this->con);
@ -213,7 +257,6 @@ class Application_Model_Scheduler
$files[] = $data;
}
}
return $files;
}

View File

@ -42,6 +42,7 @@ class CcPlaylistcontentsTableMap extends TableMap {
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addForeignKey('BLOCK_ID', 'DbBlockId', 'INTEGER', 'cc_block', 'ID', false, null, null);
$this->addColumn('STREAM_ID', 'DbStreamId', 'INTEGER', false, null, null);
$this->addColumn('TYPE', 'DbType', 'SMALLINT', true, null, 0);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
$this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');

View File

@ -48,6 +48,12 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
*/
protected $block_id;
/**
* The value for the stream_id field.
* @var int
*/
protected $stream_id;
/**
* The value for the type field.
* Note: this column has a database default value of: 0
@ -194,6 +200,16 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this->block_id;
}
/**
* Get the [stream_id] column value.
*
* @return int
*/
public function getDbStreamId()
{
return $this->stream_id;
}
/**
* Get the [type] column value.
*
@ -402,6 +418,26 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this;
} // setDbBlockId()
/**
* Set the value of [stream_id] column.
*
* @param int $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbStreamId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->stream_id !== $v) {
$this->stream_id = $v;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::STREAM_ID;
}
return $this;
} // setDbStreamId()
/**
* Set the value of [type] column.
*
@ -662,13 +698,14 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
$this->file_id = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
$this->block_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
$this->type = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
$this->position = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->cliplength = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->cuein = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->cueout = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->fadein = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->fadeout = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
$this->type = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
$this->position = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
$this->cliplength = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->cuein = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->cueout = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->fadein = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->fadeout = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
$this->resetModified();
$this->setNew(false);
@ -677,7 +714,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->ensureConsistency();
}
return $startcol + 11; // 11 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 12; // 12 = CcPlaylistcontentsPeer::NUM_COLUMNS - CcPlaylistcontentsPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcPlaylistcontents object", $e);
@ -1053,24 +1090,27 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
return $this->getDbBlockId();
break;
case 4:
return $this->getDbType();
return $this->getDbStreamId();
break;
case 5:
return $this->getDbPosition();
return $this->getDbType();
break;
case 6:
return $this->getDbCliplength();
return $this->getDbPosition();
break;
case 7:
return $this->getDbCuein();
return $this->getDbCliplength();
break;
case 8:
return $this->getDbCueout();
return $this->getDbCuein();
break;
case 9:
return $this->getDbFadein();
return $this->getDbCueout();
break;
case 10:
return $this->getDbFadein();
break;
case 11:
return $this->getDbFadeout();
break;
default:
@ -1101,13 +1141,14 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$keys[1] => $this->getDbPlaylistId(),
$keys[2] => $this->getDbFileId(),
$keys[3] => $this->getDbBlockId(),
$keys[4] => $this->getDbType(),
$keys[5] => $this->getDbPosition(),
$keys[6] => $this->getDbCliplength(),
$keys[7] => $this->getDbCuein(),
$keys[8] => $this->getDbCueout(),
$keys[9] => $this->getDbFadein(),
$keys[10] => $this->getDbFadeout(),
$keys[4] => $this->getDbStreamId(),
$keys[5] => $this->getDbType(),
$keys[6] => $this->getDbPosition(),
$keys[7] => $this->getDbCliplength(),
$keys[8] => $this->getDbCuein(),
$keys[9] => $this->getDbCueout(),
$keys[10] => $this->getDbFadein(),
$keys[11] => $this->getDbFadeout(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcFiles) {
@ -1163,24 +1204,27 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->setDbBlockId($value);
break;
case 4:
$this->setDbType($value);
$this->setDbStreamId($value);
break;
case 5:
$this->setDbPosition($value);
$this->setDbType($value);
break;
case 6:
$this->setDbCliplength($value);
$this->setDbPosition($value);
break;
case 7:
$this->setDbCuein($value);
$this->setDbCliplength($value);
break;
case 8:
$this->setDbCueout($value);
$this->setDbCuein($value);
break;
case 9:
$this->setDbFadein($value);
$this->setDbCueout($value);
break;
case 10:
$this->setDbFadein($value);
break;
case 11:
$this->setDbFadeout($value);
break;
} // switch()
@ -1211,13 +1255,14 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbFileId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbBlockId($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbType($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbPosition($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbCliplength($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbCuein($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbCueout($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbFadein($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbFadeout($arr[$keys[10]]);
if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbType($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbPosition($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbCliplength($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbCuein($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbCueout($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbFadein($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDbFadeout($arr[$keys[11]]);
}
/**
@ -1233,6 +1278,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
if ($this->isColumnModified(CcPlaylistcontentsPeer::PLAYLIST_ID)) $criteria->add(CcPlaylistcontentsPeer::PLAYLIST_ID, $this->playlist_id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::FILE_ID)) $criteria->add(CcPlaylistcontentsPeer::FILE_ID, $this->file_id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::BLOCK_ID)) $criteria->add(CcPlaylistcontentsPeer::BLOCK_ID, $this->block_id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::STREAM_ID)) $criteria->add(CcPlaylistcontentsPeer::STREAM_ID, $this->stream_id);
if ($this->isColumnModified(CcPlaylistcontentsPeer::TYPE)) $criteria->add(CcPlaylistcontentsPeer::TYPE, $this->type);
if ($this->isColumnModified(CcPlaylistcontentsPeer::POSITION)) $criteria->add(CcPlaylistcontentsPeer::POSITION, $this->position);
if ($this->isColumnModified(CcPlaylistcontentsPeer::CLIPLENGTH)) $criteria->add(CcPlaylistcontentsPeer::CLIPLENGTH, $this->cliplength);
@ -1304,6 +1350,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$copyObj->setDbPlaylistId($this->playlist_id);
$copyObj->setDbFileId($this->file_id);
$copyObj->setDbBlockId($this->block_id);
$copyObj->setDbStreamId($this->stream_id);
$copyObj->setDbType($this->type);
$copyObj->setDbPosition($this->position);
$copyObj->setDbCliplength($this->cliplength);
@ -1514,6 +1561,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
$this->playlist_id = null;
$this->file_id = null;
$this->block_id = null;
$this->stream_id = null;
$this->type = null;
$this->position = null;
$this->cliplength = null;

View File

@ -26,7 +26,7 @@ abstract class BaseCcPlaylistcontentsPeer {
const TM_CLASS = 'CcPlaylistcontentsTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 11;
const NUM_COLUMNS = 12;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -43,6 +43,9 @@ abstract class BaseCcPlaylistcontentsPeer {
/** the column name for the BLOCK_ID field */
const BLOCK_ID = 'cc_playlistcontents.BLOCK_ID';
/** the column name for the STREAM_ID field */
const STREAM_ID = 'cc_playlistcontents.STREAM_ID';
/** the column name for the TYPE field */
const TYPE = 'cc_playlistcontents.TYPE';
@ -80,12 +83,12 @@ abstract class BaseCcPlaylistcontentsPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbType', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbType', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::TYPE, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'TYPE', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'type', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbFileId', 'DbBlockId', 'DbStreamId', 'DbType', 'DbPosition', 'DbCliplength', 'DbCuein', 'DbCueout', 'DbFadein', 'DbFadeout', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbFileId', 'dbBlockId', 'dbStreamId', 'dbType', 'dbPosition', 'dbCliplength', 'dbCuein', 'dbCueout', 'dbFadein', 'dbFadeout', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::FILE_ID, self::BLOCK_ID, self::STREAM_ID, self::TYPE, self::POSITION, self::CLIPLENGTH, self::CUEIN, self::CUEOUT, self::FADEIN, self::FADEOUT, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'FILE_ID', 'BLOCK_ID', 'STREAM_ID', 'TYPE', 'POSITION', 'CLIPLENGTH', 'CUEIN', 'CUEOUT', 'FADEIN', 'FADEOUT', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'file_id', 'block_id', 'stream_id', 'type', 'position', 'cliplength', 'cuein', 'cueout', 'fadein', 'fadeout', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@ -95,12 +98,12 @@ abstract class BaseCcPlaylistcontentsPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbType' => 4, 'DbPosition' => 5, 'DbCliplength' => 6, 'DbCuein' => 7, 'DbCueout' => 8, 'DbFadein' => 9, 'DbFadeout' => 10, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbType' => 4, 'dbPosition' => 5, 'dbCliplength' => 6, 'dbCuein' => 7, 'dbCueout' => 8, 'dbFadein' => 9, 'dbFadeout' => 10, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::TYPE => 4, self::POSITION => 5, self::CLIPLENGTH => 6, self::CUEIN => 7, self::CUEOUT => 8, self::FADEIN => 9, self::FADEOUT => 10, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'TYPE' => 4, 'POSITION' => 5, 'CLIPLENGTH' => 6, 'CUEIN' => 7, 'CUEOUT' => 8, 'FADEIN' => 9, 'FADEOUT' => 10, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'type' => 4, 'position' => 5, 'cliplength' => 6, 'cuein' => 7, 'cueout' => 8, 'fadein' => 9, 'fadeout' => 10, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbFileId' => 2, 'DbBlockId' => 3, 'DbStreamId' => 4, 'DbType' => 5, 'DbPosition' => 6, 'DbCliplength' => 7, 'DbCuein' => 8, 'DbCueout' => 9, 'DbFadein' => 10, 'DbFadeout' => 11, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbFileId' => 2, 'dbBlockId' => 3, 'dbStreamId' => 4, 'dbType' => 5, 'dbPosition' => 6, 'dbCliplength' => 7, 'dbCuein' => 8, 'dbCueout' => 9, 'dbFadein' => 10, 'dbFadeout' => 11, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::FILE_ID => 2, self::BLOCK_ID => 3, self::STREAM_ID => 4, self::TYPE => 5, self::POSITION => 6, self::CLIPLENGTH => 7, self::CUEIN => 8, self::CUEOUT => 9, self::FADEIN => 10, self::FADEOUT => 11, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'FILE_ID' => 2, 'BLOCK_ID' => 3, 'STREAM_ID' => 4, 'TYPE' => 5, 'POSITION' => 6, 'CLIPLENGTH' => 7, 'CUEIN' => 8, 'CUEOUT' => 9, 'FADEIN' => 10, 'FADEOUT' => 11, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'file_id' => 2, 'block_id' => 3, 'stream_id' => 4, 'type' => 5, 'position' => 6, 'cliplength' => 7, 'cuein' => 8, 'cueout' => 9, 'fadein' => 10, 'fadeout' => 11, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@ -176,6 +179,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addSelectColumn(CcPlaylistcontentsPeer::PLAYLIST_ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::FILE_ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::BLOCK_ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::STREAM_ID);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::TYPE);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::POSITION);
$criteria->addSelectColumn(CcPlaylistcontentsPeer::CLIPLENGTH);
@ -188,6 +192,7 @@ abstract class BaseCcPlaylistcontentsPeer {
$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
$criteria->addSelectColumn($alias . '.FILE_ID');
$criteria->addSelectColumn($alias . '.BLOCK_ID');
$criteria->addSelectColumn($alias . '.STREAM_ID');
$criteria->addSelectColumn($alias . '.TYPE');
$criteria->addSelectColumn($alias . '.POSITION');
$criteria->addSelectColumn($alias . '.CLIPLENGTH');

View File

@ -10,6 +10,7 @@
* @method CcPlaylistcontentsQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
* @method CcPlaylistcontentsQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
* @method CcPlaylistcontentsQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column
* @method CcPlaylistcontentsQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column
* @method CcPlaylistcontentsQuery orderByDbType($order = Criteria::ASC) Order by the type column
* @method CcPlaylistcontentsQuery orderByDbPosition($order = Criteria::ASC) Order by the position column
* @method CcPlaylistcontentsQuery orderByDbCliplength($order = Criteria::ASC) Order by the cliplength column
@ -22,6 +23,7 @@
* @method CcPlaylistcontentsQuery groupByDbPlaylistId() Group by the playlist_id column
* @method CcPlaylistcontentsQuery groupByDbFileId() Group by the file_id column
* @method CcPlaylistcontentsQuery groupByDbBlockId() Group by the block_id column
* @method CcPlaylistcontentsQuery groupByDbStreamId() Group by the stream_id column
* @method CcPlaylistcontentsQuery groupByDbType() Group by the type column
* @method CcPlaylistcontentsQuery groupByDbPosition() Group by the position column
* @method CcPlaylistcontentsQuery groupByDbCliplength() Group by the cliplength column
@ -53,6 +55,7 @@
* @method CcPlaylistcontents findOneByDbPlaylistId(int $playlist_id) Return the first CcPlaylistcontents filtered by the playlist_id column
* @method CcPlaylistcontents findOneByDbFileId(int $file_id) Return the first CcPlaylistcontents filtered by the file_id column
* @method CcPlaylistcontents findOneByDbBlockId(int $block_id) Return the first CcPlaylistcontents filtered by the block_id column
* @method CcPlaylistcontents findOneByDbStreamId(int $stream_id) Return the first CcPlaylistcontents filtered by the stream_id column
* @method CcPlaylistcontents findOneByDbType(int $type) Return the first CcPlaylistcontents filtered by the type column
* @method CcPlaylistcontents findOneByDbPosition(int $position) Return the first CcPlaylistcontents filtered by the position column
* @method CcPlaylistcontents findOneByDbCliplength(string $cliplength) Return the first CcPlaylistcontents filtered by the cliplength column
@ -65,6 +68,7 @@
* @method array findByDbPlaylistId(int $playlist_id) Return CcPlaylistcontents objects filtered by the playlist_id column
* @method array findByDbFileId(int $file_id) Return CcPlaylistcontents objects filtered by the file_id column
* @method array findByDbBlockId(int $block_id) Return CcPlaylistcontents objects filtered by the block_id column
* @method array findByDbStreamId(int $stream_id) Return CcPlaylistcontents objects filtered by the stream_id column
* @method array findByDbType(int $type) Return CcPlaylistcontents objects filtered by the type column
* @method array findByDbPosition(int $position) Return CcPlaylistcontents objects filtered by the position column
* @method array findByDbCliplength(string $cliplength) Return CcPlaylistcontents objects filtered by the cliplength column
@ -291,6 +295,37 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
return $this->addUsingAlias(CcPlaylistcontentsPeer::BLOCK_ID, $dbBlockId, $comparison);
}
/**
* Filter the query on the stream_id column
*
* @param int|array $dbStreamId 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 CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbStreamId($dbStreamId = null, $comparison = null)
{
if (is_array($dbStreamId)) {
$useMinMax = false;
if (isset($dbStreamId['min'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbStreamId['max'])) {
$this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::STREAM_ID, $dbStreamId, $comparison);
}
/**
* Filter the query on the type column
*

View File

@ -1,5 +1,4 @@
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<button id="ws_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New Stream</button>
<?php if (isset($this->obj)) : ?>
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">

View File

@ -212,6 +212,7 @@
<column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="false"/>
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/>
<column name="block_id" phpName="DbBlockId" type="INTEGER" required="false"/>
<column name="stream_id" phpName="DbStreamId" type="INTEGER" required="false"/>
<!-- What type of item is stored in the playlist.
0: audiotrack
1: webstream

View File

@ -289,6 +289,7 @@ CREATE TABLE "cc_playlistcontents"
"playlist_id" INTEGER,
"file_id" INTEGER,
"block_id" INTEGER,
"stream_id" INTEGER,
"type" INT2 default 0 NOT NULL,
"position" INTEGER,
"cliplength" interval default '00:00:00',

View File

@ -796,21 +796,19 @@ var AIRTIME = (function(AIRTIME){
mod.init = function() {
$.contextMenu({
selector: '#spl_new',
selector: '#spl_new, #ws_new',
trigger: "left",
ignoreRightClick: true,
items: {
"sp": {name: "New Playlist", callback: AIRTIME.playlist.fnNew},
"sb": {name: "New Smart Playlist", callback: AIRTIME.playlist.fnNewBlock}
"sb": {name: "New Smart Playlist", callback: AIRTIME.playlist.fnNewBlock},
"ws": {name: "New Webstream", callback: AIRTIME.playlist.fnWsNew}
}
});
/*
$pl.delegate("#spl_new",
{"click": AIRTIME.playlist.fnNew});*/
$pl.delegate("#ws_new",
{"click": AIRTIME.playlist.fnWsNew});
$pl.delegate("#spl_delete", {"click": function(ev){
AIRTIME.playlist.fnDelete();
}});