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) { } catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true); $this->playlistNotFound('block', true);
} catch (Exception $e) { } catch (Exception $e) {
Logging::info($e); //Logging::info($e);
$this->playlistUnknownError($e); $this->playlistUnknownError($e);
} }
} }

View file

@ -1113,7 +1113,12 @@ SQL;
$this->saveSmartBlockCriteria($p_criteria); $this->saveSmartBlockCriteria($p_criteria);
$insertList = $this->getListOfFilesUnderLimit(); $insertList = $this->getListOfFilesUnderLimit();
$this->deleteAllFilesFromBlock(); $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. // update length in playlist contents.
$this->updateBlockLengthInAllPlaylist(); $this->updateBlockLengthInAllPlaylist();
@ -1157,7 +1162,7 @@ SQL;
while ($iterator->valid()) { while ($iterator->valid()) {
$id = $iterator->current()->getDbId(); $id = $iterator->current()->getDbId();
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength()); $length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
$insertList[] = $id; $insertList[] = array('id'=>$id, 'length'=>$length);
$totalTime += $length; $totalTime += $length;
$totalItems++; $totalItems++;
@ -1169,26 +1174,18 @@ SQL;
$iterator->next(); $iterator->next();
} }
$sizeOfInsert = count($insertList);
// if block is not full and reapeat_track is check, fill up more // if block is not full and reapeat_track is check, fill up more
while (!$isBlockFull && $repeat == 1) { while (!$isBlockFull && $repeat == 1) {
if (!$iterator->valid()) { $randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert));
$iterator->closeCursor(); $insertList[] = $insertList[$randomEleKey];
$info = $this->getListofFilesMeetCriteria(); $totalTime += $insertList[$randomEleKey]['length'];
$files = $info['files'];
$files->getFirst();
$iterator = $files->getIterator();
}
$id = $iterator->current()->getDbId();
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
$insertList[] = $id;
$totalTime += $length;
$totalItems++; $totalItems++;
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) { if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) {
break; break;
} }
$iterator->next();
} }
return $insertList; return $insertList;

View file

@ -13,9 +13,9 @@ class Application_Model_Datatables
if ($dbname == 'utime' || $dbname == 'mtime') { if ($dbname == 'utime' || $dbname == 'mtime') {
$input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null; $input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null;
$input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null; $input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null;
} else if($dbname == 'bit_rate') { } else if($dbname == 'bit_rate' || $dbname == 'sample_rate') {
$input1 = isset($info[0])?intval($info[0]) * 1000:null; $input1 = isset($info[0])?doubleval($info[0]) * 1000:null;
$input2 = isset($info[1])?intval($info[1]) * 1000:null; $input2 = isset($info[1])?doubleval($info[1]) * 1000:null;
} else { } else {
$input1 = isset($info[0])?$info[0]:null; $input1 = isset($info[0])?$info[0]:null;
$input2 = isset($info[1])?$info[1]:null; $input2 = isset($info[1])?$info[1]:null;

View file

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

View file

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