Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x

This commit is contained in:
denise 2012-10-31 12:36:56 -04:00
commit 71be2b2bd1
5 changed files with 18 additions and 21 deletions

View File

@ -513,7 +513,7 @@ class PlaylistController extends Zend_Controller_Action
} catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {
Logging::info($e);
//Logging::info($e);
$this->playlistUnknownError($e);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -1195,7 +1195,7 @@ var validationTypes = {
"owner_id" : "s",
"rating" : "i",
"replay_gain" : "n",
"sample_rate" : "i",
"sample_rate" : "n",
"track_title" : "s",
"track_number" : "i",
"info_url" : "s",

View File

@ -190,7 +190,7 @@
} else if (th.attr('id') == "length") {
label = " hh:mm:ss.t";
} else if (th.attr('id') == "sample_rate") {
label = " Hz";
label = " kHz";
}
th.html(_fnRangeLabelPart(0));