本文整理汇总了PHP中Playlist::Recall方法的典型用法代码示例。如果您正苦于以下问题:PHP Playlist::Recall方法的具体用法?PHP Playlist::Recall怎么用?PHP Playlist::Recall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist::Recall方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Add a music clip or playlist to the schedule.
*
* @param int $p_showInstance
* ID of the show.
* @param $p_datetime
* In the format YYYY-MM-DD HH:MM:SS.mmmmmm
* @param $p_audioFileId
* (optional, either this or $p_playlistId must be set) DB ID of the audio file
* @param $p_playlistId
* (optional, either this of $p_audioFileId must be set) DB ID of the playlist
* @param $p_options
* Does nothing at the moment.
*
* @return int|PEAR_Error
* Return PEAR_Error if the item could not be added.
* Error code 555 is a scheduling conflict.
*/
public function add($p_showInstance, $p_datetime, $p_audioFileId = null, $p_playlistId = null, $p_options = null)
{
global $CC_CONFIG, $CC_DBC;
if (!is_null($p_audioFileId)) {
// Schedule a single audio track
// Load existing track
$track = StoredFile::Recall($p_audioFileId);
if (is_null($track)) {
return new PEAR_Error("Could not find audio track.");
}
// Check if there are any conflicts with existing entries
$metadata = $track->getMetadata();
$length = $metadata['MDATA_KEY_DURATION'];
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
// Insert into the table
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
$sql = "INSERT INTO " . $CC_CONFIG["scheduleTable"] . " (instance_id, starts, ends, clip_length, group_id, file_id, cue_out)" . " VALUES ({$p_showInstance}, TIMESTAMP '{$p_datetime}', " . " (TIMESTAMP '{$p_datetime}' + INTERVAL '{$length}')," . " '{$length}'," . " {$this->groupId}, {$p_audioFileId}, '{$length}')";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
//var_dump($sql);
return $result;
}
} elseif (!is_null($p_playlistId)) {
// Schedule a whole playlist
// Load existing playlist
$playlist = Playlist::Recall($p_playlistId);
if (is_null($playlist)) {
return new PEAR_Error("Could not find playlist.");
}
// Check if there are any conflicts with existing entries
$length = trim($playlist->getLength());
//var_dump($length);
if (empty($length)) {
return new PEAR_Error("Length is empty.");
}
// Insert all items into the schedule
$this->groupId = $CC_DBC->GetOne("SELECT nextval('schedule_group_id_seq')");
$itemStartTime = $p_datetime;
$plItems = $playlist->getContents();
//var_dump($plItems);
foreach ($plItems as $row) {
$trackLength = $row["cliplength"];
//var_dump($trackLength);
$sql = "INSERT INTO " . $CC_CONFIG["scheduleTable"] . " (instance_id, playlist_id, starts, ends, group_id, file_id," . " clip_length, cue_in, cue_out, fade_in, fade_out)" . " VALUES ({$p_showInstance}, {$p_playlistId}, TIMESTAMP '{$itemStartTime}', " . " (TIMESTAMP '{$itemStartTime}' + INTERVAL '{$trackLength}')," . " '{$this->groupId}', '{$row['file_id']}', '{$trackLength}', '{$row['cuein']}'," . " '{$row['cueout']}', '{$row['fadein']}','{$row['fadeout']}')";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
//var_dump($sql);
return $result;
}
$itemStartTime = $CC_DBC->getOne("SELECT TIMESTAMP '{$itemStartTime}' + INTERVAL '{$trackLength}'");
}
}
RabbitMq::PushSchedule();
return $this->groupId;
}
示例2: OutputToRss
public static function OutputToRss(&$pl, $plac, $ind = '')
{
$id = $plac['attrs']['id'];
$playlist = Playlist::Recall($id);
if (is_null($playlist) || PEAR::isError($playlist)) {
return $playlist;
}
$RADext = $playlist->getFileExtension();
if (PEAR::isError($RADext)) {
return $RADext;
}
$title = $playlist->getName();
$desc = $playlist->getPLMetaData("dc:description");
return array('type' => 'audioclip', 'gunid' => $id, 'src' => "http://XXX/YY/{$id}.{$RADext}", 'playlength' => $plac['attrs']['playlength'], 'title' => $title, 'desc' => $desc);
}
示例3: getFileMetaDataAction
public function getFileMetaDataAction()
{
$id = $this->_getParam('id');
$type = $this->_getParam('type');
if ($type == "au") {
$file = StoredFile::Recall($id);
$this->view->type = $type;
$this->view->md = $file->getMetadata();
} else {
if ($type == "pl") {
$file = Playlist::Recall($id);
$this->view->type = $type;
$this->view->md = $file->getAllPLMetaData();
$this->view->contents = $file->getContents();
}
}
}
示例4: getPlaylists
/**
* Returns an array of playlist objects that this file is a part of.
* @return array
*/
public function getPlaylists()
{
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT playlist_id " . " FROM " . $CC_CONFIG['playistTable'] . " WHERE file_id='{$this->id}'";
$ids = $CC_DBC->getAll($sql);
$playlists = array();
if (is_array($ids) && count($ids) > 0) {
foreach ($ids as $id) {
$playlists[] = Playlist::Recall($id);
}
}
return $playlists;
}
示例5: deleteAction
public function deleteAction()
{
$id = $this->_getParam('id', null);
$pl = Playlist::Recall($id);
if ($pl !== FALSE) {
Playlist::Delete($id);
$pl_sess = $this->pl_sess;
if ($pl_sess->id === $id) {
unset($pl_sess->id);
}
}
$this->view->id = $id;
$this->view->html = $this->view->render('playlist/index.phtml');
}