Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x
This commit is contained in:
commit
71be2b2bd1
5 changed files with 18 additions and 21 deletions
|
@ -1113,7 +1113,12 @@ SQL;
|
|||
$this->saveSmartBlockCriteria($p_criteria);
|
||||
$insertList = $this->getListOfFilesUnderLimit();
|
||||
$this->deleteAllFilesFromBlock();
|
||||
$this->addAudioClips(array_values($insertList));
|
||||
// constrcut id array
|
||||
$ids = array();
|
||||
foreach ($insertList as $ele) {
|
||||
$ids[] = $ele['id'];
|
||||
}
|
||||
$this->addAudioClips(array_values($ids));
|
||||
// update length in playlist contents.
|
||||
$this->updateBlockLengthInAllPlaylist();
|
||||
|
||||
|
@ -1157,7 +1162,7 @@ SQL;
|
|||
while ($iterator->valid()) {
|
||||
$id = $iterator->current()->getDbId();
|
||||
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
|
||||
$insertList[] = $id;
|
||||
$insertList[] = array('id'=>$id, 'length'=>$length);
|
||||
$totalTime += $length;
|
||||
$totalItems++;
|
||||
|
||||
|
@ -1169,26 +1174,18 @@ SQL;
|
|||
$iterator->next();
|
||||
}
|
||||
|
||||
$sizeOfInsert = count($insertList);
|
||||
|
||||
// if block is not full and reapeat_track is check, fill up more
|
||||
while (!$isBlockFull && $repeat == 1) {
|
||||
if (!$iterator->valid()) {
|
||||
$iterator->closeCursor();
|
||||
$info = $this->getListofFilesMeetCriteria();
|
||||
$files = $info['files'];
|
||||
$files->getFirst();
|
||||
$iterator = $files->getIterator();
|
||||
}
|
||||
$id = $iterator->current()->getDbId();
|
||||
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
|
||||
$insertList[] = $id;
|
||||
$totalTime += $length;
|
||||
$randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert));
|
||||
$insertList[] = $insertList[$randomEleKey];
|
||||
$totalTime += $insertList[$randomEleKey]['length'];
|
||||
$totalItems++;
|
||||
|
||||
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$iterator->next();
|
||||
}
|
||||
|
||||
return $insertList;
|
||||
|
|
|
@ -13,9 +13,9 @@ class Application_Model_Datatables
|
|||
if ($dbname == 'utime' || $dbname == 'mtime') {
|
||||
$input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null;
|
||||
$input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null;
|
||||
} else if($dbname == 'bit_rate') {
|
||||
$input1 = isset($info[0])?intval($info[0]) * 1000:null;
|
||||
$input2 = isset($info[1])?intval($info[1]) * 1000:null;
|
||||
} else if($dbname == 'bit_rate' || $dbname == 'sample_rate') {
|
||||
$input1 = isset($info[0])?doubleval($info[0]) * 1000:null;
|
||||
$input2 = isset($info[1])?doubleval($info[1]) * 1000:null;
|
||||
} else {
|
||||
$input1 = isset($info[0])?$info[0]:null;
|
||||
$input2 = isset($info[1])?$info[1]:null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue